Deluge Firmware 1.3.0
Build date: 2025.11.04
Loading...
Searching...
No Matches
number.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 "value.h"
21#include <cstdint>
22
23namespace deluge::gui::menu_item {
24
25enum RenderingStyle {
26 NUMBER,
27 KNOB,
28 BAR,
29 PERCENT,
30 SLIDER,
31 LENGTH_SLIDER,
32 PAN,
33 LPF,
34 HPF,
35 ATTACK,
36 RELEASE,
37 SIDECHAIN_DUCKING
38};
39
40class Number : public Value<int32_t> {
41public:
42 using Value::Value;
43 void drawHorizontalBar(int32_t y_top, int32_t margin_l, int32_t margin_r = -1, int32_t height = 8);
44
45protected:
46 [[nodiscard]] virtual int32_t getMaxValue() const = 0;
47 [[nodiscard]] virtual int32_t getMinValue() const { return 0; }
48 [[nodiscard]] virtual RenderingStyle getRenderingStyle() const { return KNOB; }
49 virtual float normalize(int32_t value);
50
51 // Horizontal menus ------
52 void renderInHorizontalMenu(const HorizontalMenuSlotParams& slot) override;
53 void drawKnob(const HorizontalMenuSlotParams& slot);
54 void drawBar(const HorizontalMenuSlotParams& slot);
55 void drawPercent(const HorizontalMenuSlotParams& slot);
56 void drawSlider(const HorizontalMenuSlotParams& slot, std::optional<int32_t> value = std::nullopt);
57 void drawLengthSlider(const HorizontalMenuSlotParams& slot, bool min_slider_pos = 3);
58 void drawPan(const HorizontalMenuSlotParams& slot);
59 void drawLpf(const HorizontalMenuSlotParams& slot);
60 void drawHpf(const HorizontalMenuSlotParams& slot);
61 void drawAttack(const HorizontalMenuSlotParams& slot);
62 void drawRelease(const HorizontalMenuSlotParams& slot);
63 void drawSidechainDucking(const HorizontalMenuSlotParams& slot);
64 void getNotificationValue(StringBuf& value) override;
65};
66
67} // namespace deluge::gui::menu_item
Definition d_stringbuf.h:16
Definition number.h:40
void getNotificationValue(StringBuf &value) override
Get the parameter value string to show in the popup.
Definition number.cpp:445
Definition value.h:29
Definition menu_item.h:33