Is there a way in Java (+- JNA) to set the master system volume reliably in XP+Vista+Windows 7?

后端 未结 2 1154
深忆病人
深忆病人 2020-12-11 13:11

Appears that java\'s sound API\'s work well for single streams, and even for setting the input from the microphone, but not for setting the master volume level in Vista/Wind

2条回答
  •  不思量自难忘°
    2020-12-11 14:01

    seeing as there appears to be no native solution, my current method is to use jna to send keyboard strokes for "keyboard volume up and down":

    https://superuser.com/questions/82229/how-to-control-master-volume-in-windows-7/86227#86227

    You might be able to create a dll then hook into it that is "vista volume aware" and could actually control it right, and call methods on that, using jna.

    ffi/jna/jnr/jacob (to access IAudioEndpointVolume etc.) might work. (appears jna doesn't really support COM?) ffi looks scary too, in that regard.

    Could possibly use a java COM bridge to do the same. So next thought is to try either bridj or jacob

提交回复
热议问题