checking if an order has been played twice is not the way to detect the end of song, but might work for most songs.
There are other songs that jump into the top half of an order, then jump out, and later jump into the bottom half, then jump out.
backwards.s3m/backwards.mod and ode2ptk jump in and out of a single order 64 times in a song.
So those special mods are pretty cool to look at in an editor, they those features typically aren’t used in such bizare ways.
There’s no need for, and not all players handle this 100% right (fmod does so far).
But it’s right, such a song would be interpreted as beeing looping.
mods are designed to loop forever, a musician may have even put a pattern jump in there to go back to the start before it ends.
Only FMOD Ex can play it once, with FMOD_ACCURATETIME flag which makes it play the file once internally very fast to find out where the point is it jumps back at, and marks that as the end. Only then can you use FMOD_LOOP_OFF flag to stop it.
You can check if the current order has already been played before… this way you can detect loops, except the pattern / order jumps to itself each…
Still better way is to also check the time to allow the mod to play at least 2/3 minutes anyway, then (if if reuses an already played pattern/order) fade out and end it
Please login first to submit.