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.

GetMasterVolume and Window 7

If you have a question or need help, this is the place to be.
Post Reply
GoldenEye
Posts: 6
Joined: Thu Jun 30, 2011 3:25 pm

GetMasterVolume and Window 7

Post by GoldenEye »

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.
GoldenEye
Posts: 6
Joined: Thu Jun 30, 2011 3:25 pm

Re: GetMasterVolume and Window 7

Post by GoldenEye »

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>
Fiona
Posts: 1
Joined: Thu Dec 15, 2011 8:26 am
Contact:

Re: GetMasterVolume and Window 7

Post by Fiona »

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);
}
Davis andrian
Posts: 1
Joined: Wed Dec 21, 2011 8:30 am
Contact:

Re: GetMasterVolume and Window 7

Post by Davis andrian »

Thanks golden eye.
SarahM1
Posts: 1
Joined: Fri Feb 10, 2012 11:19 am
Contact:

Re: GetMasterVolume and Window 7

Post by SarahM1 »

I've gain more knowledge and good information from your post thanks.
article writing
User avatar
Kodyee
Posts: 1
Joined: Wed Dec 14, 2011 9:27 am
Location: USA
Contact:

Re: GetMasterVolume and Window 7

Post by Kodyee »

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
JHONMIKES
Posts: 1
Joined: Tue Feb 28, 2012 4:54 am
Contact:

Re: GetMasterVolume and Window 7

Post by JHONMIKES »

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
Post Reply