From 06210ae825a197c5b8ea658f3eabbd4144540845 Mon Sep 17 00:00:00 2001 From: AlexandreRouma Date: Thu, 7 Jul 2022 00:45:15 +0200 Subject: [PATCH] Fixed RDS not enabled when in mono even if RDS checkbox checked --- core/src/dsp/demod/broadcast_fm.h | 25 ++++++++++++++++++++ sink_modules/android_audio_sink/src/main.cpp | 5 ++-- 2 files changed, 27 insertions(+), 3 deletions(-) diff --git a/core/src/dsp/demod/broadcast_fm.h b/core/src/dsp/demod/broadcast_fm.h index 7eff4472..df6ae2b7 100644 --- a/core/src/dsp/demod/broadcast_fm.h +++ b/core/src/dsp/demod/broadcast_fm.h @@ -188,6 +188,31 @@ namespace dsp::demod { convert::LRToStereo::process(count, l, r, out); } else { + // Process RDS if needed. Note: find a way to not have to copy half the code from the stereo demod + if (_rdsOut) { + // Convert to complex + rtoc.process(count, demod.out.writeBuf, rtoc.out.writeBuf); + + // Filter out pilot and run through PLL + pilotFir.process(count, rtoc.out.writeBuf, pilotFir.out.writeBuf); + pilotPLL.process(count, pilotFir.out.writeBuf, pilotPLL.out.writeBuf); + + // Delay + lprDelay.process(count, demod.out.writeBuf, demod.out.writeBuf); + lmrDelay.process(count, rtoc.out.writeBuf, rtoc.out.writeBuf); + + // conjugate PLL output to down convert twice the L-R signal + math::Conjugate::process(count, pilotPLL.out.writeBuf, pilotPLL.out.writeBuf); + math::Multiply::process(count, rtoc.out.writeBuf, pilotPLL.out.writeBuf, rtoc.out.writeBuf); + math::Multiply::process(count, rtoc.out.writeBuf, pilotPLL.out.writeBuf, rtoc.out.writeBuf); + + // Since the PLL output is no longer needed after this, use it as the output + math::Multiply::process(count, rtoc.out.writeBuf, pilotPLL.out.writeBuf, pilotPLL.out.writeBuf); + convert::ComplexToReal::process(count, pilotPLL.out.writeBuf, rdsout); + volk_32f_s32f_multiply_32f(rdsout, rdsout, 100.0, count); + rdsOutCount = rdsResamp.process(count, rdsout, rdsout); + } + // Filter if needed if (_lowPass) { alFir.process(count, demod.out.writeBuf, demod.out.writeBuf); diff --git a/sink_modules/android_audio_sink/src/main.cpp b/sink_modules/android_audio_sink/src/main.cpp index 4a289063..c32c5783 100644 --- a/sink_modules/android_audio_sink/src/main.cpp +++ b/sink_modules/android_audio_sink/src/main.cpp @@ -3,8 +3,7 @@ #include #include #include -#include -#include +#include #include #include #include @@ -125,7 +124,7 @@ private: AAudioStream *stream = NULL; SinkManager::Stream* _stream; - dsp::Packer packer; + dsp::buffer::Packer packer; std::string _streamName; double sampleRate;