Re: [AD] set_volume

[ Thread Index | Date Index | More lists.liballeg.org/allegro-developers Archives ]


> set_volume(255, -1);  file://sets volume to 100%
> set_volume(0, -1);    file://sets volume to 0%
> set_volume(64, -1);   file://sets volume to 0%
> set_volume(128, -1);  file://sets volume to 0%
> set_volume(192, -1);  file://sets volume to 50%
>
> Interesting behavior for set_volume, n'est pas?

Interesting indeed...

> I tried to divide the sound volume in wdsound.c by 255.0 instead of 255
> thinking maybe it was an integer thing (it looked like it was trying to
> make a fraction, in which (num<255)/255 == 0), but that didn't help.

That's more serious. There is a flaw in the allegro units to decibels
conversion: after doing the logarithmic transformation, the code linearly
interpolates between DSBVOLUME_MIN (for a log scale, this means infinity)
and DSBVOLUME_MAX !!!

I've attached a fix.

--
Eric Botcazou
ebotcazou@xxxxxxxxxx

Attachment: sound2.zip
Description: Zip compressed data



Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/