Deluge Firmware
1.3.0
Build date: 2026.02.12
Loading...
Searching...
No Matches
follow_kit_root_note.h
1
/*
2
* Copyright (c) 2014-2023 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
#pragma once
18
#include "gui/menu_item/integer.h"
19
#include "gui/ui/sound_editor.h"
20
#include "io/midi/midi_engine.h"
21
22
namespace
deluge::gui::menu_item::midi {
23
24
class
FollowKitRootNote
final :
public
Integer
{
25
public
:
26
using
Integer::Integer;
27
void
readCurrentValue
()
override
{ this->setValue(midiEngine.midiFollowKitRootNote); }
28
void
writeCurrentValue()
override
{ midiEngine.midiFollowKitRootNote = this->getValue(); }
29
[[nodiscard]] int32_t getMinValue()
const override
{
return
0; }
30
[[nodiscard]] int32_t getMaxValue()
const override
{
return
kMaxMIDIValue; }
31
bool
allowsLearnMode
()
override
{
return
true
; }
32
33
bool
learnNoteOn
(
MIDICable
& cable, int32_t channel, int32_t noteCode)
override
{
34
this->setValue(noteCode);
35
midiEngine.midiFollowKitRootNote = noteCode;
36
37
if
(soundEditor.getCurrentMenuItem() ==
this
) {
38
if
(display->haveOLED()) {
39
renderUIsForOled();
40
}
41
else
{
42
drawValue();
43
}
44
}
45
else
{
46
display->displayPopup(l10n::get(l10n::String::STRING_FOR_LEARNED));
47
}
48
49
return
true
;
50
}
51
};
52
}
// namespace deluge::gui::menu_item::midi
MIDICable
A MIDI cable connection. Stores all state specific to a given cable and its contained ports and chann...
Definition
midi_device.h:96
deluge::gui::menu_item::Integer
Definition
integer.h:24
deluge::gui::menu_item::midi::FollowKitRootNote
Definition
follow_kit_root_note.h:24
deluge::gui::menu_item::midi::FollowKitRootNote::learnNoteOn
bool learnNoteOn(MIDICable &cable, int32_t channel, int32_t noteCode) override
Attempt to bind this menu item to a note code.
Definition
follow_kit_root_note.h:33
deluge::gui::menu_item::midi::FollowKitRootNote::allowsLearnMode
bool allowsLearnMode() override
Used by SoundEditor to determine if the current menu item can accept MIDI learning.
Definition
follow_kit_root_note.h:31
deluge::gui::menu_item::midi::FollowKitRootNote::readCurrentValue
void readCurrentValue() override
Like readValueAgain, but does not redraw.
Definition
follow_kit_root_note.h:27