shithub: choc

Download patch

ref: 214432eebbb94f41db0d9397aa4e098d4dfb3f7b
parent: 779d73e4fdfa3ddc5b77d1ef0e04aa92b5f89e88
author: Simon Howard <fraggle@soulsphere.org>
date: Sun May 27 17:20:04 EDT 2018

opl: Unpause when starting a new song.

This appears to match the vanilla (DMX) behavior and some of the higher-
level sound code in s_sound.c appears to depend on it. Specifically,
S_StopMusic() has code that calls I_ResumeSong() if the music is
currently paused. However, S_Start() clears the paused state, which
prevents the call to I_ResumeSong() from occurring. I interpret this as
implying that the call to DMX's I_PlaySong() will resume OPL playback.

Thanks to Fabian and Julia Nechaevsky for noticing the bug.

--- a/src/i_oplmusic.c
+++ b/src/i_oplmusic.c
@@ -1511,6 +1511,12 @@
     {
         InitChannel(&channels[i]);
     }
+
+    // If the music was previously paused, it needs to be unpaused; playing
+    // a new song implies that we turn off pause. This matches vanilla
+    // behavior of the DMX library, and some of the higher-level code in
+    // s_sound.c relies on this.
+    OPL_SetPaused(0);
 }
 
 static void I_OPL_PauseSong(void)