mirror of
https://github.com/hedge-dev/UnleashedRecomp.git
synced 2026-04-27 21:01:37 +00:00
Make channel index a global variable in embedded player.
This commit is contained in:
parent
68343a574c
commit
e3a2dd9e90
1 changed files with 5 additions and 5 deletions
|
|
@ -24,9 +24,7 @@ enum class EmbeddedSound
|
|||
|
||||
struct EmbeddedSoundData
|
||||
{
|
||||
static const int SimultaneousLimit = 4;
|
||||
Mix_Chunk* chunk{};
|
||||
int channelIndex{};
|
||||
};
|
||||
|
||||
static std::array<EmbeddedSoundData, size_t(EmbeddedSound::Count)> g_embeddedSoundData = {};
|
||||
|
|
@ -41,6 +39,8 @@ static const std::unordered_map<std::string_view, EmbeddedSound> 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()
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue