Deluge Firmware 1.3.0
Build date: 2025.06.05
Loading...
Searching...
No Matches
sound_editor.h
1/*
2 * Copyright © 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
18#pragma once
19
20#include "definitions_cxx.hpp"
21#include "gui/menu_item/menu_item.h"
22#include "gui/ui/ui.h"
23#include "hid/button.h"
24#include "modulation/arpeggiator.h"
25
26#define SHORTCUTS_VERSION_1 0
27#define SHORTCUTS_VERSION_3 1
28#define NUM_SHORTCUTS_VERSIONS 2
29
30extern void enterEditor();
31extern void enterSaveSynthPresetUI();
32
33class Drum;
34class Sound;
35class Source;
37class InstrumentClip;
38class SideChain;
39class Arpeggiator;
41class Clip;
42class SampleHolder;
43class SampleControls;
46class AudioFileHolder;
47class MIDICable;
48
49namespace deluge::gui::menu_item {
50class Submenu;
51enum class RangeEdit : uint8_t;
52} // namespace deluge::gui::menu_item
53
54class SoundEditor final : public UI {
55public:
56 SoundEditor();
57 bool opened() override;
58 void focusRegained() override;
59 void displayOrLanguageChanged() final;
60 bool getGreyoutColsAndRows(uint32_t* cols, uint32_t* rows) override;
61 Sound* currentSound;
62 bool allowsNoteTails;
63 ModControllableAudio* currentModControllable;
64 int8_t currentSourceIndex;
65 Source* currentSource;
66 ParamManagerForTimeline* currentParamManager;
67 SideChain* currentSidechain;
68 ArpeggiatorSettings* currentArpSettings;
69 ::MultiRange* currentMultiRange;
70 SampleControls* currentSampleControls;
71 VoicePriority* currentPriority;
72 int16_t currentMultiRangeIndex;
73 MIDICable* currentMIDICable;
74 deluge::gui::menu_item::RangeEdit editingRangeEdge;
75
76 ActionResult buttonAction(deluge::hid::Button b, bool on, bool inCardRoutine) override;
77 ActionResult padAction(int32_t x, int32_t y, int32_t velocity) override;
78 ActionResult verticalEncoderAction(int32_t offset, bool inCardRoutine) override;
79 void modEncoderAction(int32_t whichModEncoder, int32_t offset) override;
80 void modEncoderButtonAction(uint8_t whichModEncoder, bool on) override;
81 ActionResult horizontalEncoderAction(int32_t offset) override;
82 void scrollFinished() override;
83 bool editingKit();
84 bool editingKitAffectEntire();
85 bool editingKitRow();
86
87 ActionResult timerCallback() override;
88 void setupShortcutBlink(int32_t x, int32_t y, int32_t frequency, int32_t colour = 0L);
89 bool findPatchedParam(int32_t paramLookingFor, int32_t* xout, int32_t* yout, bool* isSecondLayerParamOut);
90 void updateSourceBlinks(MenuItem* currentItem);
91 void resetSourceBlinks();
92
93 uint8_t navigationDepth;
94 uint8_t patchingParamSelected;
95 uint8_t currentParamShorcutX;
96 uint8_t currentParamShorcutY;
97 uint8_t currentParamColour;
98 uint8_t paramShortcutBlinkFrequency;
99 uint32_t shortcutBlinkCounter;
100
101 uint32_t timeLastAttemptedAutomatedParamEdit;
102
103 int8_t numberScrollAmount;
104 uint32_t numberEditSize;
105 int8_t numberEditPos;
106
107 uint8_t shortcutsVersion;
108
109 MenuItem* menuItemNavigationRecord[16];
110
111 bool shouldGoUpOneLevelOnBegin;
112 bool secondLayerShortcutsToggled;
113 bool secondLayerModSourceShortcutsToggled;
114
115 bool programChangeReceived(MIDICable& cable, uint8_t channel, uint8_t program) { return false; }
116 bool midiCCReceived(MIDICable& cable, uint8_t channel, uint8_t ccNumber, uint8_t value);
117 bool pitchBendReceived(MIDICable& cable, uint8_t channel, uint8_t data1, uint8_t data2);
118 void selectEncoderAction(int8_t offset) override;
119 bool canSeeViewUnderneath() override { return true; }
120 bool setup(Clip* clip = nullptr, const MenuItem* item = nullptr, deluge::gui::menu_item::Submenu* parent = nullptr,
121 int32_t sourceIndex = 0);
122 void enterOrUpdateSoundEditor(bool on);
123 void blinkShortcut();
124 ActionResult potentialShortcutPadAction(int32_t x, int32_t y, bool on);
125 bool editingReverbSidechain();
126 MenuItem* getCurrentMenuItem();
127 bool inSettingsMenu();
128 bool setupKitGlobalFXMenu;
129 bool exitUI() override {
130 exitCompletely();
131 return true;
132 };
133 void exitCompletely();
134 void goUpOneLevel();
135 void enterSubmenu(MenuItem* newItem);
136 bool pcReceivedForMidiLearn(MIDICable& cable, int32_t channel, int32_t program) override;
137 bool noteOnReceivedForMidiLearn(MIDICable& cable, int32_t channel, int32_t note, int32_t velocity) override;
138 void markInstrumentAsEdited();
139 bool editingCVOrMIDIClip();
140 bool editingNonAudioDrumRow();
141 bool editingMidiDrumRow();
142 bool editingGateDrumRow();
143 bool isUntransposedNoteWithinRange(int32_t noteCode);
144 void setCurrentMultiRange(int32_t i);
145 void possibleChangeToCurrentRangeDisplay();
146 MenuPermission checkPermissionToBeginSessionForRangeSpecificParam(Sound* sound, int32_t whichThing,
147 ::MultiRange** previouslySelectedRange);
148 void setupExclusiveShortcutBlink(int32_t x, int32_t y);
149 void setShortcutsVersion(int32_t newVersion);
150 ModelStackWithThreeMainThings* getCurrentModelStack(void* memory);
151
152 void cutSound();
153 AudioFileHolder* getCurrentAudioFileHolder();
154 void mpeZonesPotentiallyUpdated();
155
156 void renderOLED(deluge::hid::display::oled_canvas::Canvas& canvas) override;
157
158 // ui
159 UIType getUIType() override { return UIType::SOUND_EDITOR; }
160
161 bool selectedNoteRow;
162
163 // Note / Note Row Editor
164 bool inNoteEditor();
165 bool inNoteRowEditor();
166 void toggleNoteEditorParamMenu(int32_t on);
167 void updatePadLightsFor(MenuItem* item);
168
169private:
171 void setupShortcutsBlinkFromTable(MenuItem const* currentItem,
172 MenuItem const* const items[kDisplayWidth][kDisplayHeight]);
173 bool beginScreen(MenuItem* oldMenuItem = nullptr);
174 void endScreen();
175 uint8_t getActualParamFromScreen(uint8_t screen);
176 void setLedStates();
177 ActionResult handleAutomationViewPadAction(int32_t x, int32_t y, int32_t velocity);
178 bool isEditingAutomationViewParam();
179 void handlePotentialParamMenuChange(deluge::hid::Button b, bool on, bool inCardRoutine, MenuItem* previousItem,
180 MenuItem* currentItem);
181
182 uint8_t sourceShortcutBlinkFrequencies[2][kDisplayHeight];
183 uint8_t sourceShortcutBlinkColours[2][kDisplayHeight];
184};
185
186extern SoundEditor soundEditor;
Definition arpeggiator.h:46
Definition arpeggiator.h:318
Definition audio_file_holder.h:30
Definition clip.h:46
Definition drum.h:44
Definition instrument_clip.h:48
A MIDI cable connection. Stores all state specific to a given cable and its contained ports and chann...
Definition midi_device.h:94
Base class for all menu items.
Definition menu_item.h:39
Definition mod_controllable_audio.h:47
Definition model_stack.h:231
Definition multi_range.h:23
Definition multisample_range.h:27
Definition param_manager.h:174
Definition sample_controls.h:22
Definition sample_holder.h:32
Definition sidechain.h:27
Definition sound_editor.h:54
UIType getUIType() override
What type of UI is this? e.g. UIType::ARRANGER.
Definition sound_editor.h:159
bool exitUI() override
returns whether a UI exited
Definition sound_editor.h:129
void handlePotentialParamMenuChange(deluge::hid::Button b, bool on, bool inCardRoutine, MenuItem *previousItem, MenuItem *currentItem)
Definition sound_editor.cpp:566
void endScreen()
end current menu item session before beginning new menu item session or exiting the sound editor
Definition sound_editor.cpp:846
void setupShortcutsBlinkFromTable(MenuItem const *currentItem, MenuItem const *const items[kDisplayWidth][kDisplayHeight])
Setup shortcut blinking by finding the given menu item in the provided item map.
Definition sound_editor.cpp:703
Definition sound.h:71
Definition source.h:31
Definition submenu.h:29