|
Post by djsorgan on Sept 1, 2020 20:12:16 GMT
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. The following loop works fine:ASS J0 = 0
ASS J4 = 5
IF J0 < J4 +L
SND B8 01 J0 # 7 1 J0 # outputs 9 1 0, 9 1 1, .... 9 1 4 MAT J0 = J0 + 1
END The following does not:IF M0 == B6 0F # CC 7 16 # CC 7 16 J1, where J1 varies between 1 and 10 ASS J0 = 0 # initialize J0 ASS J1 = M2 # Hundreds digit SND B5 00 J1 # used for verification test - outputs 6 0 J1 -- J1 is output correctly IF J0 < J1 +L # loop to be repeated J1 times, but does not start (no output generated) SND B8 01 J0 # 7 1 J0 # used for verification test MAT J0 = J0 + 1 END END
For example, given an input CC 7 16 4
I want the output to be:
- 7 16 4 #this is the input that I may block later
- 9 1 0
- 9 1 1
- 9 1 2
- 9 1 3
The CC 9 1 is never generated.
Is this a problem using a value in a midi msg as a literal or am I missing something?
|
|
nic
Soapbox Supremo
Troublemaker
Press any key to continue
Posts: 2,011
|
Post by nic on Sept 2, 2020 8:06:36 GMT
Hi djsorgan , Which StreamByter is this? MidiFire, StreamByterAU or Midi Designer? The code looks right, but I will try it in which ever of the above you are seeing this in. Regards, Nic.
|
|
|
Post by djsorg2062 on Sept 2, 2020 16:43:18 GMT
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.
|
|
nic
Soapbox Supremo
Troublemaker
Press any key to continue
Posts: 2,011
|
Post by nic on Sept 2, 2020 17:09:31 GMT
Hi djsorgan , 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 ENDCopy/paste the above. Does that work? Regards, Nic.
|
|
|
Post by djsorgan on Sept 2, 2020 23:16:20 GMT
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.
|
|