Skip to main content
GameDev.net gamedev.net
🔒 Locked

C++ DirectSound SetVolume,Pan

Started by Schildpad May 5, 2005 at 8:56 AM 1 replies 3.6k views
Original Post
Schildpad
Schildpad
[quote="DirectX Documentation"] Allowable values are between DSBVOLUME_MAX (no attenuation) and DSBVOLUME_MIN (silence). These values are defined in Dsound.h as 0 and –10,000 respectively. The value DSBVOLUME_MAX represents the original, unadjusted volume of the stream. The value DSBVOLUME_MIN indicates an audio volume attenuated by 100 dB, which, for all practical purposes, is silence. [/quote] -10000 means silence, but it differs from hardware to hardware, silence can be -3000 or -5000 or whatever. This is of course a problem if you want to play a sound at half volume and you think, ow yeah, let's try -5000 and you hear nothing. How do people solve this? Is there a way to know the (in this case) highest silence value? thx for taking the time to read this :)
Supernat02
Supernat02
Don't think of -10000 as a level, because it is a scaled attenuation (i.e. 10000 units = 100 dB). If your original sound level is 60 dB, then you attenuate it by 100, you end up with a -40 dB signal level. If the original sound is 30 dB, MUCH softer, then you attenuate it by 100 again, it will be -70. This indicates that the amount you want to attenuate the sound with will depend on the level of the sound to begin with.

So, you can cut the volume in half, but you have to know the original level.

I can't tell you how to find out what the original level is, because I'm not THAT familiar with DirectSound unfortunately, but if you can get that, you can just subtract 6 dB from that value and that will be about "half" as loud.

Decibels are a logarithmic representation. Every 3 dB, you fairly closely double the value. Every 10 dB, you gain the value by 10. When it comes to sound, you have to quadruple the energy to double the loudness.
Chris ByersMicrosoft DirectX MVP - 2005
Schildpad
Schildpad
ow, thx for the explaination.

I'll try and find some information on decibels and how to find out the levels of a certain sound.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.