Copyright © 2013-2014 MultiMedia Soft

MidiDjConsole.CallbackEventSet method

Previous pageReturn to chapter overviewNext page

Remarks

 

Sets or resets the callback function that will manage the notification that an event was received from connected DJ console.

 

For further details about input events management see the How to synchronize the container application with the control tutorial.

For further details about interfacing with MIDI DJ Consoles see the MidiDjConsole object section and the How to manage MIDI DJ consoles tutorial.

 

 

Syntax

 

[Visual Basic]

control.MidiDjConsole.CallbackEventSet (

nEventType as enumDjConsoleEventType,

pCallback as Long,

nUserdata as Long

) as enumDjcErrorCodes


 

[C++]

short control.MidiDjConsole.CallbackEventSet (

short nDeviceUniqueId,

const VARIANT FAR& bRawEvent,

long pCallback,

long nUserdata

);


 

Parameter

Description

 

 

nEventType

The type of event that will generate a call to the given callback in place of the corresponding event.

Supported values are the following:

Mnemonic constant

Value

Meaning

DJC_EVENT_TYPE_UNMAPPED

0

The callback function notifies about events not mapped into the profile of the DJ console.

When the callback is set, the corresponding MidiDjConsoleEventUnmapped event is not fired.

DJC_EVENT_TYPE_BUTTON_PRESSED

1

The callback function notifies that a button mapped into the profile of the DJ console has been pressed.

When the callback is set, the corresponding MidiDjConsoleEventButtonPressed event is not fired.

DJC_EVENT_TYPE_BUTTON_RELEASED

2

The callback function notifies that a button mapped into the profile of the DJ console has been released.

When the callback is set, the corresponding MidiDjConsoleEventButtonReleased event is not fired.

DJC_EVENT_TYPE_RANGE_MOVED

3

The callback function notifies that a range control (slider, rotary know or jogwheel) mapped into the profile of the DJ console has been moved.

When the callback is set, the corresponding MidiDjConsoleEventRangeMoved event is not fired.

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 corresponding event.

Set this value to 0 in order to reset the usage of the callback function and to manage again incoming events through the corresponding event.

 

Callback functions are defined like this:

 

For DJC_EVENT_TYPE_UNMAPPED type

 

[Visual Basic]

 

Public Sub UnmappedEventCallback (

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 UnmappedEventCallback (

short nMidiCommand,

short nMidiChannel,

short nMidiData1,

short nMidiData2,

long nTimeStamp,

long nUserData

);

 

where:

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

 

For DJC_EVENT_TYPE_BUTTON_PRESSED and DJC_EVENT_TYPE_BUTTON_RELEASED types

 

[Visual Basic]

 

Public Sub ButtonEventCallback (

ByVal strControlName As String,

ByVal nControlNameLength As Long,

ByVal nTimeStamp As Long,

ByVal nUserData As Long

)

 

[Visual C++]

 

void CALLBACK ButtonEventCallback (

wchar_t *strControlName,

long nControlNameLength,

long nTimeStamp,

long nUserData

);

 

where:

strControlName

The name of the control, as assigned into the DJ console profile, on which the event occurred

nControlNameLength

The length in characters of the name

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

 

 

For DJC_EVENT_TYPE_RANGE_MOVED type

 

[Visual Basic]

 

Public Sub RangeCtrlMovedEventCallback (

ByVal strControlName As String,

ByVal nControlNameLength As Long,

ByVal nValue As Integer,

ByVal nTimeStamp As Long,

ByVal nUserData As Long

)

 

[Visual C++]

 

void CALLBACK RangeCtrlMovedEventCallback (

wchar_t *strControlName,

long nControlNameLength,

short nValue,

long nTimeStamp,

long nUserData

);

 

where:

strControlName

The name of the control, as assigned into the DJ console profile, on which the event occurred

nControlNameLength

The length in characters of the name

nValue

The current value returned by the control

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