From 558d849d277d0e485560aca09693d0ddc08a5451 Mon Sep 17 00:00:00 2001 From: itsmattkc Date: Thu, 8 Jul 2021 11:55:35 -0700 Subject: [PATCH] waveform: flip Y axis Fixes #1666 --- app/audio/audiovisualwaveform.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/app/audio/audiovisualwaveform.cpp b/app/audio/audiovisualwaveform.cpp index 277fa1c04..8905934ee 100644 --- a/app/audio/audiovisualwaveform.cpp +++ b/app/audio/audiovisualwaveform.cpp @@ -318,10 +318,12 @@ void AudioVisualWaveform::DrawSample(QPainter *painter, const Sample& sample, in } else { int channel_mid = y + channel_height * i + channel_half_height; + // We subtract the sample so that positive Y values go up on the screen rather than down, + // which is how waveforms are usually rendered painter->drawLine(x, - channel_mid + qRound(min * static_cast(channel_half_height)), + channel_mid - qRound(min * static_cast(channel_half_height)), x, - channel_mid + qRound(max * static_cast(channel_half_height))); + channel_mid - qRound(max * static_cast(channel_half_height))); } } }