So, back to that first path…
We’re splitting this path further, into 15 blocks now. 1 for each channel. They’ll merge back in a minute, but we need to track each channel separately. So, let’s look at one block.
Within each block, we’re going to need note data and pitch bend. I filtered out everything else.)
There’s a gate. It’s either open or closed, and when it’s closed, nothing can get through it. Pitch bend is sent through that gate, because pitch bend is always the first bit of data received.
But before it reaches the gate, a bit of logic happens. Each bend message triggers two events, in a specific order. First, they try to send through the gate. Then, they close the gate, if the gate was open. So only the first message goes through.
The gate is initially open, or the first note wouldn’t work. Once triggered, it’s almost always closed. The one thing that re-opens it is a note off message on this channel…
So, when a pad is pressed, the first message received goes through that gate, and nothing else does until that note is released. When another message goes through, we know it’s a new press.
Good so far?
When a message passes through the gate, it triggers the channel number that this block represents to be output from that block.
So, each time you press a pad on channel 3, you get a “3” out of the “3” block, and nothing out of the other blocks.
(When that works, clone out all that code to make your other blocks. The only thing that should change from one instance to the next is what channel you’re filtering down to, and which number is output at the end.)
So, that’s the overall timing.
Beneath those blocks, you receive the channel number from each press, and those numbers trigger two events, in this order:
First, increment a counter, and make note of its output.
Second, pair your channel number with the newly received output of your counter, and put those in the list.
For the example above, we know the press was received on channel 2, and the counter tells us our next round robin channel is 7, so we add “2, 7” to our list.
And that’s it.