Hi Kingpeepee, I asked the same queston a couple of months back.
This was the reply:
One question regarding sysex, I’m hoping that the panel will be able to reflect patch changes made on the 3P. Will this require extra scripting or settings to be made in the Ctrlr panel?
yes.. you will need to get familiar with getting data and assigning values to modulators (knobs, sliders, buttons, etc).. Basically what you need to do is create a program change knob (or two buttons, – and +) that send a multimessage to your synth. first message is a program change, second message is a sysex program dump request.
Then on your panel itself (just click on “blank” space on your panel) go to the properties on the far right and look for “called when the panel receives a MIDI message”.
You’ll need to create a Lua method there called something like midiMessageRecieved. You need to create some hook that determines whether the message coming in is a program dump. Best ways to do this is ether by getting the nth byte to see if it is equal to your synth’s message ID for a program dump, or get the size of the message to compare to what a program dump’s byte length is. Here’s some example code of getting the 4th byte to see if it is equal to 0×10 (0x before a number represents HEX) which in my synths’s case indicates the message is a program dump from the synth:
midiMessageReceived = function(midiMessage) --this is a comment, it is ignored by the lua interpreter --create a variable "IDM" which is the value of the 4th byte of any incoming MIDI message: IDM = midiMessage:getLuaData():getByte(4) --is the fourth byte of incoming midi message equal to 0x10? if IDM == 0x10 then --if yes, then run another method called "assignValues" assignValues(midiMessage) --this next line is just a console message that alerts you that the script has run this far. View these in the "Lua Console" console ("program change sent, standby for panel update...") end end
IF the message is a program dump from the synth, you’ll then get the bytes that contain the values for your parameters, assign them to a variable (each one) and then assign that variable as the value for each modulator on your panel.
Here’s a shortened example of my “assignValues” method:
function assignValues(midiMessage) -- create a variable that contains all bytes of program data from the synths program dump, get this info from synth's manual: programData = midiMessage:getData():getRange(7,256) -- cool, we've got everything, all we need to do now is actually assign the values to the modulators. --NOTE: use "setValueMapped" if the modulator is a combobox with custom values. --use "setModulatorValue" if the modulator is a typical modulator with a value range of, say 0-127 panel:getModulatorByName("Osc 1 Octave"):setValueMapped(programData:getByte(1), false) panel:getModulatorByName("Osc 1 Semitone"):setValueMapped(programData:getByte(2), false) panel:getModulatorByName("Osc 1 Detune"):setModulatorValue(programData:getByte(3), false, false, false) --continue for ALL parameters within your program dump.. . end