Hi! <3 I'm attempting to use the WASM version of libopenmpt to play an Impulse Tracker pattern -- and to play a second pattern "perfectly" on-time once the first one is completed. (I'm using an overlaid metadata framework, specified by a JSON, as part of an engine for game music to control this flow. I do *not* want to use the standard "Order" mechanic of the .IT file itself to schedule pattern sequences.)
I'm hoping that someone can sanity-check my proposed approach to do this for correctness, simplicity, and stability:
***
1) Pre-prepare the .IT file by setting each Order to the corresponding Pattern number (Order 000 to play Pattern 000, Order 001 to play Pattern 001, etc...). This must be done because libopenmpt can play a specific Order, but not a specific Pattern. So this just keeps things organized

2) In the code, check the "playhead position" every tick (one tick=2500ms/current tempo). (We care about keeping a current tally of the total Rows in the current Pattern, and the total Ticks in the current Row.)
3) If the playhead position is the final row AND the final tick of the current pattern, schedule the next pattern (again, the Pattern to play next is controlled by external code and not the Order of the file itself) to play on the next tick.
***
Thanks for any thoughts or guidance! This seems like the easiest approach but want to be sure I'm not missing something...
rs