diff --git a/UnleashedRecomp/apu/embedded_player.cpp b/UnleashedRecomp/apu/embedded_player.cpp index e72b7b6a..5e6c7ea9 100644 --- a/UnleashedRecomp/apu/embedded_player.cpp +++ b/UnleashedRecomp/apu/embedded_player.cpp @@ -24,9 +24,7 @@ enum class EmbeddedSound struct EmbeddedSoundData { - static const int SimultaneousLimit = 4; Mix_Chunk* chunk{}; - int channelIndex{}; }; static std::array g_embeddedSoundData = {}; @@ -41,6 +39,8 @@ static const std::unordered_map g_embeddedSound { "sys_actstg_pausewinopen", EmbeddedSound::SysActStgPauseWinOpen }, }; +static size_t g_channelIndex; + static void PlayEmbeddedSound(EmbeddedSound s) { EmbeddedSoundData &data = g_embeddedSoundData[size_t(s)]; @@ -86,9 +86,9 @@ static void PlayEmbeddedSound(EmbeddedSound s) data.chunk = Mix_LoadWAV_RW(SDL_RWFromConstMem(soundData, soundDataSize), 1); } - - Mix_PlayChannel(data.channelIndex % EmbeddedSoundData::SimultaneousLimit, data.chunk, 0); - ++data.channelIndex; + + Mix_PlayChannel(g_channelIndex % MIX_CHANNELS, data.chunk, 0); + ++g_channelIndex; } void EmbeddedPlayer::Init()