MidiDevices.InputEventCallbackSet method |
![]() ![]() ![]() |
Remarks
Sets or resets the callback function that will manage the notification that a MIDI event was received from the given MIDI input device.
For further details about input events management see the How to synchronize the container application with the control tutorial.
For further details about the use of MIDI devices see the MidiDevices object section and the How to manage MIDI devices tutorial.
Syntax
[Visual Basic] control.MidiDevices.InputEventCallbackSet ( nDeviceUniqueId as Integer, bRawEvent as enumBoolean, pCallback as Long, nUserdata as Long ) as enumDjcErrorCodes |
[C++] short control.MidiDevices.InputEventCallbackSet ( short nDeviceUniqueId, const VARIANT FAR& bRawEvent, long pCallback, long nUserdata ); |
Parameter |
Description |
||||||||||||||||||||||
|
|
||||||||||||||||||||||
nDeviceUniqueId |
The unique identifier of the MIDI input device returned by a previous call to the MidiDevices.Open method |
||||||||||||||||||||||
bRawEvent |
Boolean value that specifies if the callback function is related to a short or raw MIDI event. Supported values are the following:
|
||||||||||||||||||||||
pCallback |
Pointer to the callback function containing the code that will manage the event. When the callback function is set, the control will not fire the MidiDevicesEventReceived event. Set this value to 0 in order to reset the usage of the callback function and to manage again incoming events through the MidiDevicesEventReceived event.
A callback function for short MIDI events is defined like this:
[Visual Basic]
Public Sub MidiInputShortEventsCallback ( ByVal nDeviceUniqueId As Integer, ByVal nMidiCommand As Integer, ByVal nMidiChannel As Integer, ByVal nMidiData1 As Integer, ByVal nMidiData2 As Integer, ByVal nTimeStamp As Long, ByVal nUserData As Long )
[Visual C++]
void CALLBACK MidiInputShortEventsCallback ( short nDeviceUniqueId, short nMidiCommand, short nMidiChannel, short nMidiData1, short nMidiData2, long nTimeStamp, long nUserData );
where:
A callback function for raw MIDI events is defined like this:
[Visual Basic]
Public Sub MidiInputRawEventsCallback ( ByVal nDeviceUniqueId As Integer, ByVal pBuffer As Long, ByVal nBufferLenght As Long, ByVal nTimeStamp As Long, ByVal nUserData As Long )
[Visual C++]
void CALLBACK MidiInputRawEventsCallback ( short nDeviceUniqueId, void *pBuffer, long nBufferLenght, long nTimeStamp, long nUserData );
where:
|
||||||||||||||||||||||
nUserdata |
User instance data to pass to the callback function |
Return value
Value |
Meaning |
|
|
Negative value |
An error occurred, check the LastError property value in order to get the error code |
enumErrorCodes.ERR_NOERROR (0) |
The method call was successful |