We are currently migrating Bugzilla to GitHub issues.
Any changes made to the bug tracker now will be lost, so please do not post new bugs or make changes to them.
When we're done, all bug URLs will redirect to their equivalent location on the new bug tracker.

Bug 1558

Summary: mikmod broken volume and loop support
Product: SDL_mixer Reporter: raptor85
Component: miscAssignee: Ryan C. Gordon <icculus>
Status: RESOLVED FIXED QA Contact: Sam Lantinga <slouken>
Severity: major    
Priority: P2 CC: radiantstatue
Version: unspecified   
Hardware: All   
OS: All   
Attachments: patch to fix volume and looping issues in SDL_mixer mikmod suppport
fixed version of patch without wrap turned on

Description raptor85 2012-07-26 14:41:56 UTC
Created attachment 914 [details]
patch to fix volume and looping issues in SDL_mixer mikmod suppport

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.
Comment 1 Sam Lantinga 2012-07-26 23:13:33 UTC
Does it enable loop support, or does it actually make all mod music loop by default?
Comment 2 raptor85 2012-07-26 23:26:11 UTC
Created attachment 915 [details]
fixed version of patch without wrap turned on

the "loop" setting for mikmod enabled in-module looping, not looping the entire mod, with it set to 0 mikmod will ignore any segement loops which causes most songs to play improperly.

I just uploaded a new patch though, i noticed i accidently left "wrap" turned on after you mentioned that, "wrap" is the setting that tells the mod file to play forever in mikmod so you probably don't want that patched in on your version.
Comment 3 Mika Attila 2012-10-06 03:06:52 UTC
I tested the patch, and it works well for me.

As raptor85 mentioned, wrap is the flag that tells mikmod to loop forever.

The loop flag is for in-module loops, which should play how they are meant to, even if they play endlessly regardless of the loop parameter in SDL_PlayMusic.

In that case, the user should manually stop the song when he wants to.
Comment 4 Sam Lantinga 2017-10-21 22:21:48 UTC
Fixed, thanks!
https://hg.libsdl.org/SDL_mixer/rev/4359e193d93f