Deluge Firmware 1.3.0
Build date: 2026.10.14
Loading...
Searching...
No Matches
waveform_peak_math.h
Go to the documentation of this file.
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
23
24#pragma once
25
26#include <cstdint>
27#include <optional>
28
30
31namespace deluge::gui::waveform {
32
34constexpr int32_t kMaxScanSamplesLog2 = 9;
35
37struct Peak {
38 int32_t min;
39 int32_t max;
40};
41
55Peak scanPeak(const char* data, int32_t start, int32_t end, int32_t byte_depth, int32_t num_channels);
56
60int8_t coarsePeak(int32_t value);
61
70int32_t lastClusterEnd(uint64_t audio_bytes, uint32_t audio_start, int32_t cluster_size);
71
76int64_t clusterStart(int32_t index, int32_t size_log2);
77
88int32_t firstFrameOffset(int64_t cluster_start, uint32_t audio_start, int32_t frame_size);
89
101std::optional<int32_t> columnShift(int64_t delta, int64_t zoom, int32_t width);
102
118void remapColumns(WaveformRenderData& data, int64_t scroll, int64_t zoom);
119
120} // namespace deluge::gui::waveform
Definition waveform_render_data.h:33
Minimum and maximum of a run of raw 32-bit-aligned sample values.
Definition waveform_peak_math.h:37
int32_t min
Smallest value read.
Definition waveform_peak_math.h:38
int32_t max
Largest value read.
Definition waveform_peak_math.h:39
constexpr int32_t kMaxScanSamplesLog2
log2 of the most samples scanPeak() reads per call; longer spans are subsampled.
Definition waveform_peak_math.h:34