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