Need help with scripting in a rackspace with Midi Divisi

Found out how to fix this, so I thought it would be the right thing to come back and tell.

I started out with an extra scriptlet sending a NoteOn then a NoteOff for the key I wanted pressed to all 5 instances of my plugin when the rackspace was activated, like this;

on activate
SendNow(MakeNoteMessageEx(C1,50,1))
SendNow(MakeNoteMessageEx(C1,0,1)
end

This did work in a way, but the keystrokes didn’t seem to reach all the 5 instances of my plugin. It might do the job for 3 or 4 of them.

I then moved my code lines to the end of the scriptlet already there doing the Midi Divisi. I changed the code, so the code was executed 5 times, one for each midi channel. (The MIDI channel constrainers taking care of what MIDI channel comes through to each instance). The code now looked like this;

on activate
SendNow(MakeNoteMessageEx(C1,50,1))
SendNow(MakeNoteMessageEx(C1,0,1))
SendNow(MakeNoteMessageEx(C1,50,2))
SendNow(MakeNoteMessageEx(C1,0,2))
SendNow(MakeNoteMessageEx(C1,50,3))
SendNow(MakeNoteMessageEx(C1,0,3))
SendNow(MakeNoteMessageEx(C1,50,4))
SendNow(MakeNoteMessageEx(C1,0,4))
SendNow(MakeNoteMessageEx(C1,50,5))
SendNow(MakeNoteMessageEx(C1,0,5))
end

Still didn’t work. At least one instance was left unchanged by the keystrokes.

I then started to think; Could the plugin need the key to be pressed for a little longer to see the keystroke?

I found the SendLater function, and changed my code to this;

on activate
SendNow(MakeNoteMessageEx(C1,50,1))
SendLater(MakeNoteMessageEx(C1,0,1), 3000)
SendNow(MakeNoteMessageEx(C1,50,2))
SendLater(MakeNoteMessageEx(C1,0,2), 3000)
SendNow(MakeNoteMessageEx(C1,50,3))
SendLater(MakeNoteMessageEx(C1,0,3), 3000)
SendNow(MakeNoteMessageEx(C1,50,4))
SendLater(MakeNoteMessageEx(C1,0,4), 3000)
SendNow(MakeNoteMessageEx(C1,50,5))
SendLater(MakeNoteMessageEx(C1,0,5), 3000)
end

And; Voila! It worked :slight_smile:

1 Like