mirror of
https://github.com/mackron/miniaudio.git
synced 2026-04-22 16:24:04 +02:00
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).
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user