From a96b48b0c0b574e4bb26fd9c6faa5d73f1da3390 Mon Sep 17 00:00:00 2001 From: kiritow <1362050620@qq.com> Date: Wed, 14 Jun 2017 20:50:12 +0800 Subject: [PATCH] Add direct effect add/remove control to SoundPlayer --- MiniEngine.cpp | 16 ++++++++++++++++ MiniEngine.h | 5 +++++ 2 files changed, 21 insertions(+) diff --git a/MiniEngine.cpp b/MiniEngine.cpp index 8952468..a1b50ac 100644 --- a/MiniEngine.cpp +++ b/MiniEngine.cpp @@ -2831,6 +2831,22 @@ namespace MiniEngine return Mix_SetReverseStereo(id,flip); } + int SoundPlayer::addEffect(ChannelID id,Mix_EffectFunc_t f, Mix_EffectDone_t d, void* arg) + { + return Mix_RegisterEffect(id,f,d,arg); + } + + int SoundPlayer::removeEffect(ChannelID id,Mix_EffectFunc_t f) + { + return Mix_UnregisterEffect(id,f); + } + + int SoundPlayer::removeAllEffect(ChannelID id) + { + return Mix_UnregisterAllEffects(id); + } + + AudioPlayer::_Audio* AudioPlayer::_sysAudio = nullptr; int AudioPlayer::_sysAudioCounter = 0; diff --git a/MiniEngine.h b/MiniEngine.h index 12968a5..e104388 100644 --- a/MiniEngine.h +++ b/MiniEngine.h @@ -834,6 +834,11 @@ namespace MiniEngine int setPosition(ChannelID id,int16_t angle,uint8_t distance); int setDistance(ChannelID id,uint8_t distance); int setReverseStereo(ChannelID id,int flip); + + /// Experimental: Direct Add/Remove Effect + int addEffect(ChannelID id,Mix_EffectFunc_t f, Mix_EffectDone_t d, void *arg); + int removeEffect(ChannelID id,Mix_EffectFunc_t f); + int removeAllEffect(ChannelID id); }; class StringEngine