foxygit / doom Log in
commit 214432eebbb94f41db0d9397aa4e098d4dfb3f7b
Author:     Simon Howard <fraggle@soulsphere.org>
AuthorDate: Sun May 27 21:20:04 2018 -0400
Commit:     Simon Howard <fraggle@soulsphere.org>
CommitDate: Sun May 27 21:20:04 2018 -0400

    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.
---
 src/i_oplmusic.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/src/i_oplmusic.c b/src/i_oplmusic.c
index 1d238008..1a42aef2 100644
--- a/src/i_oplmusic.c
+++ b/src/i_oplmusic.c
@@ -1511,6 +1511,12 @@ static void I_OPL_PlaySong(void *handle, boolean looping)
     {
         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)