Deluge Firmware 1.3.0
Build date: 2025.04.16
Loading...
Searching...
No Matches
integer.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/menu_item/integer.h"
20#include "gui/menu_item/patched_param.h"
21
22namespace deluge::gui::menu_item::patched_param {
23class Integer : public PatchedParam, public menu_item::IntegerContinuous {
24public:
25 Integer(l10n::String newName, int32_t newP = 0) : PatchedParam(newP), IntegerContinuous(newName) {}
26 Integer(l10n::String newName, l10n::String title, int32_t newP = 0)
27 : PatchedParam(newP), IntegerContinuous(newName, title) {}
28 // 7SEG Only
29 void drawValue() override { display->setTextAsNumber(this->getValue(), shouldDrawDotOnName()); }
30
31 bool usesAffectEntire() override { return true; }
32
33 ParamDescriptor getLearningThing() final { return PatchedParam::getLearningThing(); }
34 [[nodiscard]] int32_t getMaxValue() const override { return PatchedParam::getMaxValue(); }
35 [[nodiscard]] int32_t getMinValue() const override { return PatchedParam::getMinValue(); }
36 uint8_t shouldBlinkPatchingSourceShortcut(PatchSource s, uint8_t* colour) final {
37 return PatchedParam::shouldBlinkPatchingSourceShortcut(s, colour);
38 }
39
40 uint8_t shouldDrawDotOnName() final { return PatchedParam::shouldDrawDotOnName(); }
41 MenuItem* selectButtonPress() final { return PatchedParam::selectButtonPress(); }
42 // this button action function definition should not be required as it should be inherited
43 // from the param class, however it does not work if the definition is removed, so there
44 // is likely a multi-inheritance issue that needs to be resolved
45 ActionResult buttonAction(deluge::hid::Button b, bool on, bool inCardRoutine) final {
46 return PatchedParam::buttonAction(b, on, inCardRoutine);
47 }
48 void horizontalEncoderAction(int32_t offset) final { return PatchedParam::horizontalEncoderAction(offset); }
49
50 deluge::modulation::params::Kind getParamKind() final { return PatchedParam::getParamKind(); }
51 uint32_t getParamIndex() final { return PatchedParam::getParamIndex(); }
52 MenuItem* patchingSourceShortcutPress(PatchSource s, bool previousPressStillActive = false) final {
53 return PatchedParam::patchingSourceShortcutPress(s, previousPressStillActive);
54 }
55
56 void unlearnAction() final { MenuItemWithCCLearning::unlearnAction(); }
57 bool allowsLearnMode() final { return MenuItemWithCCLearning::allowsLearnMode(); }
58 void learnKnob(MIDICable* cable, int32_t whichKnob, int32_t modKnobMode, int32_t midiChannel) final {
59 MenuItemWithCCLearning::learnKnob(cable, whichKnob, modKnobMode, midiChannel);
60 };
61
62 int32_t getParamValue() {
64 return getValue();
65 }
66
67 void updateAutomationViewParameter() override;
68
69protected:
70 void readCurrentValue() override;
71 void writeCurrentValue() final;
72 virtual int32_t getFinalValue();
73};
74} // namespace deluge::gui::menu_item::patched_param
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:208
Definition param_descriptor.h:27
void updateAutomationViewParameter() override
Definition integer.cpp:84
void learnKnob(MIDICable *cable, int32_t whichKnob, int32_t modKnobMode, int32_t midiChannel) final
Definition integer.h:58
void horizontalEncoderAction(int32_t offset) final
Handle horizontal encoder movement.
Definition integer.h:48
bool usesAffectEntire() override
Claim support for Kit AFFECT_ENTIRE editing.
Definition integer.h:31
bool allowsLearnMode() final
Used by SoundEditor to determine if the current menu item can accept MIDI learning.
Definition integer.h:57
ActionResult buttonAction(deluge::hid::Button b, bool on, bool inCardRoutine) final
Handle an arbitrary button.
Definition integer.h:45
MenuItem * selectButtonPress() final
Handle a select button press.
Definition integer.h:41
uint8_t shouldBlinkPatchingSourceShortcut(PatchSource s, uint8_t *colour) final
Definition integer.h:36
void readCurrentValue() override
Like readValueAgain, but does not redraw.
Definition integer.cpp:33
MenuItem * patchingSourceShortcutPress(PatchSource s, bool previousPressStillActive=false) final
Action to take when a source shortcut is pressed.
Definition integer.h:52
void unlearnAction() final
Unlearn the parameter controlled by this menu.
Definition integer.h:56
Kind
Definition param.h:42