From 428ea9156c03d85abe9fdb88d514e6e8601785f9 Mon Sep 17 00:00:00 2001 From: Phil Taylor Date: Fri, 17 Feb 2023 18:08:44 +0000 Subject: [PATCH] Change way we set sidetone volume --- cwsidetone.cpp | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/cwsidetone.cpp b/cwsidetone.cpp index c8252b5..8425b7d 100644 --- a/cwsidetone.cpp +++ b/cwsidetone.cpp @@ -104,8 +104,6 @@ void cwSidetone::init() output = new QAudioSink(device,format); #endif - output->setVolume((qreal)volume/100.0); - #if (QT_VERSION < QT_VERSION_CHECK(6,0,0)) qInfo(logCW()) << QString("Sidetone Output: %0 (volume: %1 rate: %2 size: %3 type: %4)") .arg(device.deviceName()).arg(volume).arg(format.sampleRate()).arg(format.sampleSize()).arg(format.sampleType()); @@ -220,7 +218,7 @@ QByteArray cwSidetone::generateData(qint64 len, qint64 freq) int sampleIndex = 0; while (length) { - const qreal x = qSin(2 * M_PI * freq * qreal(sampleIndex % sampleRate) / sampleRate); + const qreal x = (qSin(2 * M_PI * freq * qreal(sampleIndex % sampleRate) / sampleRate)) * qreal(volume/100.0); for (int i=0; isetVolume((qreal)level/100.0); - } - }