waveformview: corrected rectified waveform algorithm

Fixed bug where code erroneously multipled by full channel height. This is an
incorrect assumption since the full range of -1.0 to 1.0 is 2.0 which means the
difference needs to be halfed to create a range from 0.0 to 1.0.
This commit is contained in:
itsmattkc
2020-03-18 14:23:35 +11:00
parent 27d7822fa9
commit 5bdee74205
+2 -2
View File
@@ -69,7 +69,7 @@ void WaveformView::DrawWaveform(QPainter *painter, const QRect& rect, const doub
if (Config::Current()[QStringLiteral("RectifiedWaveforms")].toBool()) {
int channel_bottom = rect.y() + channel_height * (j + 1);
int diff = qRound((summary.at(j).max - summary.at(j).min) * channel_height);
int diff = qRound((summary.at(j).max - summary.at(j).min) * channel_half_height);
painter->drawLine(line_x,
channel_bottom - diff,
@@ -135,7 +135,7 @@ void WaveformView::paintEvent(QPaintEvent *event)
if (Config::Current()[QStringLiteral("RectifiedWaveforms")].toBool()) {
int channel_bottom = channel_height * (i + 1);
int diff = qRound((samples.at(i).max - samples.at(i).min) * channel_height);
int diff = qRound((samples.at(i).max - samples.at(i).min) * channel_half_height);
p.drawLine(x,
channel_bottom - diff,