MIDI.TriggerAdd method |
|
Remarks
Adds a trigger to the given player at a certain position of the loaded MIDI stream: when the trigger is reached, the CallbackForPlayersEvents delegate is invoked with the nEvent parameter set to EV_TRIGGER_REACHED and you will be able to discriminate the specific trigger through its nData1 parameter: this parameter will match exactly the unique identification number assigned to the trigger.
Triggers positioning is always referred to the original sound duration, meaning that it won't keep count of eventual tempo and/or playback rate changes and will always refer to the position of the song as it should be played at its original speed.
This method is mostly identical to the basic TriggerAdd method but allows specifying the position in MIDI ticks also and can only be used with MIDI streams.
For further details about the use of MIDI protocol see the MIDIMan class section and the How to deal with MIDI protocol tutorial.
Syntax
[Visual Basic] Public Function TriggerAdd ( nPlayerIndex as Int16, nTriggerID as Int16, fPosition as Double, nPositionUnit as enumMidiPositionUnits ) as enumErrorCodes |
[C#] public enumErrorCodes TriggerAdd ( Int16 nPlayerIndex, Int16 nTriggerID, double fPosition, enumMidiPositionUnits nPositionUnit ); |
[C++] public: enumErrorCodes TriggerAdd ( Int16 nPlayerIndex, Int16 nTriggerID, double fPosition, enumMidiPositionUnits nPositionUnit ); |
Parameter |
Description |
||||||||||||
|
|
||||||||||||
nPlayerIndex |
Number representing the zero-based index of the involved player |
||||||||||||
nTriggerID |
Number representing the identifier of the new trigger. If this identifier should be already assigned to another trigger, an error code would be returned. |
||||||||||||
fPosition |
Number representing the position of the trigger; its value depends upon the value of the nPositionUnit parameter below. |
||||||||||||
nPositionUnit |
The unit of measure used for the position value stored inside fPosition parameter above. Supported values are the following:
|
Return value
Value |
Meaning |
|
|
Negative value |
An error occurred (see the LastError property for further error details) |
enumErrorCodes.NOERROR (0) |
The method call was successful. |