fix volume calc; meant to change the comment but not the equation
make sure setting volume to 0 works
This commit is contained in:
@@ -176,7 +176,7 @@ DSoundBuf::DSoundBuf( DSound &ds, DSoundBuf::hw hardware,
|
|||||||
samplerate = samplerate_;
|
samplerate = samplerate_;
|
||||||
samplebits = samplebits_;
|
samplebits = samplebits_;
|
||||||
writeahead = writeahead_ * bytes_per_frame();
|
writeahead = writeahead_ * bytes_per_frame();
|
||||||
volume = 0;
|
volume = -1; /* unset */
|
||||||
buffer_locked = false;
|
buffer_locked = false;
|
||||||
last_cursor_pos = write_cursor = buffer_bytes_filled = 0;
|
last_cursor_pos = write_cursor = buffer_bytes_filled = 0;
|
||||||
LastPosition = 0;
|
LastPosition = 0;
|
||||||
@@ -302,7 +302,7 @@ void DSoundBuf::SetVolume(float vol)
|
|||||||
float vl2 = log10f(vol) / log10f(2); /* vol log 2 */
|
float vl2 = log10f(vol) / log10f(2); /* vol log 2 */
|
||||||
|
|
||||||
/* Volume is a multiplier; SetVolume wants attenuation in hundredths of a decibel. */
|
/* Volume is a multiplier; SetVolume wants attenuation in hundredths of a decibel. */
|
||||||
const int new_volume = max( int(100 * vl2), DSBVOLUME_MIN );
|
const int new_volume = max( int(1000 * vl2), DSBVOLUME_MIN );
|
||||||
|
|
||||||
if( volume == new_volume )
|
if( volume == new_volume )
|
||||||
return;
|
return;
|
||||||
|
|||||||
Reference in New Issue
Block a user