Hit a bit of a road block with a script, hoping I can get some assistance. To simplify the explanation I have a MIDI controller with a knob and a fader.
The fader is mapped to a MIDI Out block and initially I have it mapped to the parameter CC1. I move the fader and values are sent out the MIDI block on CC1. No problem there.
I want to write a script where the knob changes which CC the fader sends on. I have the knob assigned to a widget and I have the given the widget a GPScript Name in the Advanced tab.
I was planning to use the MapWidgetToPlugin function, but I get the error saying there is no plugin with the name of the MIDI Out block. Clearly, the MIDI Out block is not a plugin.
I searched through the functions in the manual hoping to find something like MapWidgetToMidiOutBlock, etc, but I can’t find anything. Is the only option to use the SendNowExternal function? I’m intimidated by how to write a midiMessage I guess.
You need to define a handle for the widget and for the plugin. The MIDI out block IS a plugin.
But in my opinion, it would be much better to use a Scriptlet with two parameters assigned to widgets and controller by your controller: a CC# parameter and a CC value parameter. This Scriptlet output would then simply fed into the MIDI out block.
var
CC_Channel_Selector : Subrange Parameter 0..127 = 0 //Assign a widget for selecting the CC # to this parameter
CC_Value : Subrange Parameter 0..127 = 0 // Assign a widget for sending the CC value to this parameter
On ParameterValueChanged matching CC_Value
SendNow(MakeControlChangeMessage (CC_Channel_Selector, CC_Value))
End