Commit d8aa6192 authored by David Reid's avatar David Reid

Add some experimental fading APIs to the engine API.

This is a simplified and somewhat more intuitive way of handling fades.
With these APIs, fades are applied immediately, whereas with the old
fading APIs the fades were scheduled. The old APIs still exist, but may
be removed.

The ma_sound_set_fade_in_frames/milliseconds() API sets the fade which
will be applied immediately. If the starting volume is negative, the
fade will start from the current fade volume. This will also overwrite
any existing fade that is already happening.

The ma_sound_get_current_fade_volume() API allows you to retrieve the
current volume of the fade.

The fade is layered on top of the normal volume parameter. I.e. they
are configured and applied to the signal interdependently.

Currently, all fades are applied linearly.
parent f6beb799
......@@ -103,14 +103,17 @@ int main(int argc, char** argv)
//ma_sound_group_set_pan(ma_engine_get_master_sound_group(&engine), -1);
//ma_sound_group_set_pitch(ma_engine_get_master_sound_group(&engine), 1.0f);
//ma_sound_group_set_start_delay(ma_engine_get_master_sound_group(&engine), 2000);
ma_sound_group_set_fade_in_milliseconds(&group, 0, 1, 5000);
//ma_sound_set_fade_in_milliseconds(&sound, 0, 1, 5000);
/*ma_sound_set_volume(&sound, 0.25f);*/
//ma_sound_set_pitch(&sound, 2.0f);
ma_sound_set_pan(&sound, 0.0f);
//ma_sound_set_looping(&sound, MA_TRUE);
//ma_sound_seek_to_pcm_frame(&sound, 6000000);
//ma_sound_set_start_delay(&sound, 1110);
ma_sound_set_volume(&sound, 0.5f);
//ma_sound_set_volume(&sound, 0.5f);
//ma_sound_set_fade_point_in_milliseconds(&sound, 0, 0, 1, 0, 2000);
//ma_sound_set_fade_point_auto_reset(&sound, 0, MA_FALSE); /* Enable fading around loop transitions. */
//ma_sound_set_fade_point_auto_reset(&sound, 1, MA_FALSE);
......
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