53 verticalKeyboardFacingLeft,
54 verticalKeyboardFacingRight,
69 void setKeyWidth (
float widthInPixels);
75 void setScrollButtonWidth (
int widthInPixels);
81 void setOrientation (Orientation newOrientation);
87 bool isHorizontal() const noexcept {
return orientation == horizontalKeyboard; }
96 void setAvailableRange (
int lowestNote,
int highestNote);
116 void setLowestVisibleKey (
int noteNumber);
128 float getWhiteNoteLength() const noexcept;
131 void setBlackNoteLengthProportion (
float ratio) noexcept;
134 float getBlackNoteLengthProportion() const noexcept {
return blackNoteLengthRatio; }
140 float getBlackNoteLength() const noexcept;
143 void setBlackNoteWidthProportion (
float ratio) noexcept;
146 float getBlackNoteWidthProportion() const noexcept {
return blackNoteWidthRatio; }
157 void setScrollButtonsVisible (
bool canScroll);
169 upDownButtonBackgroundColourId = 0x1004000,
170 upDownButtonArrowColourId = 0x1004001
178 float getKeyStartPosition (
int midiNoteNumber)
const;
181 float getTotalKeyboardWidth() const noexcept;
200 [[deprecated (
"This method has been deprecated in favour of getNoteAndVelocityAtPosition.")]]
201 int getNoteAtPosition (
Point<float> p) {
return getNoteAndVelocityAtPosition (p).note; }
219 void setOctaveForMiddleC (
int octaveNumForMiddleC);
248 virtual void drawUpDownButton (
Graphics& g,
int w,
int h,
bool isMouseOver,
bool isButtonPressed,
bool movesOctavesUp);
258 virtual Range<float> getKeyPosition (
int midiNoteNumber,
float keyWidth)
const;
264 void resized()
override;
274 void setLowestVisibleKeyFloat (
float noteNumber);
279 float blackNoteLengthRatio = 0.7f, blackNoteWidthRatio = 0.7f;
280 float xOffset = 0.0f;
281 float keyWidth = 16.0f;
282 float firstKey = 12 * 4.0f;
284 int scrollButtonWidth = 12;
285 int rangeStart = 0, rangeEnd = 127;
286 int octaveNumForMiddleC = 3;
288 bool canScroll =
true;
Holds a list of ChangeListeners, and sends messages to them when instructed.
The base class for all JUCE user-interface objects.
A graphics context, used for drawing a component or image.
A base class for drawing a custom MIDI keyboard component.
bool isHorizontal() const noexcept
Returns true if the keyboard's orientation is horizontal.
virtual void drawKeyboardBackground(Graphics &g, Rectangle< float > area)=0
Use this method to draw the background of the keyboard that will be drawn under the white and black n...
float getKeyWidth() const noexcept
Returns the width that was set by setKeyWidth().
virtual void drawWhiteKey(int midiNoteNumber, Graphics &g, Rectangle< float > area)=0
Use this method to draw a white key of the keyboard in a given rectangle.
int getScrollButtonWidth() const noexcept
Returns the width that was set by setScrollButtonWidth().
virtual void drawBlackKey(int midiNoteNumber, Graphics &g, Rectangle< float > area)=0
Use this method to draw a black key of the keyboard in a given rectangle.
float getBlackNoteWidth() const noexcept
Returns the absolute width of the black notes.
~KeyboardComponentBase() override=default
Destructor.
int getRangeStart() const noexcept
Returns the first note in the available range.
int getRangeEnd() const noexcept
Returns the last note in the available range.
int getLowestVisibleKey() const noexcept
Returns the number of the first key shown in the component.
int getOctaveForMiddleC() const noexcept
This returns the value set by setOctaveForMiddleC().
Orientation getOrientation() const noexcept
Returns the keyboard's current direction.
Orientation
The direction of the keyboard.
ColourIds
Colour IDs to use to change the colour of the octave scroll buttons.
This structure is returned by the getNoteAndVelocityAtPosition() method.
Contains position and status information about a mouse event.
A pair of (x, y) coordinates.
A general-purpose range object, that simply represents any linear range with a start and end point.
Manages a rectangle and allows geometric operations to be performed on it.
Contains status information about a mouse wheel event.