Tell SWF Studio about a MIDI event notification that you'd like to receive.
First available in version 3.2 build 136.
event - The name of the event notification you want enabled. Valid values include: onRawData.
result - Notification data for the specified event (see description of events for more detail).
When this method is called synchronously, a return object containing the output parameters is returned to the caller immediately.
MIDI events are triggered by messages received from the MIDI device, typically as a result of user interaction. Often, devices may also send "Active Sensing" messages every 300 milliseconds of so, to notify the system that they are still connected and active.
Notification data is returned as a string of comma separated values. In the listings below, the field names have the following meanings:
- id a MIDI device id from MIDI.getInfo
- msec the time, in milliseconds, at which the message was received by the MIDI driver. The clock for a channel is started at 0 when MIDI.start is called.
- cmd the command received. The interpretation of this value is defined by the MIDI standard as either being a Channel Message or a System Message.
- value1 the first data value in the message. The interpretation of this value varies depending on the value of the cmd.
- value2 the second data value in the message. The interpretation of this value varies depending on the value of the cmd.
To cancel notifications about an event, use MIDI.clearNotify.
MIDI.setNotify may be called before MIDI.start if you wish to define the required event notifications before starting the notification system. Also, there is no need to temporarily stop the notification system before making changes to registered events.
name - onRawData
type - triggered
result - "RAW_DATA,id,msec,cmd,value1,value2"
The onRawData event is triggered by the MIDI device, usually as a result of user interaction. The interpretation of the cmd, value1, and value2 are defined in the MIDI standard, available at www.midi.org.
function onRawDataReceived(ret_obj, cb_obj, err_obj)
var v = ret_obj.result.split(",");
ssDebug.trace("MIDI command received:");
ssDebug.trace(" device id: " + v);
ssDebug.trace(" time offset: " + v + " milliseconds");
ssDebug.trace(" command: " + v);
ssDebug.trace(" value 1: " + v);
ssDebug.trace(" value 2: " + v);