1

I'm trying to get access to master volume in windows 7 from java but what i got so far is control over the application volume how can i get control over the master volume?

Here is my code so far:

try {
Mixer.Info[] infos = AudioSystem.getMixerInfo();  
for (Mixer.Info info: infos)  
{  
   Mixer mixer = AudioSystem.getMixer(info);
   if (mixer.isLineSupported(Port.Info.SPEAKER))  
   {  
      Port port = (Port)mixer.getLine(Port.Info.SPEAKER);  
      port.open();  
      if (port.isControlSupported(FloatControl.Type.VOLUME))  
      {  
         FloatControl volume = FloatControl)port.getControl(FloatControl.Type.VOLUME);  
         volume.setValue(volume.getValue() + (float)0.1);
      }  
      port.close();  
   }  
 }  
} catch (Exception e) {
      System.out.println(e);
}
Mihai
  • 1,254
  • 2
  • 15
  • 27
  • 1
    Check out this [post](http://stackoverflow.com/questions/1727511/java-sound-api-to-access-the-system-master-volume-control-in-vista-and-win-7). – Bala R Mar 03 '11 at 22:40
  • See also http://stackoverflow.com/questions/3249550/is-there-a-way-in-java-jna-to-set-the-master-system-volume-reliably-in-xpv/3262107 – rogerdpack Jan 29 '14 at 20:31

0 Answers0