fix(waveform): 4x-oversampled min/max envelope, columnMinMax homed in peaks, panel routed through shared drawWaveform — one gap-free algorithm on all surfaces
This commit is contained in:
+14
-8
@@ -8,8 +8,7 @@
|
||||
|
||||
#include <cstddef>
|
||||
|
||||
#include "bank_grid.h" // compressAmplitudeForDisplay — the shared dB display curve (pure)
|
||||
#include "vst/waveform_view.h" // columnMinMax — per-pixel-column envelope merge (pure)
|
||||
#include "bank_grid.h" // compressAmplitudeForDisplay — the shared dB display curve (pure)
|
||||
|
||||
// SWELL / LICE. On Windows use native Win32 (windows.h first); on mac/linux SWELL is
|
||||
// provided by the host. Mirrors bank_panel.cpp's include discipline.
|
||||
@@ -278,6 +277,11 @@ void drawListRow(LICE_IBitmap* bmp, const ListRowBox& row, const char* label,
|
||||
}
|
||||
}
|
||||
|
||||
int waveformColumnCount(const KitBox& box) {
|
||||
const int w = box.width - 4; // fixed 2px inset each side (matches drawWaveform below)
|
||||
return w > 0 ? w : 0;
|
||||
}
|
||||
|
||||
void drawWaveform(LICE_IBitmap* bmp, const KitBox& box, const Envelope& env) {
|
||||
if (!bmp || box.empty()) return;
|
||||
|
||||
@@ -293,7 +297,7 @@ void drawWaveform(LICE_IBitmap* bmp, const KitBox& box, const Envelope& env) {
|
||||
|
||||
const int channels = static_cast<int>(env.size());
|
||||
const int bandH = box.height / channels;
|
||||
const int innerW = box.width - 4; // drawable pixel columns: box.x+2 .. box.x+2+innerW-1
|
||||
const int innerW = waveformColumnCount(box); // columns: box.x+2 .. box.x+2+innerW-1
|
||||
|
||||
for (int ch = 0; ch < channels; ++ch) {
|
||||
const ChannelEnvelope& bins = env[static_cast<std::size_t>(ch)];
|
||||
@@ -306,12 +310,14 @@ void drawWaveform(LICE_IBitmap* bmp, const KitBox& box, const Envelope& env) {
|
||||
|
||||
if (bins.empty() || innerW <= 0) continue;
|
||||
|
||||
// Render one filled vertical span per pixel column. columnMinMax merges all
|
||||
// bins that project to column `col` under the same partition as computeEnvelope,
|
||||
// so every pixel column is covered with no gaps regardless of the bins-to-pixels
|
||||
// ratio. Same dB display compression as the panel thumbnail (bank_grid, pure).
|
||||
// Render one filled vertical span per pixel column. peaks::columnMinMax merges
|
||||
// all bins that project to column `col` under the same partition as
|
||||
// computeEnvelope, so every pixel column is covered with no gaps regardless of
|
||||
// the bins-to-pixels ratio — callers oversample (kWaveformOversample bins per
|
||||
// column) so each span shows true extremes. Same dB display compression
|
||||
// everywhere (bank_grid, pure).
|
||||
for (int col = 0; col < innerW; ++col) {
|
||||
const MinMax mm = vst::columnMinMax(bins, innerW, col);
|
||||
const MinMax mm = columnMinMax(bins, innerW, col);
|
||||
const int x = box.x + 2 + col;
|
||||
int yMax = midY - static_cast<int>(
|
||||
compressAmplitudeForDisplay(mm.max) * halfSpan);
|
||||
|
||||
Reference in New Issue
Block a user