20#include "gui/ui/keyboard/layout/column_controls.h"
21#include "model/scale/note_set.h"
23namespace deluge::gui::ui::keyboard::layout {
26constexpr int32_t lowestPianoOctave = 0;
27constexpr int32_t highestPianoOctave = 9;
29constexpr int32_t highestNoteOffset = 7;
31constexpr int32_t totalPianoOctaves = 16;
32constexpr int32_t colourOffset = 6;
35const int32_t pianoIntervals[2][7] = {
36 {0, 2, 4, 0, 7, 9, 11},
37 {1, 3, 5, 6, 8, 10, 12},
40class KeyboardLayoutPiano :
public ColumnControlsKeyboard {
42 KeyboardLayoutPiano() {}
43 ~KeyboardLayoutPiano()
override {}
48 bool encoderPressed =
false)
override;
51 void renderPads(
RGB image[][kDisplayWidth + kSideBarWidth])
override;
53 l10n::String name()
override {
return l10n::String::STRING_FOR_KEYBOARD_LAYOUT_PIANO; }
55 bool supportsKit()
override {
return false; }
63 inline uint16_t intervalFromCoords(int32_t x, int32_t y) {
64 return (y == 0 || (y % 2 == 0)) ? (pianoIntervals[1][(x + getState().piano.noteOffset) % 7])
65 : (pianoIntervals[0][(x + getState().piano.noteOffset) % 7]);
72 inline uint16_t noteFromCoords(int32_t x, int32_t y) {
73 return (getState().piano.scrollOffset) * 12 + intervalFromCoords(x, y) + 12 * (y / 2)
74 + 12 * ((x + getState().piano.noteOffset) / 7) - 1;
78 RGB noteColours[totalPianoOctaves + 1];
This class represents the colour format most used by the Deluge globally.
Definition rgb.h:14
void renderPads(RGB image[][kDisplayWidth+kSideBarWidth]) override
Handle output.
Definition piano.cpp:78
void evaluatePads(PressedPad presses[kMaxNumKeyboardPadPresses]) override
Handle input pad presses.
Definition piano.cpp:27
void handleHorizontalEncoder(int32_t offset, bool shiftEnabled, PressedPad presses[kMaxNumKeyboardPadPresses], bool encoderPressed=false) override
Will be called with offset 0 to recalculate bounds on clip changes.
Definition piano.cpp:56
void precalculate() override
This function is called on visibility change and if colour offset changes.
Definition piano.cpp:70
bool supportsInstrument() override
This currently includes Synth, MIDI and CV.
Definition piano.h:54
void handleVerticalEncoder(int32_t offset) override
Shift state not supplied since that function is already taken.
Definition piano.cpp:43
Definition notes_state.h:31