Copyright © 2005-2019 MultiMedia Soft

MIDI.KeyboardNote method

Previous pageReturn to chapter overviewNext page

Remarks

 

Acts on the key corresponding to the given note on the virtual piano keyboard. The key pressure can be real, e.g. generating a note on the MIDI stream, or simulated: in this latest case the key on the keyboard results to be pressed but no sound is generated.

 

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

hWndKeyboard as IntPtr,

nNote as Int32,

nVelocity as Int32,

bSimulated as Boolean

) as enumErrorCodes


 

[C#]

public enumErrorCodes KeyboardNote (

IntPtr hWndKeyboard,

Int32 nNote,

Int32 nVelocity,

bool bSimulated

);


 

[C++]

public: enumErrorCodes KeyboardNote (

IntPtr hWndKeyboard,

Int32 nNote,

Int32 nVelocity,

bool bSimulated

);


 

 

 

Parameter

Description

 

 

hWndKeyboard

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

nNote

Note to play. Can be a key number from 0 to 127; 60 means middle C

nVelocity

Velocity of the note. 0 means key released while values from 1 to 127 mean pressure.

bSimulated

Boolean flag that specifies if the key pressure is simulated. When the key pressure is simulated, the key will appear pressed on the piano keyboard but no real event will be 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 call to this method will play the requested note on the MIDI stream in playback

true

The call to this method will not play the requested note on the MIDI stream in playback but will display the corresponding key as pressed on the piano keyboard.

 

 

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.