From 7c21cf2339316024b3ed25f05b547ebab6f37268 Mon Sep 17 00:00:00 2001 From: itsmattkc Date: Fri, 23 Jul 2021 22:08:44 -0700 Subject: [PATCH] audio: fixed reversing issue --- app/audio/outputdeviceproxy.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/app/audio/outputdeviceproxy.cpp b/app/audio/outputdeviceproxy.cpp index 12b023a2e..f8da3cb05 100644 --- a/app/audio/outputdeviceproxy.cpp +++ b/app/audio/outputdeviceproxy.cpp @@ -114,10 +114,12 @@ qint64 AudioOutputDeviceProxy::ReverseAwareRead(char *data, qint64 maxlen) if (playback_speed_ < 0) { // If we're reversing, we'll seek back by maxlen bytes before we read - new_pos = device_->pos() - maxlen; + qint64 len_adjusted_by_channels = maxlen / params_.channel_count(); + + new_pos = device_->pos() - len_adjusted_by_channels; if (new_pos < 0) { - maxlen = device_->pos(); + maxlen = device_->pos() * params_.channel_count(); new_pos = 0; }