Engine: Add support for fading.

This adds support for having a sound fade in when it is started and
fade out when it is stopped.

This commit does not yet include support for fading out when the sound
approaches the end - it only fades out when explicitly stopped with
ma_sound_stop().

The fade time is set in milliseconds.

This commit includes a new effect called ma_fader, but it currently
only supports f32 formats. Support for other formats will be added in
the future.
This commit is contained in:
David Reid
2020-08-08 19:31:49 +10:00
parent 764ebc5e1b
commit 9763fa626b
2 changed files with 360 additions and 16 deletions
+4 -1
View File
@@ -39,7 +39,10 @@ int main(int argc, char** argv)
ma_engine_sound_set_pitch(&engine, &sound, 1.0f);
ma_engine_sound_set_pan(&engine, &sound, 0.0f);
ma_engine_sound_set_looping(&engine, &sound, MA_TRUE);
ma_engine_sound_start(&engine, &sound);
ma_engine_sound_start(&engine, &sound, 4000);
ma_sleep(5000);
ma_engine_sound_stop(&engine, &sound, 4000);
#endif
#if 1