mackron / miniaudio

Audio playback and capture library written in C, in a single source file.
https://miniaud.io
Other
4.07k stars 361 forks source link

Fade is not working if sound has current volume equal zero #727

Closed Oldes closed 1 year ago

Oldes commented 1 year ago

This works OK:

ma_sound_set_fade_in_pcm_frames(pSound, 0, 1.0, 44100);

But when the sound first have set volume to zero, the fade is not started.

ma_sound_set_volume(pSound, 0);
ma_sound_set_fade_in_pcm_frames(pSound, -1, 1.0, 44100);

It is most probably because zero volume sounds are skipped from processing, but still, should not it be supported without manually setting the volume to some almost zero value?

Oldes commented 1 year ago

Hm... it looks that the fader has separate volume values and the volume set ma_sound_set_volume is not affected by the fader... I wonder how I could change the volume value with a fade?

mackron commented 1 year ago

This is intended behaviour. The two are decoupled like you discovered. There's no built-in way to smoothly change the volume itself.

(Converting this one to a discussion.)