Using the command print eg.WinApi.SoundMixer.GetMasterVolume() always returns 100.0 in Windows 7.
Is there an alternative way to get the current volume?
Thanks for your reply in advance.
G.
Notice: This forum has been recovered from an old backup, so some content, links, and dates may be outdated. The forum is currently read-only while we restore sign-in and registration functionality. Details
If you find this forum valuable and would like to help keep it online, donations to help cover hosting and domain costs are greatly appreciated, but never expected. You can support the forum through Buy Me a Coffee or Ko-fi. Thank you for helping preserve the EventGhost community.
If you find this forum valuable and would like to help keep it online, donations to help cover hosting and domain costs are greatly appreciated, but never expected. You can support the forum through Buy Me a Coffee or Ko-fi. Thank you for helping preserve the EventGhost community.
GetMasterVolume and Window 7
Re: GetMasterVolume and Window 7
Solution: You can get the current volume level by using the action ChangeMasterVolumeBy 0%:
Code: Select all
<?xml version="1.0" encoding="UTF-8" ?>
<EventGhost Version="1534">
<Macro Name="Get current volume level" Expanded="True">
<Action>
System.ChangeMasterVolumeBy(0.0, 0)
</Action>
<Action>
EventGhost.PythonCommand(u'print (int(round(eg.result,1)))')
</Action>
</Macro>
</EventGhost>Re: GetMasterVolume and Window 7
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);
}
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);
}
-
Davis andrian
- Posts: 1
- Joined: Wed Dec 21, 2011 8:30 am
- Contact:
Re: GetMasterVolume and Window 7
I've gain more knowledge and good information from your post thanks.
article writing
article writing
Re: GetMasterVolume and Window 7
Good to see this thread. I came to know a lot of things from it and i hope this would be useful for me in future too. Thanks
Re: GetMasterVolume and Window 7
Hey there, You have done a great job. I will definitely digg it and personally recommend to my friends. I am confident they will be benefited from this site.
__________
business planning
__________
business planning