Skip to content

Commit

Permalink
Fixed bug 1558 - mikmod broken volume and loop support
Browse files Browse the repository at this point in the history
raptor85

When playing .mod or .it files using SDL_mixer's mikmod support looping and initial volume are ignored, making music play improperly and making volume reset to max every time the song loops.  This makes Mix_VolumeMusic work differently for mikmod than any other music support as it doesn't persist volume through the loop.

Attached is a quick patch I made that fixes both issues for me by enabling loop support and setting the initial volume when starting play.
  • Loading branch information
slouken committed Oct 21, 2017
1 parent 313d16e commit e13ba05
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions music_mikmod.c
Expand Up @@ -319,15 +319,12 @@ void *MIKMOD_CreateFromRW(SDL_RWops *src, int freesrc)
return NULL;
}

/* Stop implicit looping, fade out and other flags. */
/* Allow implicit looping, disable fade out and other flags. */
music->module->extspd = 1;
music->module->panflag = 1;
music->module->wrap = 0;
music->module->loop = 0;
#if 0 /* Don't set fade out by default - unfortunately there's no real way
to query the status of the song or set trigger actions. Hum. */
music->module->fadeout = 1;
#endif
music->module->loop = 1;
music->module->fadeout = 0;

if ((*mikmod.md_mode & DMODE_16BITS) == DMODE_16BITS) {
format = AUDIO_S16SYS;
Expand Down Expand Up @@ -373,8 +370,8 @@ static int MIKMOD_Play(void *context, int play_count)
{
MIKMOD_Music *music = (MIKMOD_Music *)context;
music->play_count = play_count;
music->module->initvolume = music->volume;
mikmod.Player_Start(music->module);
mikmod.Player_SetVolume((SWORD)music->volume);
return MIKMOD_Seek(music, 0.0);
}

Expand Down

0 comments on commit e13ba05

Please sign in to comment.