Deluge Firmware
1.3.0
Build date: 2026.08.23
Toggle main menu visibility
Loading...
Searching...
No Matches
mode.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 "definitions_cxx.hpp"
19
#include "gui/l10n/l10n.h"
20
#include "gui/menu_item/formatted_title.h"
21
#include "gui/menu_item/selection.h"
22
#include "gui/ui/sound_editor.h"
23
#include "processing/engines/cv_engine.h"
24
#include <string_view>
25
26
namespace
deluge::gui::menu_item::gate {
27
28
class
Mode final :
public
Selection
,
public
FormattedTitle {
29
30
deluge::vector<l10n::String> options_ = {
31
l10n::String::STRING_FOR_V_TRIGGER,
32
l10n::String::STRING_FOR_S_TRIGGER,
33
};
34
35
public
:
36
Mode() :
Selection
(), FormattedTitle(l10n::String::STRING_FOR_GATE_MODE_TITLE) {}
37
[[nodiscard]] std::string_view
getTitle
()
const override
{
return
FormattedTitle::title(); }
38
39
void
readCurrentValue
()
override
{ this->setValue(cvEngine.gateChannels[soundEditor.currentSourceIndex].mode); }
40
void
writeCurrentValue()
override
{
41
cvEngine.setGateType(soundEditor.currentSourceIndex, this->getValue<GateType>());
42
}
43
deluge::vector<std::string_view> getOptions(OptType optType)
override
{
44
(void)optType;
45
deluge::vector<std::string_view> output;
46
for
(l10n::String str : options_) {
47
output.push_back(l10n::getView(str));
48
}
49
return
output;
50
}
51
52
void
updateOptions(int32_t value) {
53
using
enum l10n::String;
54
// Remove the extra entry if it's present
55
if
(options_.size() > 2) {
56
options_.pop_back();
57
}
58
59
switch
(value) {
60
case
WHICH_GATE_OUTPUT_IS_CLOCK:
61
options_.push_back(STRING_FOR_CLOCK);
62
break
;
63
64
case
WHICH_GATE_OUTPUT_IS_RUN:
65
options_.push_back(STRING_FOR_RUN_SIGNAL);
66
break
;
67
68
default
:
69
break
;
70
}
71
}
72
};
73
74
}
// namespace deluge::gui::menu_item::gate
deluge::gui::menu_item::gate::Mode::getTitle
std::string_view getTitle() const override
Get the title to be used when rendering on OLED, both as a deluge::gui::menu_item::Submenu and when d...
Definition
mode.h:37
deluge::gui::menu_item::gate::Mode::readCurrentValue
void readCurrentValue() override
Like readValueAgain, but does not redraw.
Definition
mode.h:39
deluge::gui::menu_item::gate::Selection
Definition
selection.h:29