Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

coolzhao

how can I use float value to mark sound volumn?

This topic is 5283 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

(Sorry!My English is poor,but I''ll try my best to express my notion.) In directsound,the DSBVOLUMN_MAX is defined as 0 and the DSBVOLUME_MIN is defined as -10000. Now , I am writing a sound manager.I want to define the maximum volumn as 1.0f and minimum volumn as 0.0f , but I do not know how to transfer. Would you please tell me how can I do?

Share this post


Link to post
Share on other sites
Advertisement
not sure if this is what you want to do..but.....

You want to map DSBVOLUME_MIN to 0.0f, and
DSBVOLUMN_MAX to 1.0f.

float reMapDSBVOL( int Vol )
{
// Where Vol is your value between 0.0f & 1.0f
return ( (1.0f - Vol) * DBSVOLUME_MIN );
}

Probably want to write a macro to do this.

[edit] actually, you probably want to return an int.

[edited by - RavNaz on June 1, 2004 9:28:29 AM]

Share this post


Link to post
Share on other sites
thank you,

I do not think the translation is linear,
because the dxsdk said the param in
HRESULT SetVolumn( LONG lVolume ) ;
is attenuation, in hundredths of a decibel (dB).



Share this post


Link to post
Share on other sites
v = 0..1
x = -log10( (v*120) / 20 )

ds = (10000 * x)

ds = direct sound volume
x = scale
v = linear knob

[edited by - PeterTarkus on June 1, 2004 10:15:40 AM]

Share this post


Link to post
Share on other sites

  • 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!