VBDesigns
asked on
Best way to change CD Volume?
What is the best way to change the CD Audio volume via API?
Right now, we're using the MCI mixer and setting the CD Audio -- however, it changes the WAV volume and not the CD volume on many cards, so it's not the best solution...
Right now, we're using the MCI mixer and setting the CD Audio -- however, it changes the WAV volume and not the CD volume on many cards, so it's not the best solution...
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Another simple way is to use auxGetNumDevs and auxGetDevCaps to find out the CD Audio device (wTechnology of AUXCAPS == AUXCAPS_CDAUDIO and (dwSupport of AUXCAPS & AUXCAPS_VOLUME) != 0). Then use auxSetVolume.
Ok, I tried that, and now auxGetNumDevs is returning 0.
I don't think that's supposed to happen (I have a Sound Blaster Live Value installed, otherwise working properly) but it does seem to be par for the course in this wacky maze of audio api's. ;)
Any other ideas?
Here's the code I have so far:
DWORD dwReturn=MMSYSERR_BADDEVIC EID;
int i=auxGetNumDevs();
AUXCAPS caps;
for (; --i>=0; ) {
if (MMSYSERR_NOERROR==auxGetD evCaps(i,& caps,sizeo f(caps)))
if (caps.wTechnology==AUXCAPS _CDAUDIO &&
(caps.dwSupport&AUXCAPS_VO LUME)!=0) {
uint v16=(vol<<9)|(vol<<2)|(vol >>5); // (vol*65535)/127
dwReturn=auxSetVolume(i,(v 16<<16)|v1 6);
}
}
I don't think that's supposed to happen (I have a Sound Blaster Live Value installed, otherwise working properly) but it does seem to be par for the course in this wacky maze of audio api's. ;)
Any other ideas?
Here's the code I have so far:
DWORD dwReturn=MMSYSERR_BADDEVIC
int i=auxGetNumDevs();
AUXCAPS caps;
for (; --i>=0; ) {
if (MMSYSERR_NOERROR==auxGetD
if (caps.wTechnology==AUXCAPS
(caps.dwSupport&AUXCAPS_VO
uint v16=(vol<<9)|(vol<<2)|(vol
dwReturn=auxSetVolume(i,(v
}
}
Then you have to use Audio Mixer functions because some audio device drivers may not support aux*.
ASKER
Trying the aux before the mixer worked great -- thanks!
Also I think I was misusing the MIXERLINECONTROLS.dwLineID field by putting the wrong kind of index into it. I believe that may solve the other problem (of mixer method adjusting wave volume instead of cd volume)
This stuff is not documented very well... looking at your examples proved to be fruitful. Thanks alot!
This stuff is not documented very well... looking at your examples proved to be fruitful. Thanks alot!