View Issue Details

IDProjectCategoryView StatusLast Update
0000959OpenMPT[All Projects] Playback Compatibilitypublic2019-05-27 07:52
ReporterYarn366Assigned ToSaga Musix 
PrioritynormalSeverityminorReproducibilityalways
Status assignedResolutionopen 
Platformx64OSWindowsOS Version7
Product VersionOpenMPT 1.27.00.* (old testing) 
Target VersionFixed in Version 
Summary0000959: Incorrect handling of simultaneous pattern loop and position jump/pattern break/pattern delay commands
Description

In certain cases where a non-zero pattern loop occurs at the same time as a position jump, pattern break, or pattern delay, OpenMPT performs the wrong action. Here's how the original trackers handle these situations, and how OpenMPT compares (as far as I can tell):

MOD:
PT 2.3d: Loop is not executed, but on every row repetition, the loop counter is started if it's clear (even in the middle of a pattern delay) and is then decremented (I'm pretty sure that's how loop counters work; correct me if I'm wrong). If no pattern delay is present, Bxx/Dxx commands are followed as usual, except the parameter of Dxx is ignored; otherwise, Bxx is followed, and the cursor is then placed one row after the loop start if the loop counter is clear, and at the loop start otherwise. However, if the row has a pattern delay and a Dxx command but no Bxx command and the loop counter clears as the row finishes, then the cursor may or may not instead be placed at the second row of the next order.
OMPT r8219: Loop is executed, and the loop counter is started/decremented once per loop-end encounter, not every row repetition. Upon completion, Bxx/Dxx commands are followed as usual.

S3M:
ST 3.21: If no pattern delay is present, then ST 3.21 seems to handle this scenario just as OpenMPT does. I haven't quite worked out what happens when a pattern delay is present, but I can tell you that the behavior is strange and isn't what OpenMPT does.
OMPT r8219: On every row repetition, the loop counter is started if it's clear (even in the middle of a pattern delay) and is then decremented. If the loop counter isn't cleared on that row, then the loop continues; otherwise, if the loop counter clears as the row finishes, Bxx/Cxx commands are followed as usual if they're present, and if not, then the loop plays once more and the loop counter does not restart upon loop end; otherwise, Bxx/Cxx commands are ignored and playback continues past the loop and skips the next row.

Also, when IT 2.14p5 plays an S3M file, it seems to handle these situations as it does when playing IT files.

XM:
FT 2.08/2.09: Loop is not executed, but the loop counter is started/decremented once per loop-end encounter, not every row repetition. Bxx commands and Dxx commands to the right of the loop are followed as usual, but if none are to the right of the loop, the cursor is then placed at the start of the loop in the target order.
OMPT r8219: Same, except if the row has Bxx commands but no Dxx commands, the Bxx commands are followed as usual, even if no Bxx commands are to the right of the loop.

In addition, and maybe a bit off-topic, if FT 2.08/2.09 encounters a Bxx/Dxx command at the same time as a non-zero pattern delay, regardless of whether a pattern loop is present, it always skips the next row that would otherwise be played, just as PT 2.3d usually does with Dxx commands. OMPT r8219 does not do this.

IT:
IT 2.14p5: Loop counter is started if it's clear, and is then decremented on every row repetition. If any Bxx commands are to the right of the loop, follow Bxx/Cxx commands as usual without starting the loop; otherwise, the loop continues if the loop counter isn't clear yet. If a non-zero pattern delay is present, then if the counter clears as the delay finishes, Bxx commands are followed if they're present and Cxx commands are ignored, and the loop starts again (usually resulting in an infinite loop) if no Bxx commands are present; otherwise, if the counter clears before the delay finishes, Bxx/Cxx commands are ignored and playback continues past the loop. (I really wish I could use markup here to format this better.)
OMPT r8219: Same, except any Bxx commands, even those to the left of the loop, prevent the loop from starting; if the loop counter clears as the pattern delay finishes, Cxx commands are followed if present, and if Cxx commands are not present then the loop plays once more and the loop counter does not restart upon loop end; and if a pattern delay is present and either the loop continues or playback continues past the loop, the next row is skipped.

For all formats here, fine pattern delays don't seem to have an effect on which rows get played and in what order; only regular pattern delays do.

Additional Information

I have attached three tests, one for each format. In PatLoop-Various.mod and PatLoop-Various2.xm, you should hear a few seconds of near-silence, followed by the word "success". In LoopBreak2.it, both the left and right channels should sound about the same.

XMPlay 3.8.2.3 passes all three tests.

None of the tests mentioned above test situations in which a pattern delay is encountered; I'll upload tests for those later.

TagsNo tags attached.
Has the bug occurred in previous versions?Yes
Tested code revision (in case you know it)r8215

Relationships

related to 0001146 new Handle infinite loops 

Activities

Yarn366

Yarn366

2017-05-26 02:10

reporter  

LoopBreakTests.7z (13,724 bytes)
Yarn366

Yarn366

2017-05-27 01:43

reporter   ~0003037

I decided to see what happens when a pattern delay occurs at the same time as both a non-zero pattern loop and a position jump or pattern break. In doing so, I found some more playback differences:

