General
scripting questions: MIDI_ARGS
Started by musicman on .
Sign in or create an account to join the conversation.
Hi guys, I"m new to Lemur and am really loving the possibilities. The one thing I ran into is that there is no Pro Tools support, so I'm taking a crack at doing some basic PT control. I have fader moves and mutes working from Lemur to PT, and now I'm working on receiving data from PT. I can't find any documentation on how MIDI_ARGS work though.
All my data from PT comes in the form of two controller messages per command. So for example, mute light indicator is:
0xB0,0x0C,0x00
0xB0,0x2C,0x42
I've set up a script with execution set to ( On MIDI : B0 : Midi 1 : 0-127 : 1-1 )
But I don't understand the data structure so I'm not sure where to go next. From my forum searches it sounds like MIDI_ARGS is an array but I can't seem to get it working. I've tried the following:
decl mutebyte1 = MIDI_ARGS[12];
decl mutebyte2 = MIDI_ARGS[44];
if (mutebyte1 = 0x00 && mutebyte2 == 0x42) x = 1;
if (mutebyte1 = 0x00 && mutebyte2 == 0x02) x = 0;
and also
decl mutebyte1 = MIDI_ARGS[0x0C];
decl mutebyte2 = MIDI_ARGS[0x2C];
if (mutebyte1 = 0x00 && mutebyte2 == 0x42) x = 1;
if (mutebyte1 = 0x00 && mutebyte2 == 0x02) x = 0;
But no luck. I also tried sending the MIDI_ARGS to the monitor object so I could try to see what the data stream was but I couldn't get that happening either. Any help would be appreciated!
All my data from PT comes in the form of two controller messages per command. So for example, mute light indicator is:
0xB0,0x0C,0x00
0xB0,0x2C,0x42
I've set up a script with execution set to ( On MIDI : B0 : Midi 1 : 0-127 : 1-1 )
But I don't understand the data structure so I'm not sure where to go next. From my forum searches it sounds like MIDI_ARGS is an array but I can't seem to get it working. I've tried the following:
decl mutebyte1 = MIDI_ARGS[12];
decl mutebyte2 = MIDI_ARGS[44];
if (mutebyte1 = 0x00 && mutebyte2 == 0x42) x = 1;
if (mutebyte1 = 0x00 && mutebyte2 == 0x02) x = 0;
and also
decl mutebyte1 = MIDI_ARGS[0x0C];
decl mutebyte2 = MIDI_ARGS[0x2C];
if (mutebyte1 = 0x00 && mutebyte2 == 0x42) x = 1;
if (mutebyte1 = 0x00 && mutebyte2 == 0x02) x = 0;
But no luck. I also tried sending the MIDI_ARGS to the monitor object so I could try to see what the data stream was but I couldn't get that happening either. Any help would be appreciated!
One more question...how can I differentiate between a local expression change of x and a remote change of x so I don't get a feedback loop?
Never mind I seem to have figured it out 
I found that if you only look at one controller at a time in "On Expression", MIDI_ARGS[0] is controller # and MIDI_ARGS[1] is the data byte.
And I got the feedback loop killed. Here's my code in case someone else is searching for a solution later:
decl remote_status;
if (byte1 == 0x00 && byte2 == 0x42) remote_status = 1;
else if (byte1 == 0x00 && byte2 == 0x02) remote_status = 0;
else remote_status == -1;
if (x != remote_status)
{
ctlout(1,0x0F,0x00,1);
ctlout(1,0x2F,0x42,1);
}
I found that if you only look at one controller at a time in "On Expression", MIDI_ARGS[0] is controller # and MIDI_ARGS[1] is the data byte.
And I got the feedback loop killed. Here's my code in case someone else is searching for a solution later:
decl remote_status;
if (byte1 == 0x00 && byte2 == 0x42) remote_status = 1;
else if (byte1 == 0x00 && byte2 == 0x02) remote_status = 0;
else remote_status == -1;
if (x != remote_status)
{
ctlout(1,0x0F,0x00,1);
ctlout(1,0x2F,0x42,1);
}