Skip to content

Module loop fix for music files and is_sound_effect checking added - #3690

Open
RPGoogles wants to merge 6 commits into
EasyRPG:masterfrom
RPGoogles:Module-Loop-fix-for-Music-files-and-is_SE-checking-added
Open

RPGoogles wants to merge 6 commits into
EasyRPG:masterfrom
RPGoogles:Module-Loop-fix-for-Music-files-and-is_SE-checking-added

Conversation

@RPGoogles

Copy link
Copy Markdown

This should be an all in one fix for the Music Looping bug when using Tracker Module formats as well as allowing Tracker Module Formats to work as Sound Effects by adding an is_sound_effect parameter that when true, sets the loop limit within libxmp to 1( loop 1 once then finish ) and when false(so a Music Track) sets the loop limit to 0 ( endless looping determined by the module file( jump commands for example ) until the Game's developer changes the BGM or ends the BGM ).

Adds functionality so the player can actually find tracker module files(.mod, .xm, .s3m and .it) for Music and Sound.
Updates the Create() to match the new header with is_SE checking functionality

Also added the parameter to the LIBXMP context
@Ghabry

Ghabry commented Oct 3, 2026

Copy link
Copy Markdown
Member

For context: In the chat fdelapena sent two tracker files that have loop points:

Archiv.zip

It was noticed that looping isn't supported at all in our code.

The proposed solution is doing loops for BGM and no loops for SE.

@Ghabry

Ghabry commented Oct 3, 2026

Copy link
Copy Markdown
Member

@RPGoogles while your code works and you found the issue with the loop handlng are you okay with me proposing a different fix?


In general we need a bit more control here by using the low level xmp_play_frame function instead of xmp_play_buffer.

There are some interactions in the code you can't be aware of which will cause issues:

We need a way to track the loop count (to determine whether a track played once otherwise you will e.g. softlock when going to an Inn and the Inn Music Plays). When xmp does the looping internally this won't work.

There is already a GetLooping function which is true for BGM and false for SE.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Development

Successfully merging this pull request may close these issues.

2 participants