Deluge Firmware 1.3.0
Build date: 2025.04.16
Loading...
Searching...
No Matches
y_axis_to_cc1.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/toggle.h"
19#include "model/instrument/midi_instrument.h"
20#include "model/song/song.h"
21
22extern Output* getCurrentOutput();
23extern Instrument* getCurrentInstrument();
24
25namespace deluge::gui::menu_item::midi {
26class MPEYToModWheel final : public Toggle {
27public:
28 using Toggle::Toggle;
29 // this is safe since it's only shown in midi clips
30 void readCurrentValue() override {
31 // awkward but this avoids needing to branch every time we output a cc
32 this->setValue(((MIDIInstrument*)getCurrentOutput())->outputMPEY == CC_EXTERNAL_MOD_WHEEL);
33 }
34 void writeCurrentValue() override {
35 ((MIDIInstrument*)getCurrentOutput())->outputMPEY =
36 this->getValue() ? CC_EXTERNAL_MOD_WHEEL : CC_EXTERNAL_MPE_Y;
37 getCurrentInstrument()->editedByUser = true;
38 }
39 bool isRelevant(ModControllableAudio* modControllable, int32_t whichThing) override {
40 // not relevant for cv
41 const auto type = getCurrentOutputType();
42 return (type == OutputType::MIDI_OUT);
43 }
44};
45} // namespace deluge::gui::menu_item::midi
Definition instrument.h:45
Definition midi_instrument.h:37
Definition mod_controllable_audio.h:47
Definition output.h:81
Definition toggle.h:8
void readCurrentValue() override
Like readValueAgain, but does not redraw.
Definition y_axis_to_cc1.h:30
bool isRelevant(ModControllableAudio *modControllable, int32_t whichThing) override
Check if this MenuItem should show up in a containing deluge::gui::menu_item::Submenu.
Definition y_axis_to_cc1.h:39