From 4ecc0f18bb5c1b740d1e1542b690107cc9300e4b Mon Sep 17 00:00:00 2001 From: Edouard Griffiths Date: Thu, 10 Dec 2015 14:10:48 +0100 Subject: [PATCH] BFM demod: basic RDS demodulator test --- include/dsp/phaselock.h | 6 +++--- plugins/channel/bfm/bfmdemod.cpp | 7 ++++++- plugins/channel/bfm/bfmdemod.h | 3 +++ 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/include/dsp/phaselock.h b/include/dsp/phaselock.h index bd2fca44d..25fa7858f 100644 --- a/include/dsp/phaselock.h +++ b/include/dsp/phaselock.h @@ -146,10 +146,10 @@ public: protected: virtual void processPhase(Real *samples_out) const { - samples_out[0] = m_psin; // f Pilot + samples_out[0] = m_psin; // Pilot signal (f) // Generate double-frequency output. // sin(2*x) = 2 * sin(x) * cos(x) - samples_out[1] = 2.0 * m_psin * m_pcos; // 2f Pilot - samples_out[2] = sin(3.0 * m_phase); // 3f pilot + samples_out[1] = 2.0 * m_psin * m_pcos; // Pilot signal (2f) + samples_out[2] = m_phase; // Pilot phase } }; diff --git a/plugins/channel/bfm/bfmdemod.cpp b/plugins/channel/bfm/bfmdemod.cpp index f735d3597..eebeac730 100644 --- a/plugins/channel/bfm/bfmdemod.cpp +++ b/plugins/channel/bfm/bfmdemod.cpp @@ -141,6 +141,11 @@ void BFMDemod::feed(const SampleVector::const_iterator& begin, const SampleVecto m_sampleBuffer.push_back(Sample(demod * (1<<15), 0.0)); } + if (m_running.m_rdsActive) + { + m_rdsDemod.process(demod, m_pilotPLLSamples[2]); + } + Real sampleStereo; // Process stereo if stereo mode is selected @@ -151,7 +156,7 @@ void BFMDemod::feed(const SampleVector::const_iterator& begin, const SampleVecto if (m_running.m_showPilot) { - m_sampleBuffer.push_back(Sample(m_pilotPLLSamples[2] * (1<<15), 0.0)); // debug 57 kHz pilot + m_sampleBuffer.push_back(Sample(m_pilotPLLSamples[1] * (1<<15), 0.0)); // debug 38 kHz pilot } Complex s(demod*2.0*m_pilotPLLSamples[1], 0); diff --git a/plugins/channel/bfm/bfmdemod.h b/plugins/channel/bfm/bfmdemod.h index c3f0e4e77..659dfa0dc 100644 --- a/plugins/channel/bfm/bfmdemod.h +++ b/plugins/channel/bfm/bfmdemod.h @@ -30,6 +30,7 @@ #include "dsp/filterrc.h" #include "audio/audiofifo.h" #include "util/message.h" +#include "rdsdemod.h" #define rfFilterFftLength 1024 @@ -187,6 +188,8 @@ private: LowPassFilterRC m_deemphasisFilterY; static const Real default_deemphasis = 50.0; // 50 us + RDSDemod m_rdsDemod; + void apply(); };