Copyright © 2001-2018 MultiMedia Soft

MIDI.InputDevicesStart method

Previous pageReturn to chapter overviewNext page



After having enumerated, through a call to the MIDI.InputDevicesEnum method, the list of available MIDI input devices installed inside the system, starts a MIDI input device and sets a callback for receiving raw MIDI events from the MIDI input channel.

If incoming MIDI events should be sent and played directly through a player instanced by the control, it would be recommended using the MIDI.InputDevicesStartOnPlayer method.


For further details about the use of MIDI protocol see the MIDI object section and the How to deal with MIDI protocol tutorial.





[Visual Basic]

control.MIDI.InputDevicesStart (

nDeviceIndex as Integer,

pCallback as Long,

nUserData as Long

) as enumErrorCodes



short control.MIDI.InputDevicesStart (

short nDeviceIndex,

long pCallback,

long nUserData








Number representing the zero-based index of the MIDI input device. The number of available MIDI input devices installed inside the system can be obtained directly to the MIDI.InputDevicesEnum method or, after having performed the enumeration, through the MIDI.InputDevicesCountGet method.


Pointer to the callback function that will receive raw MIDI events from the MIDI input channel. Remember that callback functions must be as fast as possible in order to avoid slowing down overall performances.

A callback function is defined like this:


[Visual Basic ]


Public Sub MyMidiCallback(

ByVal bufferRawEvents As Long,

ByVal bufferLength As Long,

ByVal nUserData As Long



[Visual C++]


void MyMidiCallback (

void *bufferRawEvents,

DWORD bufferLength,

DWORD nUserData





Pointer to the buffer containing raw MIDI events:


The length in bytes of the buffer above


User specific data


User data to pass to the callback




Return value






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