Copyright © 2005-2019 MultiMedia Soft

MIDI.InputDevicesStart method

Previous pageReturn to chapter overviewNext page

Remarks

 

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 MIDIMan class section and the How to deal with MIDI protocol tutorial.

 

 

Syntax

 

[Visual Basic]

Public Function InputDevicesStart (

nDeviceIndex as Int32,

pCallback as MidiCallbackFunction,

nUserData as Int32

) as enumErrorCodes


 

[C#]

public enumErrorCodes InputDevicesStart (

Int32 nDeviceIndex,

MidiCallbackFunction pCallback,

Int32 nUserData

);


 

[C++]

public: enumErrorCodes InputDevicesStart (

Int32 nDeviceIndex,

MidiCallbackFunction pCallback,

Int32 nUserData

);


 

 

 

Parameter

Description

 

 

nDeviceIndex

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.

pCallback

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 IntPtr,

ByVal bufferLength As Int32,

ByVal nUserData As Int32

)

 

[Visual C#]

 

void MyMidiCallback (

IntPtr bufferRawEvents,

Int32 bufferLength,

Int32 nUserData

);

 

Visual C++]

 

void MyMidiCallback (

IntPtr bufferRawEvents,

Int32 bufferLength,

Int32 nUserData

);

 

where

bufferRawEvents

Pointer to the buffer containing raw MIDI events:

bufferLength

The length in bytes of the buffer above

nUserData

User specific data

nUserData

User data to pass to the callback

 

 

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.