Copyright © 2001-2019 MultiMedia Soft

MIDI.KeyboardCreate method

Previous pageReturn to chapter overviewNext page

Remarks

 

Creates a new virtual piano keyboard on the given parent window.

 

Notes played on the virtual piano, through the left button of the mouse, will be directly sent to the MIDI stream in playback on the given player.

Keys pressure/release can be simulated through the MIDI.KeyboardNote method, for example for displaying a note played through an external physical MIDI keyboard attached to one of the MIDI input channels.

 

The container application is notified each time a key on the virtual keyboard is pressed or released through the MidiKeyboardNotification event.

 

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

 

 

Syntax

 

[Visual Basic]

control.MIDI.KeyboardCreate (

nPlayer as Integer,

hWndParent as OLE_HANDLE,

nLeft as Long,

nTop as Long,

nWidth as Long,

nHeight as Long,

nLowNote as Integer,

nHighNote as Integer,

bSendEventNotif as enumBoolean,

nOrientation as enumMidiKeyboardOrientations

) as OLE_HANDLE


 

[C++]

OLE_HANDLE control.MIDI.KeyboardCreate (

short nPlayer,

OLE_HANDLE hWndParent,

long nLeft,

long nTop,

long nWidth,

long nHeight,

short nLowNote,

short nHighNote,

short bSendEventNotif,

short nOrientation

);


 

Parameter

Description

 

 

nPlayer

Number representing the zero-based index of the involved player

hWndParent

Handle of the parent window, usually the container form.

nLeft

Left position of the keyboard window, expressed in client coordinates (pixels) of hWndParent

nTop

Top position of the keyboard window, expressed in client coordinates (pixels) of hWndParent

nWidth

Width of the keyboard window, expressed in pixels

nHeight

Height of the keyboard window, expressed in pixels

nLowNote

Lower note displayed on the virtual piano keyboard. Can be a value between 0 and 127 but must always be a natural note (white key).

nHighNote

Higher note displayed on the virtual piano keyboard. Can be a value between 2 and 127 but must always be a natural note (white key).

bSendEventNotif

Boolean flag that specifies if the container application must be notified about the notes played on the keyboard through the MidiStreamEventNotification event.

Supported values are the following:

Mnemonic constant

Value

Meaning

BOOL_FALSE

0

The MidiStreamEventNotification event is not generated for notes played on the piano keyboard.

BOOL_TRUE

1

The MidiStreamEventNotification event is generated for notes played on the piano keyboard.

nOrientation

Orientation of the piano keyboard.

Supported values are the following:

Mnemonic constant

Value

Meaning

MIDI_KEYB_ORIENT_HORIZONTAL

0

The piano keyboard orientation is horizontal as in the picture below

MIDI_KEYB_ORIENT_VERTICAL_LEFT

1

The piano keyboard orientation is left vertical as in the picture below

MIDI_KEYB_ORIENT_VERTICAL_RIGHT

2

The piano keyboard orientation is right vertical as in the picture below

 

 

Return value

 

Value

Meaning

 

 

0

An error occurred, check the LastError property value in order to get the error code

Other values

Handle (HWND) of the new virtual piano keyboard