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:
@@ -69,7 +69,7 @@ void WaveformView::DrawWaveform(QPainter *painter, const QRect& rect, const doub
|
|||||||
if (Config::Current()[QStringLiteral("RectifiedWaveforms")].toBool()) {
|
if (Config::Current()[QStringLiteral("RectifiedWaveforms")].toBool()) {
|
||||||
int channel_bottom = rect.y() + channel_height * (j + 1);
|
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,
|
painter->drawLine(line_x,
|
||||||
channel_bottom - diff,
|
channel_bottom - diff,
|
||||||
@@ -135,7 +135,7 @@ void WaveformView::paintEvent(QPaintEvent *event)
|
|||||||
if (Config::Current()[QStringLiteral("RectifiedWaveforms")].toBool()) {
|
if (Config::Current()[QStringLiteral("RectifiedWaveforms")].toBool()) {
|
||||||
int channel_bottom = channel_height * (i + 1);
|
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,
|
p.drawLine(x,
|
||||||
channel_bottom - diff,
|
channel_bottom - diff,
|
||||||
|
|||||||
Reference in New Issue
Block a user