I am attempting to create a loop that will output a fixed message J1 times. My input in the following example is CC 7 16 J1 where J1 is a variable from 1 to 10. The loop works fine if I use literals for J0 and J1. But when I use M2 for J1, the loop never works. What I think is happening, if I try to use J1 created from ASS J1 = M2, it appears it is 0 when entering the loop, not the value for J1 as received which is verified by a SND with J1.
This is in MidiDesigner Pro Output Rules. I use Midi Monitor to check the behavior. jkhiser pointed out B6 0F is not CC 7 16. But I get the correct SND response for J1 after the IF M0. So the IF M0 is being accepted. I need to double check what message I am sending. Actually I am sending three at once, 7 16, 7 17, and 7 18. Each may have a different Midi value from 1 to 9 which is what I am trying to use in the loop.
I did try this in MidiFire earlier this morning and it worked fine. If the first example works and the second example does not, then I don't think it's an issue with the MDP version of StreamByter, which is a little older than the current MidiFire version. It should be able to do loops just fine.
Although it should not make any difference, you could just use M2 directly in the loop conditional. This code (with all comments removed):
IF M0 == B6 0F ASS J0 = 0 SND B5 J0 M2 IF J0 < M2 +L SND B8 01 J0 MAT J0 = J0 + 1 END END
Thanks for your response. In my layout, the first line should be IF M0 == B6 10, then the loop will work. I believe your code will work. Being new to Stream Byter, I wasn't sure how I could use the M0, M1, etc. as variables. That will simplify my code.