fix: apply dB compression to waveform thumbnail display
Linear amplitude-to-pixel mapping made -20 dBFS content reach only 10% of cell height and -40 dBFS round to zero. Replace with a dB scale (floor kDisplayFloorDb = -60 dB, in bank_grid.h) so quiet content is visible. Pure helper compressAmplitudeForDisplay() lives in bank_grid; drawThumbnail() calls it. Five new unit tests cover full-scale, zero, mid-levels, floor clamping, and sign preservation.
This commit is contained in:
+2
-2
@@ -411,8 +411,8 @@ void drawThumbnail(LICE_IBitmap* bmp, const CellRect& rect, const Envelope& env,
|
||||
const int x = rect.x + 2 + (nbins > 1 ? (i * (innerW - 1)) / (nbins - 1) : 0);
|
||||
// min<=max always (peaks invariant). Draw a vertical line from the
|
||||
// min sample to the max sample, clamped to the band.
|
||||
int yMax = midY - static_cast<int>(bins[i].max * halfSpan); // max -> up
|
||||
int yMin = midY - static_cast<int>(bins[i].min * halfSpan); // min -> down
|
||||
int yMax = midY - static_cast<int>(compressAmplitudeForDisplay(bins[i].max) * halfSpan); // max -> up
|
||||
int yMin = midY - static_cast<int>(compressAmplitudeForDisplay(bins[i].min) * halfSpan); // min -> down
|
||||
if (yMax < bandTop) yMax = bandTop;
|
||||
if (yMin > bandTop + bandH - 1) yMin = bandTop + bandH - 1;
|
||||
LICE_Line(bmp, x, yMin, x, yMax, kColWaveform, 1.0f, 0, false);
|
||||
|
||||
Reference in New Issue
Block a user