Commit 6d1a1ccd authored by David Reid's avatar David Reid

Engine: Improve support for fading in and out of sounds.

Fading is now set using these APIs:

  * ma_engine_sound_set_fade_in()
  * ma_engine_sound_set_fade_out()

When a sound is stopped, either by naturally reaching the end, or
explicitly with ma_engine_sound_stop(), the fade out will be applied.
Fading will also be applied around loop transitions.

Note that when a sound is stopped implicitly by it reaching the end,
fading out will not work when the length of the sound is not know (that
is, when ma_data_source_get_length_in_pcm_frames() returns 0).
parent b61fc570
......@@ -39,12 +39,13 @@ 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, 4000);
ma_engine_sound_seek_to_pcm_frame(&engine, &sound, 1000000);
//ma_engine_sound_seek_to_pcm_frame(&engine, &sound, 6000000);
ma_engine_sound_set_fade_in(&engine, &sound, 2000);
ma_engine_sound_set_fade_out(&engine, &sound, 2000);
ma_engine_sound_start(&engine, &sound);
ma_sleep(5000);
ma_engine_sound_stop(&engine, &sound, 4000);
//ma_engine_sound_stop(&engine, &sound);
#endif
#if 1
......
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment