MIDI.KeyboardCreate method |
|
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 CallbackForMidiKeyboardEvents delegate.
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 KeyboardCreate ( nPlayerIndex as Int16, hWndParent as IntPtr, nLeft as Int32, nTop as Int32, nWidth as Int32, nHeight as Int32, nLowNote as Int16, nHighNote as Int16, bSendEventNotif as Boolean, nOrientation as enumMidiKeyboardOrientations ) as IntPtr |
[C#] public IntPtr KeyboardCreate ( Int16 nPlayerIndex, IntPtr hWndParent, Int32 nLeft, Int32 nTop, Int32 nWidth, Int32 nHeight, Int16 nLowNote, Int16 nHighNote, bool bSendEventNotif, enumMidiKeyboardOrientations nOrientation ); |
[C++] public: IntPtr KeyboardCreate ( Int16 nPlayerIndex, IntPtr hWndParent, Int32 nLeft, Int32 nTop, Int32 nWidth, Int32 nHeight, Int16 nLowNote, Int16 nHighNote, bool bSendEventNotif, enumMidiKeyboardOrientations nOrientation ); |
Parameter |
Description |
||||||||||||
|
|
||||||||||||
nPlayerIndex |
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 CallbackForMidiStreamEvents delegate. Supported values are the following:
|
||||||||||||
nOrientation |
Orientation of the piano keyboard. Supported values are the following:
|
Return value
Value |
Meaning |
|
|
IntPtr.Zero |
An error occurred, check the LastError property value in order to get the error code |
Other values |
Handle (HWND) of the new graphic bar |