From c4ad938083e8c0941b84a5602d3ba23a2a64bb91 Mon Sep 17 00:00:00 2001 From: f4exb Date: Sat, 12 Sep 2015 09:46:51 +0200 Subject: [PATCH] Tried to fix NFM squelch again --- include-gpl/dsp/agc.h | 4 ++++ plugins/channel/nfm/nfmdemod.cpp | 4 ++-- sdrbase/dsp/agc.cpp | 2 +- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/include-gpl/dsp/agc.h b/include-gpl/dsp/agc.h index 7ed2e9356..2fe4175cb 100644 --- a/include-gpl/dsp/agc.h +++ b/include-gpl/dsp/agc.h @@ -22,6 +22,7 @@ public: Real getValue(); Real getDelayedValue(); virtual void feed(Complex& ci) = 0; + virtual Real returnedDelayedValue() const = 0; void openedSquelch(); void closedSquelch(); @@ -41,6 +42,7 @@ public: MagSquaredAGC(int historySize, Real R); virtual ~MagSquaredAGC(); virtual void feed(Complex& ci); + virtual Real returnedDelayedValue() const { return m_u0; } }; class MagAGC : public AGC @@ -50,6 +52,7 @@ public: MagAGC(int historySize, Real R); virtual ~MagAGC(); virtual void feed(Complex& ci); + virtual Real returnedDelayedValue() const { return m_u0; } }; class AlphaAGC : public AGC @@ -61,6 +64,7 @@ public: virtual ~AlphaAGC(); void resize(int historySize, Real R, Real alpha); virtual void feed(Complex& ci); + virtual Real returnedDelayedValue() const { return 1; } void openedSquelch(); void closedSquelch(); private: diff --git a/plugins/channel/nfm/nfmdemod.cpp b/plugins/channel/nfm/nfmdemod.cpp index 5f90c0a9a..596c56682 100644 --- a/plugins/channel/nfm/nfmdemod.cpp +++ b/plugins/channel/nfm/nfmdemod.cpp @@ -26,7 +26,7 @@ #include "dsp/pidcontroller.h" #include "dsp/dspengine.h" -static const Real afSqTones[2] = {1200.0, 8000.0}; // {1200.0, 8000.0}; +static const Real afSqTones[2] = {1200.0, 6000.0}; // {1200.0, 8000.0}; MESSAGE_CLASS_DEFINITION(NFMDemod::MsgConfigureNFMDemod, Message) @@ -218,7 +218,7 @@ void NFMDemod::feed(const SampleVector::const_iterator& begin, const SampleVecto { demod = m_bandpass.filter(demod); demod *= m_running.m_volume; - sample = demod * ((1<<19)/301) * m_AGC.getDelayedValue(); // denominator = bandpass filter number of taps + sample = demod * ((1<<18)/301) * m_AGC.getDelayedValue(); // denominator = bandpass filter number of taps } m_AGC.openedSquelch(); diff --git a/sdrbase/dsp/agc.cpp b/sdrbase/dsp/agc.cpp index 1cd0c0180..5630c993a 100644 --- a/sdrbase/dsp/agc.cpp +++ b/sdrbase/dsp/agc.cpp @@ -48,7 +48,7 @@ Real AGC::getDelayedValue() } else { - return 1; + return returnedDelayedValue(); } }