Deluge Firmware
1.3.0
Build date: 2026.08.29
Toggle main menu visibility
Loading...
Searching...
No Matches
column_controls.h
1
/*
2
* Copyright © 2016-2024 Synthstrom Audible Limited
3
*
4
* This file is part of The Synthstrom Audible Deluge Firmware.
5
*
6
* The Synthstrom Audible Deluge Firmware is free software: you can redistribute it and/or modify it under the
7
* terms of the GNU General Public License as published by the Free Software Foundation,
8
* either version 3 of the License, or (at your option) any later version.
9
*
10
* This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
11
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
12
* See the GNU General Public License for more details.
13
*
14
* You should have received a copy of the GNU General Public License along with this program.
15
* If not, see <https://www.gnu.org/licenses/>.
16
*/
17
18
#pragma once
19
20
#include "gui/ui/keyboard/layout.h"
21
#include "gui/ui/keyboard/layout/column_control_state.h"
22
23
namespace
deluge::gui::ui::keyboard::layout {
24
25
using namespace
deluge::gui::ui::keyboard::controls;
26
27
constexpr
int32_t kMinIsomorphicRowInterval = 1;
28
constexpr
int32_t kMaxIsomorphicRowInterval = 16;
29
constexpr
uint32_t kHalfStep = 0x7FFFFF;
30
31
enum
BeatRepeat {
32
NO_BEAT_REPEAT = 0,
33
DOT_EIGHT,
34
EIGHT,
35
TRIPLET,
36
DOT_SIXTEENTH,
37
SIXTEENTH,
38
SEXTUPLET,
39
THIRTYSECOND,
40
SIXTYFOURTH,
41
BEAT_REPEAT_MAX,
/* should be 9, 8 beat repeat pads plus NO_BEAT_REPEAT */
42
};
43
44
// Note: may need to make this virtual inheritance in the future if we want multiple mix-in-style
45
// keyboard classes
46
class
ColumnControlsKeyboard :
public
KeyboardLayout {
47
public
:
48
ColumnControlsKeyboard() =
default
;
49
50
// call this instead of on notestate directly as chord and beat repeat helper
51
void
enableNote(uint8_t note, uint8_t velocity);
52
53
// should be called by any children that override
54
void
evaluatePads
(
PressedPad
presses[kMaxNumKeyboardPadPresses])
override
;
55
56
// in a child, call verticalEncoderHandledByColumns and ignore the encoder input if it returns
57
// true
58
void
handleVerticalEncoder
(int32_t offset)
override
;
59
60
// in a child, call horizontalEncoderHandledByColumns and ignore the encoder input if it returns
61
// true
62
void
handleHorizontalEncoder
(int32_t offset,
bool
shiftEnabled,
PressedPad
presses[kMaxNumKeyboardPadPresses],
63
bool
encoderPressed =
false
)
override
;
64
65
bool
verticalEncoderHandledByColumns(int32_t offset);
66
bool
horizontalEncoderHandledByColumns(int32_t offset,
bool
shiftEnabled);
67
68
ColumnControlFunction nextControlFunction(ColumnControlFunction cur, ColumnControlFunction skip);
69
ColumnControlFunction prevControlFunction(ColumnControlFunction cur, ColumnControlFunction skip);
70
ColumnControlFunction stepControlFunction(int32_t offset, ColumnControlFunction cur, ColumnControlFunction skip);
71
72
void
renderSidebarPads(
RGB
image[][kDisplayWidth + kSideBarWidth])
override
;
73
74
void
checkNewInstrument(
Instrument
* newInstrument)
override
;
75
76
void
renderColumnBeatRepeat(
RGB
image[][kDisplayWidth + kSideBarWidth], int32_t column);
77
78
int8_t leftColHeld = -1;
79
int8_t rightColHeld = -1;
80
81
protected
:
82
// Subclasses can override this to allow or disallow certain ControlColumn types
83
virtual
bool
allowSidebarType(ColumnControlFunction sidebarType) {
return
true
; };
84
};
85
86
};
// namespace deluge::gui::ui::keyboard::layout
Instrument
Definition
instrument.h:45
RGB
This class represents the colour format most used by the Deluge globally.
Definition
rgb.h:14
deluge::gui::ui::keyboard::layout::ColumnControlsKeyboard::handleVerticalEncoder
void handleVerticalEncoder(int32_t offset) override
Shift state not supplied since that function is already taken.
Definition
column_controls.cpp:112
deluge::gui::ui::keyboard::layout::ColumnControlsKeyboard::handleHorizontalEncoder
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
column_controls.cpp:128
deluge::gui::ui::keyboard::layout::ColumnControlsKeyboard::evaluatePads
void evaluatePads(PressedPad presses[kMaxNumKeyboardPadPresses]) override
Handle input pad presses.
Definition
column_controls.cpp:66
deluge::gui::ui::keyboard::PressedPad
Definition
notes_state.h:31