Jump to content
  • Advertisement
Sign in to follow this  
RuneSword2

Change Volume with Direct Sound

This topic is 4851 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

When I try to change the volume of a direct sound buffer, unless the function SetVolume() returns Ok the volume don't change. The buffer has the Volume flag activated. any idea?

Share this post


Link to post
Share on other sites
Advertisement
You can set only attenuation of sound:

HRESULT IDirectSoundBuffer8::SetVolume (LONG lVolume)

where lVolume can be from 0 to -10000

Share this post


Link to post
Share on other sites
there is my code to initialize the buffer and change the volume, all goes ok except if i change the volume what really does nothing, the soud plays equal whit all values.



(...)

DSBUFFERDESC dsbdesc;

memset( &dsbdesc, 0, sizeof( DSBUFFERDESC ) );
dsbdesc.dwSize = sizeof( DSBUFFERDESC );
dsbdesc.dwFlags = DSBCAPS_CTRLVOLUME;
dsbdesc.dwBufferBytes = mmckinfo.cksize;
dsbdesc.lpwfxFormat = pwfx;

//initialize buffer
if ( FAILED( lpds->CreateSoundBuffer( &dsbdesc, &lpdsb, NULL ) ) )
{
WaveCloseReadFile( &hmmio, &pwfx );
return FALSE;
}

(...)


bool SetVolume(long vol) //vol must be a range between -10000..0
{
lpdsb->SetVolume(vol)
}



Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!