Deluge Firmware
1.3.0
Build date: 2025.04.16
Loading...
Searching...
No Matches
follow_kit_root_note.h
1
/*
2
* Copyright (c) 2024 Sean Ditny
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
#include "gui/menu_item/integer.h"
20
#include "gui/ui/sound_editor.h"
21
#include "io/midi/midi_engine.h"
22
23
namespace
deluge::gui::menu_item::midi {
24
25
class
FollowKitRootNote
final :
public
Integer
{
26
public
:
27
using
Integer::Integer;
28
void
readCurrentValue
()
override
{ this->setValue(midiEngine.midiFollowKitRootNote); }
29
void
writeCurrentValue()
override
{ midiEngine.midiFollowKitRootNote = this->getValue(); }
30
[[nodiscard]] int32_t getMinValue()
const override
{
return
0; }
31
[[nodiscard]] int32_t getMaxValue()
const override
{
return
kMaxMIDIValue; }
32
bool
allowsLearnMode
()
override
{
return
true
; }
33
34
bool
learnNoteOn
(
MIDICable
& cable, int32_t channel, int32_t noteCode)
override
{
35
this->setValue(noteCode);
36
midiEngine.midiFollowKitRootNote = noteCode;
37
38
if
(soundEditor.getCurrentMenuItem() ==
this
) {
39
if
(display->haveOLED()) {
40
renderUIsForOled();
41
}
42
else
{
43
drawValue();
44
}
45
}
46
else
{
47
display->displayPopup(l10n::get(l10n::String::STRING_FOR_LEARNED));
48
}
49
50
return
true
;
51
}
52
};
53
}
// 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:94
deluge::gui::menu_item::Integer
Definition
integer.h:24
deluge::gui::menu_item::midi::FollowKitRootNote
Definition
follow_kit_root_note.h:25
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:34
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:32
deluge::gui::menu_item::midi::FollowKitRootNote::readCurrentValue
void readCurrentValue() override
Like readValueAgain, but does not redraw.
Definition
follow_kit_root_note.h:28