Deluge Firmware 1.3.0
Build date: 2025.04.16
Loading...
Searching...
No Matches
audio_recorder.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/l10n/l10n.h"
19#include "gui/menu_item/menu_item.h"
20#include "gui/ui/audio_recorder.h"
21#include "gui/ui/sound_editor.h"
22#include "gui/ui_timer_manager.h"
23#include "processing/sound/sound.h"
24
25namespace deluge::gui::menu_item::osc {
26class AudioRecorder final : public MenuItem {
27public:
28 using MenuItem::MenuItem;
29 void beginSession(MenuItem* navigatedBackwardFrom) override {
30 soundEditor.shouldGoUpOneLevelOnBegin = true;
31 bool success = openUI(&audioRecorder);
32 if (!success) {
33 if (getCurrentUI() == &soundEditor) {
34 soundEditor.goUpOneLevel();
35 }
36 uiTimerManager.unsetTimer(TimerName::SHORTCUT_BLINK);
37 }
38 else {
39 audioRecorder.process();
40 }
41 }
42 bool isRelevant(ModControllableAudio* modControllable, int32_t whichThing) override {
43 Sound* sound = static_cast<Sound*>(modControllable);
44 Source* source = &sound->sources[whichThing];
45 return (sound->getSynthMode() == SynthMode::SUBTRACTIVE);
46 }
47
48 MenuPermission checkPermissionToBeginSession(ModControllableAudio* modControllable, int32_t whichThing,
49 ::MultiRange** currentRange) override {
50
51 bool can = isRelevant(modControllable, whichThing);
52 if (!can) {
53 display->displayPopup(l10n::get(l10n::String::STRING_FOR_CANT_RECORD_AUDIO_FM_MODE));
54 return MenuPermission::NO;
55 }
56
57 Sound* sound = static_cast<Sound*>(modControllable);
58
59 return soundEditor.checkPermissionToBeginSessionForRangeSpecificParam(sound, whichThing, currentRange);
60 }
61};
62} // namespace deluge::gui::menu_item::osc
Definition mod_controllable_audio.h:47
Definition sound.h:71
Definition source.h:31
Definition multi_range.h:24
Definition audio_recorder.h:26
bool isRelevant(ModControllableAudio *modControllable, int32_t whichThing) override
Check if this MenuItem should show up in a containing deluge::gui::menu_item::Submenu.
Definition audio_recorder.h:42
void beginSession(MenuItem *navigatedBackwardFrom) override
Begin an editing session with this menu item.
Definition audio_recorder.h:29