mirror of
https://github.com/hedge-dev/UnleashedRecomp.git
synced 2026-04-28 05:11: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
|
struct EmbeddedSoundData
|
||||||
{
|
{
|
||||||
static const int SimultaneousLimit = 4;
|
|
||||||
Mix_Chunk* chunk{};
|
Mix_Chunk* chunk{};
|
||||||
int channelIndex{};
|
|
||||||
};
|
};
|
||||||
|
|
||||||
static std::array<EmbeddedSoundData, size_t(EmbeddedSound::Count)> g_embeddedSoundData = {};
|
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 },
|
{ "sys_actstg_pausewinopen", EmbeddedSound::SysActStgPauseWinOpen },
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static size_t g_channelIndex;
|
||||||
|
|
||||||
static void PlayEmbeddedSound(EmbeddedSound s)
|
static void PlayEmbeddedSound(EmbeddedSound s)
|
||||||
{
|
{
|
||||||
EmbeddedSoundData &data = g_embeddedSoundData[size_t(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);
|
data.chunk = Mix_LoadWAV_RW(SDL_RWFromConstMem(soundData, soundDataSize), 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
Mix_PlayChannel(data.channelIndex % EmbeddedSoundData::SimultaneousLimit, data.chunk, 0);
|
Mix_PlayChannel(g_channelIndex % MIX_CHANNELS, data.chunk, 0);
|
||||||
++data.channelIndex;
|
++g_channelIndex;
|
||||||
}
|
}
|
||||||
|
|
||||||
void EmbeddedPlayer::Init()
|
void EmbeddedPlayer::Init()
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue