diff --git a/plugins/channelrx/demodft8/ft8demodsink.cpp b/plugins/channelrx/demodft8/ft8demodsink.cpp index be5a1c9ec..64e72afef 100644 --- a/plugins/channelrx/demodft8/ft8demodsink.cpp +++ b/plugins/channelrx/demodft8/ft8demodsink.cpp @@ -90,7 +90,6 @@ FT8DemodSink::FT8DemodSink() : m_magsqCount = 0; m_agc.setThresholdEnable(false); // no squelch - m_agc.setClamping(false); // no clamping SSBFilter = new fftfilt(m_LowCutoff / FT8DemodSettings::m_ft8SampleRate, m_Bandwidth / FT8DemodSettings::m_ft8SampleRate, m_ssbFftLen); diff --git a/plugins/channelrx/demodssb/ssbdemodsink.cpp b/plugins/channelrx/demodssb/ssbdemodsink.cpp index 7b1c453a2..de11cf690 100644 --- a/plugins/channelrx/demodssb/ssbdemodsink.cpp +++ b/plugins/channelrx/demodssb/ssbdemodsink.cpp @@ -76,9 +76,6 @@ SSBDemodSink::SSBDemodSink() : m_magsqCur = 0.0; m_magsqPrev = 0.0; - m_agc.setClampMax(SDR_RX_SCALED/100.0); - m_agc.setClamping(m_agcClamping); - SSBFilter = new fftfilt(m_LowCutoff / m_audioSampleRate, m_Bandwidth / m_audioSampleRate, m_ssbFftLen); DSBFilter = new fftfilt((2.0f * m_Bandwidth) / m_audioSampleRate, 2 * m_ssbFftLen); @@ -473,7 +470,6 @@ void SSBDemodSink::applySettings(const SSBDemodSettings& settings, bool force) if (m_agcClamping != agcClamping) { - m_agc.setClamping(agcClamping); m_agcClamping = agcClamping; } diff --git a/plugins/channelrx/udpsink/udpsinksink.cpp b/plugins/channelrx/udpsink/udpsinksink.cpp index f712c5246..ca95d47da 100644 --- a/plugins/channelrx/udpsink/udpsinksink.cpp +++ b/plugins/channelrx/udpsink/udpsinksink.cpp @@ -91,9 +91,6 @@ UDPSinkSink::UDPSinkSink() : qWarning("UDPSinkSink::UDPSinkSink: cannot bind audio port"); } - m_agc.setClampMax(SDR_RX_SCALED*SDR_RX_SCALED); - m_agc.setClamping(true); - //DSPEngine::instance()->addAudioSink(&m_audioFifo); applyChannelSettings(m_channelSampleRate, m_channelFrequencyOffset, true); @@ -338,7 +335,7 @@ void UDPSinkSink::audioReadyRead() uint res = m_audioFifo.write((const quint8*)&m_audioBuffer[0], m_audioBufferFill); if (res != m_audioBufferFill) { - qDebug("UDPSinkSink::audioReadyRead: (mono) lost %u samples", m_audioBufferFill - res); + qDebug("UDPSinkSink::audioReadyRead: (mono) lost %lu samples", m_audioBufferFill - res); } m_audioBufferFill = 0; diff --git a/sdrbase/dsp/agc.cpp b/sdrbase/dsp/agc.cpp index 6cf7b9b7e..1941481ec 100644 --- a/sdrbase/dsp/agc.cpp +++ b/sdrbase/dsp/agc.cpp @@ -63,9 +63,7 @@ MagAGC::MagAGC(int historySize, double R, double threshold) : m_stepDownCounter(0), m_gateCounter(0), m_stepDownDelay(historySize), - m_clamping(false), m_R2(R*R), - m_clampMax(1.0), m_hardLimiting(false) {} @@ -119,30 +117,7 @@ double MagAGC::feedAndGetValue(const Complex& ci) { m_magsq = ci.real()*ci.real() + ci.imag()*ci.imag(); m_moving_average.feed(m_magsq); - - if (m_clamping) - { - if (m_squared) - { - if (m_magsq > m_clampMax) { - m_u0 = m_clampMax / m_magsq; - } else { - m_u0 = m_R / m_moving_average.average(); - } - } - else - { - if (sqrt(m_magsq) > m_clampMax) { - m_u0 = m_clampMax / sqrt(m_magsq); - } else { - m_u0 = m_R / sqrt(m_moving_average.average()); - } - } - } - else - { - m_u0 = m_R / (m_squared ? m_moving_average.average() : sqrt(m_moving_average.average())); - } + m_u0 = m_R / (m_squared ? m_moving_average.average() : sqrt(m_moving_average.average())); if (m_thresholdEnable) { diff --git a/sdrbase/dsp/agc.h b/sdrbase/dsp/agc.h index ff721a6a6..62f3e3ebd 100644 --- a/sdrbase/dsp/agc.h +++ b/sdrbase/dsp/agc.h @@ -59,8 +59,6 @@ public: void setThresholdEnable(bool enable); void setGate(int gate) { m_gate = gate; m_gateCounter = 0; m_count = 0; } void setStepDownDelay(int stepDownDelay) { m_stepDownDelay = stepDownDelay; m_gateCounter = 0; m_count = 0; } - void setClamping(bool clamping) { m_clamping = clamping; } - void setClampMax(double clampMax) { m_clampMax = clampMax; } int getStepDownDelay() const { return m_stepDownDelay; } float getStepValue() const; void setHardLimiting(bool hardLimiting) { m_hardLimiting = hardLimiting; } @@ -78,9 +76,7 @@ private: int m_stepDownCounter; //!< step down transition samples counter int m_gateCounter; //!< threshold gate samples counter int m_stepDownDelay; //!< delay in samples before cutoff (release) - bool m_clamping; //!< clamping active double m_R2; //!< square of ordered magnitude - double m_clampMax; //!< maximum to clamp to as power value bool m_hardLimiting; //!< hard limit multiplier so that resulting sample magnitude does not exceed 1.0 double hardLimiter(double multiplier, double magsq);