Selective MIDI Override

This example is intended to be used when QLab is controlling external equipment like a lighting console, sound mixer, external effects processor, etc., and you want to selectively turn MIDI output on or off to just one of these devices. For instance, in rehearsal you might want all your MIDI-controlled audio equipment to continue responding to QLab, but stop sending cues to the lighting console.

If you want to stop all MIDI output from QLab (or input to QLab), there is a handy window in the Windows menu called MIDI/OSC Override in QLab 3 or Override Controls in QLab 4. For master control, it’s just what’s needed.

In QLab 3, it looks like this:

QLab 3 MIDI OSC Override

In QLab 4, it looks like this:

QLab 4 Overide Window

But for our purposes, these controls are too broad. What we want to do is find all cues that are sending to a specific device on a specific MIDI channel, and disarm them when we want to disable MIDI going to that specific device.

Here’s the example workspace in action:

How it works

A cue containing a variation of the following script is triggered by a hotkey.

tell application id "com.figure53.qlab.3" to tell front workspace
  --set data to find below here ----------------------
  set themessagetype to voice --types are voice/msc/sysex
  set thepatch to 3
  set thechannel to 15 -- for voice MIDI only
  set thecommand to note_on --for voice MIDI only valid commands are note_on/note_off/program_change/control_change/key_pressure/channel_pressure/pitch_bend
  set theDeviceID to 17 -- for MSC only
  set foundCues to every cue whose (message type is themessagetype and patch is thepatch and command is thecommand and channel is thechannel)

  --set data to find above here ----------------------

  set foundCuesRef to a reference to foundCues
  repeat with eachCue in foundCuesRef
    set armed of eachCue to false
  end repeat
end tell

The first thing to note is that the variables are set inside the tell block. It is often better for these to go above the tell block, however in this case they can’t. This is because in QLab 3, properties such as message type and command are set to constants, and these constants are only recognized within the QLab tell application block.

The variables are set to the required values, and then all the cues that match the required values are found. In this example, we are looking for ‘note on’ MIDI cues (whose message type is “voice”), being sent to patch 3 on MIDI channel 15.

Some of the variables listed are only required for certain types of cues. The variables that are used are those found in the statement that begins set found cues to...

In the script example above, we are looking for voice cues, so theDeviceID, which refers to a MSC device ID, is not relevant and is not included in the set found cues statement.

Here is a script where we are looking for MSC cues. Here, the MIDI channel and command are not relevant, but the device ID is and this is reflected in the statement that begins set found cues to...

tell application id "com.figure53.qlab.3" to tell front workspace
  -- set data to find below here ----------------------
  set themessagetype to msc --types are voice/msc/sysex
  set thepatch to 2
  set thechannel to 2 -- for voice MIDI only
  set thecommand to program_change --for voice MIDI only valid commands are note_on/note_off/program_change/control_change/key_pressure/?hannel_pressure/pitch_bend
  set theDeviceID to 17 -- for MSConly
  set foundCues to every cue whose (message type is themessagetype and patch is thepatch and deviceID is theDeviceID)
  -- set data to find above here ----------------------

  set foundCuesRef to a reference to foundCues
  repeat with eachCue in foundCuesRef
    set armed of eachCue to false
  end repeat
end tell

In both of these scripts, every found cue has its armed property set to false, this disarming the cues. In the scripts which re-enable MIDI output, the armed of each cue is set to true.