Sign in to follow this  
Guest AndrewW

DirectSound Volume

Recommended Posts

Help AVSIM continue to serve you!
Please donate today!

In the Initialization and Buffer Creation functions in the sound source file, you need to make sure the DSBCAPS_CTRLVOLUME flag is set.You need a line that will look something like:dsbd.dwFlags |= DSBCAPS_CTRLVOLUME | DSBCAPS_LOCSOFTWARE;Doug

Share this post


Link to post
Share on other sites

Sorry to drag up an Oooold thread, but I have exactly the same problem.I'll freely admit to being pretty inept at "C" programming, but I can make sounds loop, etc... but I just can't get the "ChangeVolume" command to work. I assume that the solution mentioned above is about adding the line to the Sound.cpp file? And my understanding is that if you're using makefile, nmake etc, to generate a "C" file as opposed to C++, that file isn't involved? Or have I got my wires crossed?Thanks in advance for any replies!

Share this post


Link to post
Share on other sites

Ed Walters - PD,Within the CreateStaticBuffer function in the Sound.cpp file, add the line in bold: ----------------------- // Set up the direct sound buffer, and only request the flags needed // since each requires some overhead and limits if the buffer can // be hardware accelerated DSBUFFERDESC dsbd; ZeroMemory( &dsbd, sizeof(DSBUFFERDESC) ); dsbd.dwSize = sizeof(DSBUFFERDESC); dsbd.dwFlags = DSBCAPS_STATIC; dsbd.dwBufferBytes = g_pWaveSoundRead[bufferN]->m_ckIn.cksize; dsbd.lpwfxFormat = g_pWaveSoundRead[bufferN]->m_pwfx; dsbd.dwFlags |= DSBCAPS_CTRLVOLUME | DSBCAPS_LOCSOFTWARE;-----------------------Hope this helps.

Share this post


Link to post
Share on other sites

Thank you _very_ much, MachTwo! That solved the problem entirely - it now does exactly what I wanted.Ed

Share this post


Link to post
Share on other sites

And the link above takes you to a spamware site... not nice... drive by malware anybody?

Share this post


Link to post
Share on other sites

>And the link above takes you to a spamware site... not>nice... drive by malware anybody? Which link... I see two. LOL ;)

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this