[chocolate-doom] 09/31: Fix MIDI music not pausing when using SDL_mixer's native MIDI playback. The SDL_mixer native MIDI code does not pause music properly - use a workaround of setting the volume to 0.

Jonathan Dowland jmtd at moszumanska.debian.org
Mon Jan 30 15:07:00 UTC 2017


This is an automated email from the git hooks/post-receive script.

jmtd pushed a commit to annotated tag chocolate-doom-0.1.1
in repository chocolate-doom.

commit 1ba7b1ddfd66e1ec98e4c47a79c3facbd84a7495
Author: Simon Howard <fraggle at gmail.com>
Date:   Sat Oct 15 16:58:31 2005 +0000

    Fix MIDI music not pausing when using SDL_mixer's native MIDI playback.
    The SDL_mixer native MIDI code does not pause music properly - use
    a workaround of setting the volume to 0.
    
    Subversion-branch: /trunk/chocolate-doom
    Subversion-revision: 196
---
 NEWS          |  2 ++
 src/i_sound.c | 53 ++++++++++++++++++++++++++++++++++++++++-------------
 2 files changed, 42 insertions(+), 13 deletions(-)

diff --git a/NEWS b/NEWS
index d7e1d76..2b274b4 100644
--- a/NEWS
+++ b/NEWS
@@ -4,6 +4,8 @@
      * Crash when switching applications while running fullscreen
      * Lost soul bounce logic (do not bounce in Registered/Shareware)
      * Mouse buttons mapped incorrectly (button 1 is right, 2 is middle)
+     * Music not pausing when game is paused, when using SDL_mixer's 
+       native MIDI playback.
 
 0.1.0 (2005-10-09):
     Dehacked support
diff --git a/src/i_sound.c b/src/i_sound.c
index 18be082..0c93f54 100644
--- a/src/i_sound.c
+++ b/src/i_sound.c
@@ -1,7 +1,7 @@
 // Emacs style mode select   -*- C++ -*- 
 //-----------------------------------------------------------------------------
 //
-// $Id: i_sound.c 152 2005-10-02 20:23:04Z fraggle $
+// $Id: i_sound.c 196 2005-10-15 16:58:31Z fraggle $
 //
 // Copyright(C) 1993-1996 Id Software, Inc.
 // Copyright(C) 2005 Simon Howard
@@ -22,6 +22,11 @@
 // 02111-1307, USA.
 //
 // $Log$
+// Revision 1.21  2005/10/15 16:58:31  fraggle
+// Fix MIDI music not pausing when using SDL_mixer's native MIDI playback.
+// The SDL_mixer native MIDI code does not pause music properly - use
+// a workaround of setting the volume to 0.
+//
 // Revision 1.20  2005/10/02 20:23:04  fraggle
 // Guard against music lumps containing non-MUS data, document in bugs list
 //
@@ -96,7 +101,7 @@
 //-----------------------------------------------------------------------------
 
 static const char
-rcsid[] = "$Id: i_sound.c 152 2005-10-02 20:23:04Z fraggle $";
+rcsid[] = "$Id: i_sound.c 196 2005-10-15 16:58:31Z fraggle $";
 
 #include <stdio.h>
 #include <stdlib.h>
@@ -270,15 +275,6 @@ void I_SetSfxVolume(int volume)
     snd_SfxVolume = volume;
 }
 
-// MUSIC API - dummy. Some code from DOS version.
-void I_SetMusicVolume(int volume)
-{
-    // Internal state variable.
-    snd_MusicVolume = volume;
-
-    Mix_VolumeMusic((volume * MIX_MAX_VOLUME) / 15);
-}
-
 
 //
 // Retrieve the raw data lump index
@@ -505,6 +501,33 @@ void I_ShutdownMusic(void)
 
 static int	looping=0;
 static int	musicdies=-1;
+static boolean  musicpaused = false;
+
+//
+// SDL_mixer's native MIDI music playing does not pause properly.
+// As a workaround, set the volume to 0 when paused.
+//
+
+static void UpdateMusicVolume(void)
+{
+    int vol;
+
+    if (musicpaused)
+        vol = 0;
+    else
+        vol = (snd_MusicVolume * MIX_MAX_VOLUME) / 15;
+
+    Mix_VolumeMusic(vol);
+}
+
+// MUSIC API - dummy. Some code from DOS version.
+void I_SetMusicVolume(int volume)
+{
+    // Internal state variable.
+    snd_MusicVolume = volume;
+
+    UpdateMusicVolume();
+}
 
 void I_PlaySong(void *handle, int looping)
 {
@@ -530,7 +553,9 @@ void I_PauseSong (void *handle)
     if (!music_initialised)
         return;
 
-    Mix_PauseMusic();
+    musicpaused = true;
+
+    UpdateMusicVolume();
 }
 
 void I_ResumeSong (void *handle)
@@ -538,7 +563,9 @@ void I_ResumeSong (void *handle)
     if (!music_initialised)
         return;
 
-    Mix_ResumeMusic();
+    musicpaused = false;
+
+    UpdateMusicVolume();
 }
 
 void I_StopSong(void *handle)

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-games/chocolate-doom.git



More information about the Pkg-games-commits mailing list