Copyright © 2005-2019 MultiMedia Soft

CallbackForMidiKeyboardEvents delegate

Previous pageReturn to chapter overviewNext page

Remarks

 

Callback delegate invoked when one of the keys on the virtual piano keyboard, previously created through the MIDI.KeyboardCreate method, is pressed or released: this callback can be set through a call to the CallbackForMidiKeyboardEventsSet method.

 

The usage of this delegate is alternative to the MidiKeyboardNotification event.

 

For further details about callback delegates see the How to synchronize the container application through callback delegates tutorial.

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 Delegate Sub CallbackForMidiKeyboardEvents (

ByVal hWndKeyboard as IntPtr,

ByVal nNote as Int16,

ByVal bPressed as Boolean,

ByVal bSimulated as Boolean

)


 

[C#]

public delegate void CallbackForMidiKeyboardEvents (

IntPtr hWndKeyboard,

Int16 nNote,

bool bPressed,

bool bSimulated

)


 

[C++]

public delegate void CallbackForMidiKeyboardEvents (

IntPtr hWndKeyboard,

Int16 nNote,

bool bPressed,

bool bSimulated

)


 

 

Parameter

Description

 

 

hWndKeyboard

Handle of the virtual keyboard as returned by the call to the MIDI.KeyboardCreate method

nNote

Note played through pressure of one of the keys of the virtual piano keyboard. Can be a key number from 0 to 127; 60 means middle C

bPressed

Boolean flag that specifies if the key was pressed or released.

Supported values are the following:

Value

Meaning

false

The key was released

true

The key was pressed

bSimulated

Boolean flag that specifies if the key pressure is simulated. When the key pressure is simulated, the key appears pressed on the piano keyboard but no real event is generated on the MIDI stream in playback, allowing to display a note played through an external physical MIDI keyboard attached to one of the MIDI input channels.

Supported values are the following:

Value

Meaning

false

The note was played on the MIDI stream in playback

true

The note was not played on the MIDI stream in playback but the corresponding key was rendered as pressed on the piano keyboard.