-
April 17th, 2008, 04:49 PM
#1
How to set master volume?
I'm trying to find a function that will be able to set the master volume and turn it on/off. Is there a function like waveOutSetVolume, but works for the master volume? thx
-
April 19th, 2008, 10:54 AM
#2
Re: How to set master volume?
Can anyone tell me why this code isn't working? It's supposed to mute the master volume.
#include <cstdlib>
#include <iostream>
#include <windows.h>
using namespace std;
int main(int argc, char *argv[])
{
MMRESULT result;
HMIXER hMixer;
result = mixerOpen(&hMixer, MIXER_OBJECTF_MIXER, 0, 0, 0);
MIXERLINE ml = {0};
ml.cbStruct = sizeof(MIXERLINE);
ml.dwComponentType = MIXERLINE_COMPONENTTYPE_DST_SPEAKERS;
result = mixerGetLineInfo((HMIXEROBJ) hMixer,
&ml, MIXER_GETLINEINFOF_COMPONENTTYPE);
MIXERLINECONTROLS mlc = {0};
MIXERCONTROL mc = {0};
mlc.cbStruct = sizeof(MIXERLINECONTROLS);
mlc.dwLineID = ml.dwLineID;
mlc.dwControlType = MIXERCONTROL_CONTROLTYPE_MUTE;
mlc.cControls = 1;
mlc.pamxctrl = &mc;
mlc.cbmxctrl = sizeof(MIXERCONTROL);
result = mixerGetLineControls((HMIXEROBJ) hMixer,
&mlc, MIXER_GETLINECONTROLSF_ONEBYTYPE);
MIXERCONTROLDETAILS mcd = {0};
MIXERCONTROLDETAILS_BOOLEAN mcb = {0};
mcb.fValue = true; //true for mute, false for unmute
mcd.paDetails = &mcb;
mcd.cbDetails = sizeof(MIXERCONTROLDETAILS_BOOLEAN);
result = mixerSetControlDetails((HMIXEROBJ) hMixer,
&mcd, MIXER_SETCONTROLDETAILSF_VALUE);
return 0;
}
-
April 19th, 2008, 11:06 AM
#3
Re: How to set master volume?
Originally Posted by C++N00bie
Can anyone tell me why this code isn't working? It's supposed to mute the master volume.
Why are you still not using code tags?
Anyhow, check the value of result and see what error it corresponds to.
-
March 11th, 2016, 05:01 AM
#4
Re: How to set master volume?
hey....i wanted to access my master volume using Qt which uses c++. Could you please post your code if its working. Thanks....
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|