Here is a simple code to obtain a master volume value in Windows:
the mixer is opened OK. But I get MMSYSERR_INVALPARAM error on the bold line.Code:HMIXER hMixer; MIXERLINE ml = {0}; memset (&ml, 0, sizeof (MIXERLINE)); // get a handle to the mixer device result = mixerOpen(&hMixer, 0, 0, 0, MIXER_OBJECTF_HMIXER); if (MMSYSERR_NOERROR == result) { ml.cbStruct = sizeof(MIXERLINE); ml.dwComponentType = MIXERLINE_COMPONENTTYPE_DST_SPEAKERS; // get the speaker line of the mixer device result = mixerGetLineInfo((HMIXEROBJ) hMixer, &ml, MIXER_GETLINEINFOF_COMPONENTTYPE); ....................... }
This code works perfectly on all machines but one. That computer has a built-in sound card from Realtek.
Does anyone know why it could happen?
Thanks a lot.




Reply With Quote