Package voltage.core

# Class VoltageKeyboard

java.lang.Object
voltage.core.VoltageComponent
voltage.core.VoltageKeyboard

public class VoltageKeyboard extends VoltageComponent
A virtual keyboard control

- ## Nested Class Summary

  Nested Classes
  Modifier and Type
  Class
  Description
  `static enum`
  `VoltageKeyboard.KeyboardOrientation`
  The orientation of the keyboard such as horizontal or vertical.

- ## Field Summary

  ### Fields inherited from class voltage.core.VoltageComponent

  `componentName, displayName`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `VoltageKeyboard(String name, VoltageModule module)`
  Creates the VoltageKeyboard object with a horizontal orientation.
  `VoltageKeyboard(String name, VoltageModule module, VoltageKeyboard.KeyboardOrientation orientation)`
  Creates the VoltageKeyboard object.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `void`
  `ClearAllNoteText()`
  Clears the text from all notes.
  `void`
  `ClearNoteText(int noteNum)`
  Clears the note text.
  `int`
  `GetOctaveForMiddleC()`
  Returns the current octave for middle C.
  `boolean`
  `IsNoteOn(int midiChannel, int midiNoteNumber)`
  Is a note down?
  `void`
  `RemoveKeyPressForNote(int midiNoteOffsetFromC)`
  Unbinds a key from a note.
  `void`
  `SetAllNotesOff(int midiChannel)`
  Turns off all notes on a MIDI channel
  `void`
  `SetKeyboardColors(Color whiteNote, Color blackNote, Color keySepLine, Color mouseOverKeyOverlay, Color keyDownOverlay, Color whiteNoteTextLabel, Color blackNoteTextLabel, Color upDownControlBackground, Color upDownArrow, Color shadowAtTopOfKeyboard)`
  Set the keyboard colors.
  `void`
  `SetKeyPressBaseOctave(int newOctaveNumber)`
  Sets the octave that keypresses trigger.
  `void`
  `SetKeyPressesToAutomaticallyGoTo_IOModule(boolean bAutoGoToIOPanel)`
  Should MIDI notes go to the IO Panel?
  `void`
  `SetKeyPressForNote(int keyCode, int midiNoteOffsetFromC)`
  Bind a key to a note.
  `void`
  `SetKeyRange(int startNote, int endNote)`
  Sets the range of the keyboard.
  `void`
  `SetKeySizes(float whiteKeyWidth, float blackKeyWidthRatio, float blackKeyLengthRatio)`
  Sets the size and ratio of the keys
  `void`
  `SetMidiChannel(int midiChannelNumber)`
  Sets the MIDI channel for this control.
  `void`
  `SetNoteOff(int midiChannel, int midiNoteNumber, float velocity)`
  Turns a note off.
  `void`
  `SetNoteOn(int midiChannel, int midiNoteNumber, float velocity)`
  Turns a note on.
  `void`
  `SetNoteText(int noteNum, String textStr)`
  Sets text on a key.
  `void`
  `SetOctaveForMiddleC(int octaveNumForMiddleC)`
  Sets the octave for middle C Some set middle C to octave 4 and some perfer it at octave 5.
  `void`
  `SetScrollButtonsVisible(boolean bShow)`
  Sets whether the scroll buttons are visible.
  `void`
  `SetScrollButtonWidth(int width)`
  Sets the width of the scroll buttons.
  `void`
  `SetShowKeyPressMappingsOnKeys(boolean bShow)`
  Show the bindings on the control?
  `void`
  `SetVelocity(float velocity, boolean useMousePositionForVelocity)`
  Sets the velocity for notes coming from the control.

  ### Methods inherited from class voltage.core.VoltageComponent

  `AddChildComponent, GetComponentID, GetDisplayName, GetHeight, GetMaxValue, GetMinValue, GetRect, GetSkin, GetTooltipText, GetTransparency, GetUserProperty, GetValue, GetWidth, GetX, GetY, IsEnabled, IsVisible, RemoveChildComponent, SetCanBeAutomated, SetEnabled, SetPosition, SetRect, SetRect, SetSize, SetSkin, SetTransparency, SetUnits, SetUserProperty, SetValue, SetValue, SetValueNoNotification, SetVisible, SetWantsMouseNotifications, SetZOrder, SkewNormalizedValue, UpdateGUIValue, WantsMouseNotifications`

  ### Methods inherited from class java.lang.Object

  `equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Constructor Details

  - ### VoltageKeyboard

    public VoltageKeyboard(String name, VoltageModule module, VoltageKeyboard.KeyboardOrientation orientation)
    Creates the VoltageKeyboard object.
    Parameters:
      `name` - the name of the control
      `module` - the module this belongs to
      `orientation` - the keyboard orientation

  - ### VoltageKeyboard

    public VoltageKeyboard(String name, VoltageModule module)
    Creates the VoltageKeyboard object with a horizontal orientation.
    Parameters:
      `name` - the name of the control
      `module` - the module this belongs to

- ## Method Details

  - ### SetKeyboardColors

    public void SetKeyboardColors(Color whiteNote, Color blackNote, Color keySepLine, Color mouseOverKeyOverlay, Color keyDownOverlay, Color whiteNoteTextLabel, Color blackNoteTextLabel, Color upDownControlBackground, Color upDownArrow, Color shadowAtTopOfKeyboard)
    Set the keyboard colors.
    Parameters:
      `whiteNote` - the white note color
      `blackNote` - the black note color
      `keySepLine` - The key separation line color between white keys.
      `mouseOverKeyOverlay` - the hover color for white keys.
      `keyDownOverlay` - the key down color for white keys.
      `whiteNoteTextLabel` - the text color over white keys.
      `blackNoteTextLabel` - the text color over black keys.
      `upDownControlBackground` - background color of the control that lets you adjust the octave.
      `upDownArrow` - color of up/down arrow.
      `shadowAtTopOfKeyboard` - slight shadow at top of keyboard.

  - ### SetKeySizes

    public void SetKeySizes(float whiteKeyWidth, float blackKeyWidthRatio, float blackKeyLengthRatio)
    Sets the size and ratio of the keys
    Parameters:
      `whiteKeyWidth` - the width of a white key.
      `blackKeyWidthRatio` - the relative size of a black key.
      `blackKeyLengthRatio` - the relative length of a black key.

  - ### SetKeyRange

    public void SetKeyRange(int startNote, int endNote)
    Sets the range of the keyboard.
    Parameters:
      `startNote` - Valid from 0 to 127
      `endNote` - Valid from 0 to 127

  - ### SetScrollButtonsVisible

    public void SetScrollButtonsVisible(boolean bShow)
    Sets whether the scroll buttons are visible.
    Parameters:
      `bShow` - set to true to see the scroll buttons.

  - ### SetScrollButtonWidth

    public void SetScrollButtonWidth(int width)
    Sets the width of the scroll buttons.
    Parameters:
      `width` - the width in pixels of the scroll buttons.

  - ### SetVelocity

    public void SetVelocity(float velocity, boolean useMousePositionForVelocity)
    Sets the velocity for notes coming from the control.
    Parameters:
      `velocity` - the velocity from 0.0f to 1.0f to use for notes.
      `useMousePositionForVelocity` - if true, clicks higher up on the note generate higher velocities.

  - ### SetMidiChannel

    public void SetMidiChannel(int midiChannelNumber)
    Sets the MIDI channel for this control.
    Parameters:
      `midiChannelNumber` - the channel from 1 to 16 to generate MIDI notes on.

  - ### IsNoteOn

    public boolean IsNoteOn(int midiChannel, int midiNoteNumber)
    Is a note down?
    Parameters:
      `midiChannel` - the channel of the MIDI note. (1 to 16)
      `midiNoteNumber` - the MIDI note to check. (0 to 127)
    Returns:
      true if the note is down.

  - ### SetNoteOn

    public void SetNoteOn(int midiChannel, int midiNoteNumber, float velocity)
    Turns a note on.
    Parameters:
      `midiChannel` - the channel of the MIDI note. (1 to 16)
      `midiNoteNumber` - the MIDI note to check. (0 to 127)
      `velocity` - the velocity to use. (0.0f to 1.0f)

  - ### SetNoteOff

    public void SetNoteOff(int midiChannel, int midiNoteNumber, float velocity)
    Turns a note off.
    Parameters:
      `midiChannel` - the channel of the MIDI note. (1 to 16)
      `midiNoteNumber` - the MIDI note to check. (0 to 127)
      `velocity` - the velocity to use. (0.0f to 1.0f)

  - ### SetAllNotesOff

    public void SetAllNotesOff(int midiChannel)
    Turns off all notes on a MIDI channel
    Parameters:
      `midiChannel` - the channel of the MIDI note. (1 to 16) Use -1 for all channels.

  - ### SetKeyPressesToAutomaticallyGoTo_IOModule

    public void SetKeyPressesToAutomaticallyGoTo_IOModule(boolean bAutoGoToIOPanel)
    Should MIDI notes go to the IO Panel?
    Parameters:
      `bAutoGoToIOPanel` - flag to set whether notes should go to the IOPanel.

  - ### SetNoteText

    public void SetNoteText(int noteNum, String textStr)
    Sets text on a key.
    Parameters:
      `noteNum` - the number of the note (0 to 127)
      `textStr` - the text to display on the note.

  - ### ClearNoteText

    public void ClearNoteText(int noteNum)
    Clears the note text.
    Parameters:
      `noteNum` - the note to clear (0 to 127)

  - ### ClearAllNoteText

    public void ClearAllNoteText()
    Clears the text from all notes.

  - ### SetKeyPressForNote

    public void SetKeyPressForNote(int keyCode, int midiNoteOffsetFromC)
    Bind a key to a note.
    Parameters:
      `keyCode` - the keycode to bind.
      `midiNoteOffsetFromC` - the key offset from C. IE: 0 would be C, 1 would be C#, etc.

  - ### RemoveKeyPressForNote

    public void RemoveKeyPressForNote(int midiNoteOffsetFromC)
    Unbinds a key from a note.
    Parameters:
      `midiNoteOffsetFromC` - the offset of the note from middle C.

  - ### SetKeyPressBaseOctave

    public void SetKeyPressBaseOctave(int newOctaveNumber)
    Sets the octave that keypresses trigger. If you bind keypresses to this control, this is the octave of MIDI notes that it will trigger.
    Parameters:
      `newOctaveNumber` - this is the octave of MIDI notes that it will trigger.

  - ### SetShowKeyPressMappingsOnKeys

    public void SetShowKeyPressMappingsOnKeys(boolean bShow)
    Show the bindings on the control?
    Parameters:
      `bShow` - if true, the control displays the key bindings.

  - ### SetOctaveForMiddleC

    public void SetOctaveForMiddleC(int octaveNumForMiddleC)
    Sets the octave for middle C Some set middle C to octave 4 and some perfer it at octave 5.
    Parameters:
      `octaveNumForMiddleC` - the octave #.

  - ### GetOctaveForMiddleC

    public int GetOctaveForMiddleC()
    Returns the current octave for middle C.
    Returns:
      the octave being used for middle C.