4 Replies Latest reply on Apr 12, 2013 12:28 PM by PhHein

    How can I control system's volume with java?

      Hi, I'm trying to make a remote audio control and I need a way to set current volume by code.

      After looking at java sound APIs I came up with this:
      line = mixer.getLine(lineInfo);
      boolean opened = line.isOpen() || line instanceof Clip;
           System.out.println("Line is not open, trying to open it...");
           opened = true;
                FloatControl volumeCtrl = (FloatControl)line.getControl(FloatControl.Type.VOLUME);
                     System.out.println("Current volume is: "+volumeCtrl.getValue());
      I tried this code with every mixer I have (althought I think it's the "SPEAKER" one...) but I always get 1.0 as current volume, no matter what.
      So, I'm getting something wrong..can you help me?:(