(In all scenarios here, if the pattern delay's parameter is 0, then playback continues as though the pattern delay weren't present. Also, if the pattern delay's parameter is not 0, then it is always executed whenever it is encountered.)

MOD:
PT 2.3d: Loop is not executed. Cursor jumps to loop start in the target order.
OMPT r8219: Same as if the pattern delay weren't present, except the delay is executed.

S3M:
ST 3.21: Loop is not executed. Bxx/Cxx commands are followed as usual, except if any Cxx but no Bxx commands are present, then something...strange happens: up to five orders are skipped (depending on the parameter of the pattern delay), and playback continues from the beginning of the resulting order, ignoring the Cxx parameters. (Not sure how easy this is to implement...)
OMPT r8219: Loop is not executed. Bxx/Cxx commands are not followed, and the next row is skipped.

(Also, when IT 2.14p5 plays an S3M file, it handles pattern loop+position jump/pattern break situations as it does when playing IT files, whether or not a pattern delay is present.)

XM:
FT 2.08/2.09 and OMPT r8219: Same as if the pattern delay weren't present, except the delay is executed.
In addition, and maybe a bit off-topic, if FT 2.08/2.09 encounters a Bxx/Dxx command at the same time as a non-zero pattern delay, regardless of whether a pattern loop is present, it always skips the next row that would otherwise be played, just as PT 2.3d usually does. OMPT r8219 does not do this.

IT:
IT 2.14p5: If the loop were to be executed had the pattern delay not been present, the loop is not executed and the Bxx/Dxx commands are ignored. Otherwise, playback continues as though the pattern delay weren't present, except it is executed.
OMPT r8219: Same, except if the Bxx/Cxx commands aren't followed, then the next row is skipped.

I will upload test cases later.

Yarn366

Yarn366

2017-05-27 07:40

reporter   ~0003038

I forgot to mention this in the previous note: When PT 2.3d encounters a row with simultaneous E6x, Dxx, and EEx commands, it does not skip a row as it normally would if the E6x command weren't present.

Yarn366

Yarn366

2017-05-29 20:17

reporter   ~0003041

I had some of the routines wrong; I have updated the report with what I think are the correct ones. Please disregard my previous two comments.

Yarn366

Yarn366

2017-06-06 02:15

reporter   ~0003048

I've attached another XM test, which tests behavior of simultaneous Bxx/Dxx and EEx commands, both with and without pattern loops. The deal here is the same as before: after a few seconds, you should hear the word "success" but not the word "fail." (As you might expect, XMPlay 3.8.2.3 passes this test.)

I found another quirk in ProTracker 2.3d's playback routine: under certain conditions, if Dxx, E6x, and EEx commands occur together and the loop ends just as the row ends, playback jumps to the second row of the next pattern rather than the second row of the loop in that pattern. I don't know yet what exactly causes this, but it doesn't seem to be random.



FT2-PatLoopWithDelay.7z (8,690 bytes)
Yarn366

Yarn366

2017-06-11 03:06

reporter   ~0003069

Here's a test for the infinite loop behavior that occurs in Impulse Tracker when a row has a pattern loop and a non-zero pattern delay and no Bxx/Cxx commands, and the loop counter finishes just as the delay finishes (not before or after). You should hear "1 2 3" followed by "2 3" repeated forever. (XMPlay 3.8.2.3 fails this test.)



InfiniteLoop.7z (14,711 bytes)
Yarn366

Yarn366

2017-06-11 03:33

reporter   ~0003070

Another IT test. This one is a bit like the one above, except the loop counter finishes before or after the delay finishes. It's designed to test for OpenMPT's incorrect behavior of skipping a row in these cases. You should hear "1 2, 1 2, 3 4" followed by "1 2, (brief pause) 3 4". (XMPlay 3.8.2.3 would pass this test if it had decremented the loop counter on every row repetition instead of just once.)



PatLoopWithDelay-IT.7z (14,730 bytes)
DevanWolf

DevanWolf

2019-05-27 06:48

reporter   ~0003953

The infinite loop bug in MOD (with E6x + EEx) occurs as well.
Also wrote simple test MOD for E6x + EEx. OpenMPT already fails, XMPlay fails (but success on the S3M version using SBx + SEx), and XMP should be success.



PatLoopAndDelay+InfiniteLoop.zip (12,472 bytes)

Issue History

Date Modified Username Field Change
2017-05-26 02:10 Yarn366 New Issue
2017-05-26 02:10 Yarn366 File Added: LoopBreakTests.7z
2017-05-27 01:43 Yarn366 Note Added: 0003037
2017-05-27 07:40 Yarn366 Note Added: 0003038
2017-05-29 16:42 Saga Musix Assigned To => Saga Musix
2017-05-29 16:42 Saga Musix Status new => assigned
2017-05-29 20:17 Yarn366 Summary MOD/XM/IT: Incorrect handling of simultaneous pattern loop and position jump/pattern break commands => Incorrect handling of simultaneous pattern loop and position jump/pattern break/pattern delay commands
2017-05-29 20:17 Yarn366 Description Updated View Revisions
2017-05-29 20:17 Yarn366 Additional Information Updated View Revisions
2017-05-29 20:17 Yarn366 Note Added: 0003041
2017-05-29 20:17 Yarn366 Description Updated View Revisions
2017-06-06 02:15 Yarn366 File Added: FT2-PatLoopWithDelay.7z
2017-06-06 02:15 Yarn366 Note Added: 0003048
2017-06-06 02:19 Yarn366 Description Updated View Revisions
2017-06-11 02:27 Yarn366 Description Updated View Revisions
2017-06-11 03:06 Yarn366 File Added: InfiniteLoop.7z
2017-06-11 03:06 Yarn366 Note Added: 0003069
2017-06-11 03:33 Yarn366 File Added: PatLoopWithDelay-IT.7z
2017-06-11 03:33 Yarn366 Note Added: 0003070
2019-05-27 06:48 DevanWolf File Added: PatLoopAndDelay+InfiniteLoop.zip
2019-05-27 06:48 DevanWolf Note Added: 0003953
2019-05-27 06:54 manx Relationship added related to 0001146