Advertisement Jump to content
Sign in to follow this  
RuneSword2

Change Volume with Direct Sound

This topic is 4914 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.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!