I'm trying to replace a transform object in the environment that's used to recall patches in Composer Tools Pro on my iPad for articulation switching. It's a simple transform object that listens for CC 119( coming from CTPro on the iPad), and converts it to a user specified program change number and channel number. The transformer than filters all other information out and sends the program change and channel out to a specified Lemur port via another midi instrument in the environment. The program change number and channel number is the unique ID that Composer Tools Pro uses to identify which patch to recall.
If my explanation is confusing, here's a youtube example of the setup:
[youtube] https://www.youtube.com/watch?v=-c4q8hko380 [/youtube]
So, I know next to nothing about java scripting, but I can't use environment objects because of my workflow. I've moved away from using one huge template pre setup with these environment objects, and instead populate each project with channel strip presets and track stack patches as I go. The problem is those saved channel strips and patches don't bring along their attached environment objects though. But if I had a script that did the same thing, it would always travel with the instrument preset...e.g. Spitfire Violin 1 or whatever.
But I've failed to get anywhere cobbling together code from various examples. Here's what I've got so far.
/*Script that transforms control change 119 into a program change
with user definable channel number and program change number and filter all other midi events
var PluginParameters = [
if(recall instanceof ControlChange && recall.number == 119)
var p = new ProgramChange; //generates program change message and saves as "p"
var prog = GetParameter("Program #") //retrieves program number from user input and saves to "prog"
var chan = GetParameter("Channel") //retrieves channel number from user input and saves to "chan"
p.channel = chan //sets program change to "prog"
p.number = prog //sets program change channel to "chan"
recall.trace(); //filters out all other midi messages
p.send(); //sends out only channel and program change #
Did I mention I don't know what I'm doing? Anybody got helpful hints? So far, the script is just spitting out what I send it...CC 119.
It would also be GREAT if I could specify what port to send out the program change to, but as far as I can tell, that's not a capability? That would also help me to avoid having to cable each instrument to the instrument object that's pointing to the Lemur output port.