Deluge Firmware 1.3.0
Build date: 2025.08.12
Loading...
Searching...
No Matches
volume_global.h
1#pragma once
2
3#include <gui/menu_item/unpatched_param/updating_reverb_params.h>
4
5namespace deluge::gui::menu_item::sidechain {
7public:
8 using UpdatingReverbParams::UpdatingReverbParams;
9
10 bool showColumnLabel() const override { return false; }
11
12 void renderInHorizontalMenu(int32_t startX, int32_t width, int32_t startY, int32_t height) override {
13 oled_canvas::Canvas& image = OLED::main;
14
15 constexpr int32_t barWidth = 26;
16 constexpr int32_t dotsInterval = 4;
17 constexpr int32_t xOffset = 4;
18
19 const int32_t leftPadding = (width - barWidth) / 2;
20 const int32_t minX = startX + leftPadding;
21 const int32_t maxX = minX + barWidth;
22 const int32_t minY = startY + 3;
23 const int32_t maxY = startY + height - 4;
24
25 // Draw the dots at left and right sides
26 for (int32_t y = minY; y <= maxY; y += dotsInterval) {
27 if (y == minY + dotsInterval * 3) {
28 // small offset for better balance
29 y++;
30 }
31 image.drawPixel(minX + xOffset, y);
32 image.drawPixel(maxX - xOffset, y);
33 }
34
35 // Calculate shape height based on value
36 const float normalizedValue = getValue() / 50.0f;
37 const int32_t barHeight = maxY - minY;
38 const int32_t fillHeight = normalizedValue * barHeight;
39
40 const int32_t yOffset = (barHeight - fillHeight) / 2;
41 const int32_t yStart = minY + yOffset;
42 const int32_t yEnd = yStart + fillHeight;
43 const int32_t y0 = yEnd;
44 const int32_t y1 = yStart;
45
46 // Draw a sidechain level shape
47 image.drawLine(minX + xOffset, y0, maxX - xOffset, y1, true);
48 image.drawVerticalLine(minX + xOffset, yStart, yEnd);
49 image.drawVerticalLine(minX + xOffset + 1, yStart, yEnd);
50 image.drawHorizontalLine(y1 - 1, maxX - xOffset, maxX - 1);
51 image.drawHorizontalLine(y1, maxX - xOffset, maxX - 1);
52 image.drawHorizontalLine(y1 - 1, minX + 1, minX + xOffset + 1);
53 image.drawHorizontalLine(y1, minX + 1, minX + xOffset + 1);
54 }
55};
56} // namespace deluge::gui::menu_item::sidechain
bool showColumnLabel() const override
Show a label for the parameter in Horizontal menu.
Definition volume_global.h:10