-
Notifications
You must be signed in to change notification settings - Fork 41
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix handling of single-row loops #30
base: master
Are you sure you want to change the base?
Conversation
In S3M files, at least, a pattern loop effect (SBn) without a preceding start marker (SB0) repeats that single row. If a mod file has a single row loop after a normal loop in the same pattern, this would cause an infinite loop, since the first loop resets the later loop's counter, but both loop to the same point.
Thanks for this, I merged this in my fork (https://github.com/sezero/libmodplug.git) |
👍 There are quite a few changes to merge in... |
This patch is incorrect and should not be merged as-is. After a loop has finished playing, the loop start row should be set to the row following the loop end command, which just happens to be the same row as the row where the SB7 effect is placed in this particular example. Also, this behaviour is only correct for IT and S3M files, but the patch applies it to all formats. The correct way of handling this can be found in libopenmpt's Snd_fx.cpp (basically, instead of setting the loop start to 0, set it to m_nRow + 1 -- but only for IT and S3M files). |
@sagamusix: So it should be a two lines addition as in the following, yes?
|
That looks better indeed. I think you also have to take care that the loop start is reset on pattern transitions, and S3M technically only has one global nPatternLoop / nPatternLoopCount rather than per channel, but that's probably outside the scope of this pull request. |
@sagamusix: OK, I applied this to my fork for now: I'm not much in my capable-of-thinking mode at the moment, so if you have further fixes |
I can confirm the patch I proposed causes problems for other mods. However, the patch proposed by sezero also causes artifacts on some other loops. I haven't looked further, but I would assume it is due to issues raised by sagamusix. |
Having a patch for that would be welcome. |
Anybody? |
In S3M files, at least, a pattern loop effect (SBn) without a preceding
start marker (SB0) repeats that single row. If a mod file has a single
row loop after a normal loop in the same pattern, this would cause an
infinite loop, since the first loop resets the later loop's counter, but
both loop to the same point.
This fixes the endless loop bug I reported on SourceForge