Deluge Firmware
1.3.0
Build date: 2026.08.23
Toggle main menu visibility
Loading...
Searching...
No Matches
patch_cable_strength.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
#include "decimal.h"
20
#include "gui/menu_item/automation/automation.h"
21
#include "menu_item_with_cc_learning.h"
22
23
#include <gui/ui/sound_editor.h>
24
#include <modulation/patch/patch_cable.h>
25
class
MultiRange
;
26
27
namespace
deluge::gui::menu_item {
28
29
class
PatchCableStrength
:
public
Decimal
,
public
MenuItemWithCCLearning,
public
Automation
{
30
public
:
31
using
Decimal::Decimal;
32
void
beginSession
(MenuItem* navigatedBackwardFrom)
final
;
33
void
endSession
()
final
;
34
void
readCurrentValue
()
final
;
35
void
writeCurrentValue()
override
;
36
[[nodiscard]] int32_t getMinValue()
const
final
{
return
kMinMenuPatchCableValue; }
37
[[nodiscard]] int32_t getMaxValue()
const
final
{
return
kMaxMenuPatchCableValue; }
38
[[nodiscard]] int32_t getNumDecimalPlaces()
const
final
{
return
2; }
39
virtual
int32_t getDefaultEditPos() {
return
2; }
40
MenuPermission checkPermissionToBeginSession(
ModControllableAudio
* modControllable, int32_t whichThing,
41
MultiRange
** currentRange)
override
;
42
virtual
ParamDescriptor
getDestinationDescriptor() = 0;
43
virtual
PatchSource getS() = 0;
44
uint8_t
getIndexOfPatchedParamToBlink
()
final
;
45
MenuItem*
selectButtonPress
()
final
;
46
ActionResult
buttonAction
(hid::Button b,
bool
on,
bool
inCardRoutine)
override
;
47
void
selectEncoderAction
(int32_t offset)
override
;
48
void
horizontalEncoderAction
(int32_t offset)
override
;
49
50
modulation::params::Kind
getParamKind
();
51
uint32_t
getParamIndex
();
52
PatchSource getPatchSource()
override
;
53
54
// OLED Only
55
void
renderOLED
()
override
;
56
// 7SEG only
57
void
appendAdditionalDots(std::vector<uint8_t>& dotPositions)
override
;
58
59
void
unlearnAction
() final { MenuItemWithCCLearning::unlearnAction(); }
60
bool
allowsLearnMode
() final {
return
MenuItemWithCCLearning::allowsLearnMode(); }
61
void
learnKnob
(
MIDICable
* cable, int32_t whichKnob, int32_t modKnobMode, int32_t midiChannel)
final
{
62
MenuItemWithCCLearning::learnKnob(cable, whichKnob, modKnobMode, midiChannel);
63
};
64
65
ModelStackWithAutoParam
* getModelStackWithParam(
void
* memory)
override
;
66
68
uint32_t
delayHorizontalScrollUntil
= 0;
69
70
protected
:
71
ModelStackWithAutoParam
* getModelStack(
void
* memory,
bool
allowCreation =
false
);
72
void
getNotificationValue
(
StringBuf
& valueBuf)
override
{
return
valueBuf.appendFloat(getValue() / 100.0f, 2, 2); }
73
74
private
:
75
bool
isInHorizontalMenu()
const
;
76
void
setPatchCablePolarity(Polarity newPolarity);
77
void
updatePolarityUI();
78
Polarity polarity_in_the_ui_;
79
// if polarity is set before the patch cable is created then we'll need to update the patch cable when it exists
80
bool
patch_cable_exists_ =
false
;
81
};
82
83
}
// namespace deluge::gui::menu_item
MIDICable
A MIDI cable connection. Stores all state specific to a given cable and its contained ports and chann...
Definition
midi_device.h:96
ModControllableAudio
Definition
mod_controllable_audio.h:47
ModelStackWithAutoParam
Definition
model_stack.h:269
MultiRange
Definition
multi_range.h:23
ParamDescriptor
Definition
param_descriptor.h:27
StringBuf
Definition
d_stringbuf.h:16
deluge::gui::menu_item::Automation
Definition
automation.h:29
deluge::gui::menu_item::Decimal
Definition
decimal.h:24
deluge::gui::menu_item::MultiRange
Definition
multi_range.h:24
deluge::gui::menu_item::PatchCableStrength
Definition
patch_cable_strength.h:29
deluge::gui::menu_item::PatchCableStrength::buttonAction
ActionResult buttonAction(hid::Button b, bool on, bool inCardRoutine) override
Handle an arbitrary button.
Definition
patch_cable_strength.cpp:318
deluge::gui::menu_item::PatchCableStrength::getParamIndex
uint32_t getParamIndex()
Definition
patch_cable_strength.cpp:296
deluge::gui::menu_item::PatchCableStrength::selectButtonPress
MenuItem * selectButtonPress() final
Handle a select button press.
Definition
patch_cable_strength.cpp:304
deluge::gui::menu_item::PatchCableStrength::selectEncoderAction
void selectEncoderAction(int32_t offset) override
Handle select encoder movement.
Definition
patch_cable_strength.cpp:332
deluge::gui::menu_item::PatchCableStrength::getParamKind
modulation::params::Kind getParamKind()
Definition
patch_cable_strength.cpp:292
deluge::gui::menu_item::PatchCableStrength::learnKnob
void learnKnob(MIDICable *cable, int32_t whichKnob, int32_t modKnobMode, int32_t midiChannel) final
Definition
patch_cable_strength.h:61
deluge::gui::menu_item::PatchCableStrength::getNotificationValue
void getNotificationValue(StringBuf &valueBuf) override
Get the parameter value string to show in the popup.
Definition
patch_cable_strength.h:72
deluge::gui::menu_item::PatchCableStrength::endSession
void endSession() final
End an editing session with this menu item.
Definition
patch_cable_strength.cpp:69
deluge::gui::menu_item::PatchCableStrength::renderOLED
void renderOLED() override
Root rendering routine for OLED.
Definition
patch_cable_strength.cpp:76
deluge::gui::menu_item::PatchCableStrength::delayHorizontalScrollUntil
uint32_t delayHorizontalScrollUntil
Used when scrolling horizontally to briefly catch on min / max decimal number edit position.
Definition
patch_cable_strength.h:68
deluge::gui::menu_item::PatchCableStrength::allowsLearnMode
bool allowsLearnMode() final
Used by SoundEditor to determine if the current menu item can accept MIDI learning.
Definition
patch_cable_strength.h:60
deluge::gui::menu_item::PatchCableStrength::readCurrentValue
void readCurrentValue() final
Like readValueAgain, but does not redraw.
Definition
patch_cable_strength.cpp:194
deluge::gui::menu_item::PatchCableStrength::beginSession
void beginSession(MenuItem *navigatedBackwardFrom) final
Begin an editing session with this menu item.
Definition
patch_cable_strength.cpp:45
deluge::gui::menu_item::PatchCableStrength::getIndexOfPatchedParamToBlink
uint8_t getIndexOfPatchedParamToBlink() final
Definition
patch_cable_strength.cpp:284
deluge::gui::menu_item::PatchCableStrength::unlearnAction
void unlearnAction() final
Unlearn the parameter controlled by this menu.
Definition
patch_cable_strength.h:59
deluge::gui::menu_item::PatchCableStrength::horizontalEncoderAction
void horizontalEncoderAction(int32_t offset) override
Handle horizontal encoder movement.
Definition
patch_cable_strength.cpp:350
deluge::modulation::params::Kind
Kind
Definition
param.h:42