Deluge Firmware
1.4.0
Build date: 2026.11.30
Toggle main menu visibility
Loading...
Searching...
No Matches
mic_velocity.h
1
/*
2
* Copyright © 2026 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 "gui/menu_item/menu_item.h"
22
#include "gui/menu_item/toggle.h"
23
#include "gui/ui/mic_velocity_calibration.h"
24
#include "gui/ui/mic_velocity_speakers.h"
25
#include "hid/mic_velocity/mic_velocity.h"
26
28
namespace
deluge::gui::menu_item::mic_velocity
{
29
31
class
Calibrate
final :
public
MenuItem {
32
public
:
33
using
MenuItem::MenuItem;
34
MenuItem*
selectButtonPress
()
override
{
35
openUI(&micVelocityCalibration);
36
return
NO_NAVIGATION;
37
}
38
bool
shouldEnterSubmenu
()
override
{
return
false
; }
39
};
40
42
class
CalibrateSpeakers
final :
public
MenuItem {
43
public
:
44
using
MenuItem::MenuItem;
45
MenuItem*
selectButtonPress
()
override
{
46
openUI(&micVelocitySpeakers);
47
return
NO_NAVIGATION;
48
}
49
bool
shouldEnterSubmenu
()
override
{
return
false
; }
50
};
51
53
class
Enabled
final :
public
Toggle
{
54
public
:
55
using
Toggle::Toggle;
56
void
readCurrentValue
()
override
{ this->setValue(
deluge::mic_velocity::enabled
); }
57
void
writeCurrentValue()
override
{
58
deluge::mic_velocity::enabled
= this->getValue();
59
deluge::mic_velocity::settingsChanged
();
60
deluge::mic_velocity::update
();
61
}
62
bool
isRelevant
(
ModControllableAudio
* modControllable, int32_t whichThing)
const override
{
63
return
deluge::mic_velocity::calibrated
();
64
}
65
};
66
68
class
MinVelocity
final :
public
Integer
{
69
public
:
70
using
Integer::Integer;
71
[[nodiscard]] int32_t getMinValue()
const override
{
return
1; }
72
[[nodiscard]] int32_t getMaxValue()
const override
{
return
127; }
73
void
readCurrentValue
()
override
{ this->setValue(
deluge::mic_velocity::curve
.minVelocity); }
74
void
writeCurrentValue()
override
{
75
deluge::mic_velocity::curve
.
minVelocity
= this->getValue();
76
deluge::mic_velocity::settingsChanged
();
77
}
78
};
79
81
class
MaxVelocity
final :
public
Integer
{
82
public
:
83
using
Integer::Integer;
84
[[nodiscard]] int32_t getMinValue()
const override
{
return
1; }
85
[[nodiscard]] int32_t getMaxValue()
const override
{
return
127; }
86
void
readCurrentValue
()
override
{ this->setValue(
deluge::mic_velocity::curve
.maxVelocity); }
87
void
writeCurrentValue()
override
{
88
deluge::mic_velocity::curve
.
maxVelocity
= this->getValue();
89
deluge::mic_velocity::settingsChanged
();
90
}
91
};
92
94
class
Curve
final :
public
Integer
{
95
public
:
96
using
Integer::Integer;
97
[[nodiscard]] int32_t getMinValue()
const override
{
return
dsp::mic_velocity::VelocityCurve::kMinShape; }
98
[[nodiscard]] int32_t getMaxValue()
const override
{
return
dsp::mic_velocity::VelocityCurve::kMaxShape; }
99
void
readCurrentValue
()
override
{ this->setValue(
deluge::mic_velocity::curve
.shape); }
100
void
writeCurrentValue()
override
{
101
deluge::mic_velocity::curve
.
shape
=
static_cast<
int8_t
>
(this->getValue());
102
deluge::mic_velocity::settingsChanged
();
103
}
104
};
105
106
}
// namespace deluge::gui::menu_item::mic_velocity
ModControllableAudio
Definition
mod_controllable_audio.h:47
deluge::gui::menu_item::Integer
Definition
integer.h:24
deluge::gui::menu_item::Toggle
Definition
toggle.h:8
deluge::gui::menu_item::mic_velocity::CalibrateSpeakers
With speakers on the line outputs, finds how far away they are (gui/ui/mic_velocity_speakers....
Definition
mic_velocity.h:42
deluge::gui::menu_item::mic_velocity::CalibrateSpeakers::shouldEnterSubmenu
bool shouldEnterSubmenu() override
Check if selecting this menu item (with select encoder) should enter a submenu.
Definition
mic_velocity.h:49
deluge::gui::menu_item::mic_velocity::CalibrateSpeakers::selectButtonPress
MenuItem * selectButtonPress() override
Handle a select button press.
Definition
mic_velocity.h:45
deluge::gui::menu_item::mic_velocity::Calibrate
Opens the calibration (gui/ui/mic_velocity_calibration.h).
Definition
mic_velocity.h:31
deluge::gui::menu_item::mic_velocity::Calibrate::selectButtonPress
MenuItem * selectButtonPress() override
Handle a select button press.
Definition
mic_velocity.h:34
deluge::gui::menu_item::mic_velocity::Calibrate::shouldEnterSubmenu
bool shouldEnterSubmenu() override
Check if selecting this menu item (with select encoder) should enter a submenu.
Definition
mic_velocity.h:38
deluge::gui::menu_item::mic_velocity::Curve
0 follows the tap's loudness; up makes lighter taps play louder, down takes harder taps to get high
Definition
mic_velocity.h:94
deluge::gui::menu_item::mic_velocity::Curve::readCurrentValue
void readCurrentValue() override
Like readValueAgain, but does not redraw.
Definition
mic_velocity.h:99
deluge::gui::menu_item::mic_velocity::Enabled
On or off. Only there once it's been calibrated (calibrating turns it on).
Definition
mic_velocity.h:53
deluge::gui::menu_item::mic_velocity::Enabled::isRelevant
bool isRelevant(ModControllableAudio *modControllable, int32_t whichThing) const override
Check if this MenuItem should show up in a containing deluge::gui::menu_item::Submenu.
Definition
mic_velocity.h:62
deluge::gui::menu_item::mic_velocity::Enabled::readCurrentValue
void readCurrentValue() override
Like readValueAgain, but does not redraw.
Definition
mic_velocity.h:56
deluge::gui::menu_item::mic_velocity::MaxVelocity
What the hardest calibrated tap (and anything harder) plays at.
Definition
mic_velocity.h:81
deluge::gui::menu_item::mic_velocity::MaxVelocity::readCurrentValue
void readCurrentValue() override
Like readValueAgain, but does not redraw.
Definition
mic_velocity.h:86
deluge::gui::menu_item::mic_velocity::MinVelocity
What the softest calibrated tap (and anything softer) plays at.
Definition
mic_velocity.h:68
deluge::gui::menu_item::mic_velocity::MinVelocity::readCurrentValue
void readCurrentValue() override
Like readValueAgain, but does not redraw.
Definition
mic_velocity.h:73
deluge::gui::menu_item::mic_velocity
Settings > Pads > Mic velocity (hid/mic_velocity/mic_velocity.h). The settings are saved on leaving t...
Definition
mic_velocity.h:28
deluge::mic_velocity::settingsChanged
void settingsChanged()
enabled or curve was changed (setCalibration notes it itself)
Definition
settings.cpp:118
deluge::mic_velocity::enabled
bool enabled
Enabled in the settings.
Definition
mic_velocity.cpp:31
deluge::mic_velocity::curve
dsp::mic_velocity::VelocityCurve curve
How tap strength maps onto velocity (the settings).
Definition
mic_velocity.cpp:33
deluge::mic_velocity::calibrated
bool calibrated()
The calibration presses are measured against, once there is one.
Definition
mic_velocity.cpp:208
deluge::mic_velocity::update
void update()
Definition
mic_velocity.cpp:236
deluge::dsp::mic_velocity::VelocityCurve::minVelocity
uint8_t minVelocity
What the softest calibrated tap (and anything softer) plays at.
Definition
velocity_map.h:76
deluge::dsp::mic_velocity::VelocityCurve::maxVelocity
uint8_t maxVelocity
Definition
velocity_map.h:77
deluge::dsp::mic_velocity::VelocityCurve::shape
int8_t shape
Definition
velocity_map.h:80