Deluge Firmware 1.3.0
Build date: 2025.04.16
Loading...
Searching...
No Matches
waveform_renderer.h
1/*
2 * Copyright © 2018-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 "definitions_cxx.hpp"
21#include "gui/colour/colour.h"
22#include <cstdint>
23#include <optional>
24
25class Sample;
27class SampleRecorder;
29
31 int32_t pos; // Unscrolled
32 int32_t colOnScreen;
33};
34
35// This class provides low-level rendering functions for the waveform only
36
37class WaveformRenderer {
38public:
39 WaveformRenderer();
40
41 bool renderFullScreen(Sample* sample, uint64_t xScroll, uint64_t xZoom,
42 RGB thisImage[][kDisplayWidth + kSideBarWidth], WaveformRenderData* data,
43 SampleRecorder* recorder = nullptr, std::optional<RGB> rgb = std::nullopt,
44 bool reversed = false, int32_t xEnd = kDisplayWidth);
45 bool renderAsSingleRow(Sample* sample, int64_t xScroll, uint64_t xZoom, RGB* thisImage, WaveformRenderData* data,
46 SampleRecorder* recorder, RGB rgb, bool reversed, int32_t xStart, int32_t xEnd);
47 void renderOneCol(Sample* sample, int32_t xDisplay, RGB thisImage[][kDisplayWidth + kSideBarWidth],
48 WaveformRenderData* data, bool reversed = false, std::optional<RGB> rgb = std::nullopt);
49 void renderOneColForCollapseAnimation(int32_t xDisplay, int32_t xDisplayOutput, int32_t maxPeakFromZero,
50 int32_t progress, RGB thisImage[][kDisplayWidth + kSideBarWidth],
51 WaveformRenderData* data, std::optional<RGB> rgb, bool reversed,
52 int32_t valueCentrePoint, int32_t valueSpan);
53 void renderOneColForCollapseAnimationZoomedOut(int32_t xDisplayWaveformLeftEdge, int32_t xDisplayWaveformRightEdge,
54 int32_t xDisplayOutput, int32_t maxPeakFromZero, int32_t progress,
55 RGB thisImage[][kDisplayWidth + kSideBarWidth],
56 WaveformRenderData* data, std::optional<RGB> rgb, bool reversed,
57 int32_t valueCentrePoint, int32_t valueSpan);
58 bool findPeaksPerCol(Sample* sample, int64_t xScroll, uint64_t xZoom, WaveformRenderData* data,
59 SampleRecorder* recorder = nullptr, int32_t xStart = 0, int32_t xEnd = kDisplayWidth);
60
61 int8_t collapseAnimationToWhichRow;
62
63private:
64 int32_t getColBrightnessForSingleRow(int32_t xDisplay, int32_t maxPeakFromZero, WaveformRenderData* data);
65 void getColBarPositions(int32_t xDisplay, WaveformRenderData* data, int32_t* min24, int32_t* max24,
66 int32_t valueCentrePoint, int32_t valueSpan);
67 void drawColBar(int32_t xDisplay, int32_t min24, int32_t max24, RGB thisImage[][kDisplayWidth + kSideBarWidth],
68 int32_t brightness = 128, std::optional<RGB> rgb = std::nullopt);
69 void renderOneColForCollapseAnimationInterpolation(int32_t xDisplayOutput, int32_t min24, int32_t max24,
70 int32_t singleSquareBrightness, int32_t progress,
71 RGB thisImage[][kDisplayWidth + kSideBarWidth],
72 std::optional<RGB> rgb);
73};
74
75extern WaveformRenderer waveformRenderer;
Definition multisample_range.h:27
This class represents the colour format most used by the Deluge globally.
Definition rgb.h:14
Definition sample_recorder.h:49
Definition sample.h:50
Definition waveform_renderer.h:37
Definition waveform_renderer.h:30
Definition waveform_render_data.h:26