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...
LVL 2
VBDesignsAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

chensuCommented:
The best way is to use the Win32 Audio Mixer functions. See my article at CodeGuru.

Audio Mixer Functions Demo
http://www.codeguru.com/multimedia/ADMixer.shtml
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
chensuCommented:
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.
0
seanpalmerCommented:
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_BADDEVICEID;
  int i=auxGetNumDevs();
  AUXCAPS caps;
  for (; --i>=0; ) {
    if (MMSYSERR_NOERROR==auxGetDevCaps(i,&caps,sizeof(caps)))
      if (caps.wTechnology==AUXCAPS_CDAUDIO && 
          (caps.dwSupport&AUXCAPS_VOLUME)!=0) {
        uint v16=(vol<<9)|(vol<<2)|(vol>>5); // (vol*65535)/127
        dwReturn=auxSetVolume(i,(v16<<16)|v16);
      }
  }
0
Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

chensuCommented:
Then you have to use Audio Mixer functions because some audio device drivers may not support aux*.
0
VBDesignsAuthor Commented:
Trying the aux before the mixer worked great -- thanks!
0
seanpalmerCommented:
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!
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
C++

From novice to tech pro — start learning today.