Deluge Firmware 1.3.0
Build date: 2025.09.27
Loading...
Searching...
No Matches
unpatched_param.h
1/*
2 * Copyright © 2017-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 "gui/menu_item/integer.h"
21#include "menu_item_with_cc_learning.h"
22#include "param.h"
23
25
26namespace deluge::gui::menu_item {
27
28class UnpatchedParam : public Param, public IntegerContinuous, public MenuItemWithCCLearning {
29public:
30 UnpatchedParam(l10n::String newName, l10n::String title, int32_t newP)
31 : Param(newP), IntegerContinuous(newName, title) {}
32 UnpatchedParam(l10n::String newName, l10n::String title, int32_t newP, NumberStyle style)
33 : Param(newP), IntegerContinuous(newName, title), number_style_{style} {}
34 UnpatchedParam(l10n::String newName, int32_t newP) : Param(newP), IntegerContinuous(newName) {}
35 UnpatchedParam(l10n::String newName, int32_t newP, NumberStyle style)
36 : Param(newP), IntegerContinuous(newName), number_style_{style} {}
37
38 bool usesAffectEntire() override { return true; }
39 void readCurrentValue() override;
40 void writeCurrentValue() override;
41 ParamDescriptor getLearningThing() final;
42 [[nodiscard]] int32_t getMaxValue() const override { return Param::getMaxValue(); }
43 [[nodiscard]] int32_t getMinValue() const override { return Param::getMinValue(); }
44 MenuItem* selectButtonPress() final { return Param::selectButtonPress(); }
45 // this button action function definition should not be required as it should be inherited
46 // from the param class, however it does not work if the definition is removed, so there
47 // is likely a multi-inheritance issue that needs to be resolved
48 ActionResult buttonAction(deluge::hid::Button b, bool on, bool inCardRoutine) final {
49 return Param::buttonAction(b, on, inCardRoutine);
50 }
51 void horizontalEncoderAction(int32_t offset) final { return Param::horizontalEncoderAction(offset); }
52
53 void unlearnAction() final { MenuItemWithCCLearning::unlearnAction(); }
54 bool allowsLearnMode() final { return MenuItemWithCCLearning::allowsLearnMode(); }
55 void learnKnob(MIDICable* cable, int32_t whichKnob, int32_t modKnobMode, int32_t midiChannel) final {
56 MenuItemWithCCLearning::learnKnob(cable, whichKnob, modKnobMode, midiChannel);
57 };
58
60 uint32_t getParamIndex();
61 ParamSet* getParamSet() final;
62 ModelStackWithAutoParam* getModelStack(void* memory) final;
63
64 int32_t getParamValue() {
66 return getValue();
67 }
68
69 [[nodiscard]] NumberStyle getNumberStyle() const override {
70 if (number_style_.has_value()) {
71 return number_style_.value();
72 }
73 return IntegerContinuous::getNumberStyle();
74 }
75
76protected:
77 virtual int32_t getFinalValue();
78
79private:
80 std::optional<NumberStyle> number_style_{std::nullopt};
81};
82
83} // namespace deluge::gui::menu_item
A MIDI cable connection. Stores all state specific to a given cable and its contained ports and chann...
Definition midi_device.h:94
deluge::l10n::String title
Can get overridden by getTitle(). Actual max num chars for OLED display is 14.
Definition menu_item.h:215
Definition model_stack.h:269
Definition param_descriptor.h:27
Definition param_set.h:36
void unlearnAction() final
Unlearn the parameter controlled by this menu.
Definition unpatched_param.h:53
void readCurrentValue() override
Like readValueAgain, but does not redraw.
Definition unpatched_param.cpp:36
MenuItem * selectButtonPress() final
Handle a select button press.
Definition unpatched_param.h:44
void horizontalEncoderAction(int32_t offset) final
Handle horizontal encoder movement.
Definition unpatched_param.h:51
ActionResult buttonAction(deluge::hid::Button b, bool on, bool inCardRoutine) final
Handle an arbitrary button.
Definition unpatched_param.h:48
bool allowsLearnMode() final
Used by SoundEditor to determine if the current menu item can accept MIDI learning.
Definition unpatched_param.h:54
bool usesAffectEntire() override
Claim support for Kit AFFECT_ENTIRE editing.
Definition unpatched_param.h:38
deluge::modulation::params::Kind getParamKind()
Definition unpatched_param.cpp:98
uint32_t getParamIndex()
Definition unpatched_param.cpp:103
void learnKnob(MIDICable *cable, int32_t whichKnob, int32_t modKnobMode, int32_t midiChannel) final
Definition unpatched_param.h:55
Kind
Definition param.h:42