Skip to content
Snippets Groups Projects
Commit e4a6cb87 authored by Marco Z's avatar Marco Z
Browse files

Fix SDL music counter pause issue

parent 29904a21
No related branches found
No related tags found
No related merge requests found
......@@ -486,6 +486,8 @@ void I_ShutdownMusic(void)
void I_PauseSong(INT32 handle)
{
(void)handle;
if(!midimode)
Mix_UnregisterEffect(MIX_CHANNEL_POST, count_music_bytes);
Mix_PauseMusic();
songpaused = true;
}
......@@ -493,6 +495,14 @@ void I_PauseSong(INT32 handle)
void I_ResumeSong(INT32 handle)
{
(void)handle;
if(!midimode)
{
while(Mix_UnregisterEffect(MIX_CHANNEL_POST, count_music_bytes) != 0) { }
// HACK: fixes issue of multiple effect callbacks being registered
if(music && !Mix_RegisterEffect(MIX_CHANNEL_POST, count_music_bytes, NULL, NULL))
// midimode and music must be checked in case nothing is actually playing
CONS_Alert(CONS_WARNING, "Error registering SDL music position counter: %s\n", Mix_GetError());
}
Mix_ResumeMusic();
songpaused = false;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment