Copyright © 2013-2015 MultiMedia Soft

MidiDevices.InputEventCallbackSet method

Previous pageReturn to chapter overviewNext page

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:

Mnemonic constant

Value

Meaning

BOOL_FALSE

0

The callback function manages short MIDI events

BOOL_TRUE

1

The callback function manages raw MIDI events

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:

nDeviceUniqueId

The unique identifier of the MIDI input device which generated the event as returned by a previous call to the MidiDevices.Open method

nMidiCommand

Number representing the MIDI command

nMidiChannel

Number representing the MIDI channel

nMidiData1

Number representing the first parameter (Data1) related to the MIDI event

nMidiData2

Number representing the second parameter (Data2) related to the MIDI event

nTimeStamp

The time stamp of the event expressed in milliseconds elapsed from the moment in which the MIDI input device of the DJ Console was opened through a call to the MidiDevices.Open method.

nUserData

User instance data to pass to the callback function

 

 

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:

nDeviceUniqueId

The unique identifier of the MIDI input device which generated the event as returned by a previous call to the MidiDevices.Open method

nBufferLenght

Length of the buffer expressed in bytes

nTimeStamp

The time stamp of the event expressed in milliseconds elapsed from the moment in which the MIDI input device of the DJ Console was opened through a call to the MidiDevices.Open method.

nUserData

User instance data to pass to the callback function

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