Deluge Firmware 1.3.0
Build date: 2025.04.16
Loading...
Searching...
No Matches
note_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/selection.h"
21#include "gui/ui/sound_editor.h"
22#include "model/song/song.h"
23
24namespace deluge::gui::menu_item::arpeggiator {
25class NoteMode : public Selection {
26public:
27 using Selection::Selection;
28 void readCurrentValue() override { this->setValue(soundEditor.currentArpSettings->noteMode); }
29 void writeCurrentValue() override {
30 soundEditor.currentArpSettings->noteMode = this->getValue<ArpNoteMode>();
31 soundEditor.currentArpSettings->updatePresetFromCurrentSettings();
32 if (soundEditor.currentArpSettings->noteMode == ArpNoteMode::PATTERN) {
33 soundEditor.currentArpSettings->generateNewNotePattern();
34 }
35 soundEditor.currentArpSettings->flagForceArpRestart = true;
36 }
37 bool isRelevant(ModControllableAudio* modControllable, int32_t whichThing) override {
38 return !soundEditor.editingKitRow();
39 }
40 void getColumnLabel(StringBuf& label) override {
41 label.append(deluge::l10n::get(deluge::l10n::built_in::seven_segment, this->name));
42 }
43
44 deluge::vector<std::string_view> getOptions(OptType optType) override {
45 using enum l10n::String;
46 if (optType == OptType::SHORT) {
47 return {
48 l10n::getView(l10n::built_in::seven_segment, STRING_FOR_UP), //<
49 l10n::getView(l10n::built_in::seven_segment, STRING_FOR_DOWN), //<
50 l10n::getView(l10n::built_in::seven_segment, STRING_FOR_UP_DOWN), //<
51 l10n::getView(l10n::built_in::seven_segment, STRING_FOR_RANDOM), //<
52 l10n::getView(l10n::built_in::seven_segment, STRING_FOR_WALK1), //<
53 l10n::getView(l10n::built_in::seven_segment, STRING_FOR_WALK2), //<
54 l10n::getView(l10n::built_in::seven_segment, STRING_FOR_WALK3), //<
55 l10n::getView(l10n::built_in::seven_segment, STRING_FOR_AS_PLAYED), //<
56 l10n::getView(l10n::built_in::seven_segment, STRING_FOR_PATTERN), //<
57 };
58 }
59 return {
60 l10n::getView(STRING_FOR_UP), //<
61 l10n::getView(STRING_FOR_DOWN), //<
62 l10n::getView(STRING_FOR_UP_DOWN), //<
63 l10n::getView(STRING_FOR_RANDOM), //<
64 l10n::getView(STRING_FOR_WALK1), //<
65 l10n::getView(STRING_FOR_WALK2), //<
66 l10n::getView(STRING_FOR_WALK3), //<
67 l10n::getView(STRING_FOR_AS_PLAYED), //<
68 l10n::getView(STRING_FOR_PATTERN), //<
69 };
70 }
71};
72
73class NoteModeFromOctaveMode final : public NoteMode {
74public:
75 using NoteMode::NoteMode;
76 void readCurrentValue() override {
77 if (display->have7SEG()) {
78 display->displayPopup(deluge::l10n::get(deluge::l10n::String::STRING_FOR_NOTE_MODE));
79 }
81 }
82};
83
84extern NoteModeFromOctaveMode arpNoteModeFromOctaveModeMenu;
85} // namespace deluge::gui::menu_item::arpeggiator
Definition mod_controllable_audio.h:47
Definition d_string.h:106
Definition selection.h:26
void readCurrentValue() override
Like readValueAgain, but does not redraw.
Definition note_mode.h:76
void readCurrentValue() override
Like readValueAgain, but does not redraw.
Definition note_mode.h:28
bool isRelevant(ModControllableAudio *modControllable, int32_t whichThing) override
Check if this MenuItem should show up in a containing deluge::gui::menu_item::Submenu.
Definition note_mode.h:37
void getColumnLabel(StringBuf &label) override
Get the name for use on horizontal menus.
Definition note_mode.h:40