Patch for SDL_mixer 1.2.5 (or CVS)

This is related to my previous message:
[SDL] Strange behaviour of Mix_FadeInMusic (1.2.5) on mods
http://www.libsdl.org/pipermail/sdl/2003-November/057749.html

+++++ Analysis (continued):
It appears that calling mikmod’s Player_SetVolume() does nothing when called
before Player_Start() since pf [global variable initialized in mplayer.c] is
NULL then. This API seems a bit strange to me but well…

+++++ Patch:#####
— ./music.c.orig 2003-11-09 14:47:04.000000000 +0100
+++ ./music.c 2003-11-09 16:15:19.000000000 +0100
@@ -135,6 +135,7 @@
static int ms_per_step;

/* Local low-level functions prototypes */
+static void music_internal_initialize_volume(void);
static void music_internal_volume(int volume);
static int music_internal_play(Mix_Music *music, double position);
static int music_internal_position(double position);
@@ -620,10 +621,8 @@
music_playing = music;

/* Set the initial volume */
  • if ( music->fading == MIX_FADING_IN ) {
  •   music_internal_volume(0);
    
  • } else {
  •   music_internal_volume(music_volume);
    
  • if ( music->type != MUS_MOD ) {

  •   music_internal_initialize_volume();
    

    }

    /* Set up for playback */
    @@ -641,6 +640,8 @@
    #ifdef MOD_MUSIC
    case MUS_MOD:
    Player_Start(music->data.module);

  •   /* Player_SetVolume() does nothing before Player_Start() */
    
  •   music_internal_initialize_volume();
      break;
    

#endif
#ifdef MID_MUSIC
@@ -788,6 +789,16 @@
return(retval);
}

+/* Set the music’s initial volume */
+static void music_internal_initialize_volume(void)
+{

  • if ( music_playing->fading == MIX_FADING_IN ) {
  •   music_internal_volume(0);
    
  • } else {
  •   music_internal_volume(music_volume);
    
  • }
    +}

/* Set the music volume */
static void music_internal_volume(int volume)
{

Thanks for your time.

+++++ Analysis (continued):
It appears that calling mikmod’s Player_SetVolume() does nothing when called
before Player_Start() since pf [global variable initialized in mplayer.c] is
NULL then. This API seems a bit strange to me but well…

This patch is in CVS now, thanks!

–ryan.