Deluge Firmware
1.3.0
Build date: 2026.08.23
Toggle main menu visibility
Loading...
Searching...
No Matches
selection.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/gate/mode.h"
19
#include "gui/menu_item/selection.h"
20
#include "gui/ui/sound_editor.h"
21
#include "hid/display/display.h"
22
#include "mode.h"
23
#include "off_time.h"
24
25
extern
deluge::gui::menu_item::gate::OffTime
gateOffTimeMenu;
26
extern
deluge::gui::menu_item::gate::Mode
gateModeMenu;
27
namespace
deluge::gui::menu_item::gate {
28
29
class
Selection
final :
public
menu_item::Selection
{
30
public
:
31
using
menu_item::Selection::Selection;
32
33
void
beginSession
(MenuItem* navigatedBackwardFrom)
override
{
34
if
(navigatedBackwardFrom ==
nullptr
) {
35
this->setValue(0);
36
}
37
else
{
38
this->setValue(soundEditor.currentSourceIndex);
39
}
40
menu_item::Selection::beginSession
(navigatedBackwardFrom);
41
}
42
43
MenuItem*
selectButtonPress
()
override
{
44
if
(this->getValue() == NUM_GATE_CHANNELS) {
45
return
&gateOffTimeMenu;
46
}
47
soundEditor.currentSourceIndex = this->getValue();
48
49
// Value of 0 is the first gate output, so we need to add 1 to get the correct physical gate output number label
50
if
(display->haveOLED()) {
51
gateModeMenu.format(this->getValue() + 1);
52
}
53
54
gateModeMenu.updateOptions(this->getValue());
55
return
&gateModeMenu;
56
}
57
58
deluge::vector<std::string_view> getOptions(OptType optType)
override
{
59
(void)optType;
60
using
enum l10n::String;
61
static
auto
out1 = l10n::getView(STRING_FOR_GATE_OUTPUT_1);
62
static
auto
out2 = l10n::getView(STRING_FOR_GATE_OUTPUT_2);
63
static
auto
out3 = l10n::getView(STRING_FOR_GATE_OUTPUT_3);
64
static
auto
out4 = l10n::getView(STRING_FOR_GATE_OUTPUT_4);
65
66
return
{
67
out1,
//<
68
out2,
//<
69
out3,
//<
70
out4,
//<
71
l10n::getView(STRING_FOR_MINIMUM_OFF_TIME),
//<
72
};
73
}
74
};
75
}
// namespace deluge::gui::menu_item::gate
deluge::gui::menu_item::Enumeration::beginSession
void beginSession(MenuItem *navigatedBackwardFrom) override
Begin an editing session with this menu item.
Definition
enumeration.cpp:7
deluge::gui::menu_item::Selection
Definition
selection.h:26
deluge::gui::menu_item::gate::Mode
Definition
mode.h:28
deluge::gui::menu_item::gate::OffTime
Definition
off_time.h:22
deluge::gui::menu_item::gate::Selection
Definition
selection.h:29
deluge::gui::menu_item::gate::Selection::beginSession
void beginSession(MenuItem *navigatedBackwardFrom) override
Begin an editing session with this menu item.
Definition
selection.h:33
deluge::gui::menu_item::gate::Selection::selectButtonPress
MenuItem * selectButtonPress() override
Handle a select button press.
Definition
selection.h:43