Need equation for converting decibels (dB) to standard scale 0 to 10000
Posted on 2001-09-11
I need to fade volume of a DirectSound buffer but IDirectSoundBuffer:SetVolume wants the volume level specified in in hundredths of decibels (dB). Allowable values are between DSBVOLUME_MAX (no attenuation) and DSBVOLUME_MIN (silence). These values are currently 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.
Ramping SetVolume between -10000 and 0 (to fade in) results in a audibility between about -4000 and 0 and gives me a quick fade at the end of my ramp. I need a steady fade throughough. How do I convert say 0 to 10000 to necessary SetVolume argument that gives me a steady ramp? Thanks!!