@@ -13,10 +13,13 @@ class RDSDemod : public dsp::Processor<dsp::complex_t, uint8_t> {
1313 using base_type = dsp::Processor<dsp::complex_t , uint8_t >;
1414public:
1515 RDSDemod () {}
16- RDSDemod (dsp::stream<dsp::complex_t >* in) { init (in); }
16+ RDSDemod (dsp::stream<dsp::complex_t >* in, bool enableSoft ) { init (in, enableSoft ); }
1717 ~RDSDemod () {}
1818
19- void init (dsp::stream<dsp::complex_t >* in) {
19+ void init (dsp::stream<dsp::complex_t >* in, bool enableSoft) {
20+ // Save config
21+ this ->enableSoft = enableSoft;
22+
2023 // Initialize the DSP
2124 agc.init (NULL , 1.0 , 1e6 , 0.1 );
2225 costas.init (NULL , 0 .005f );
@@ -37,6 +40,14 @@ class RDSDemod : public dsp::Processor<dsp::complex_t, uint8_t> {
3740 base_type::init (in);
3841 }
3942
43+ void setSoftEnabled (bool enable) {
44+ assert (base_type::_block_init);
45+ std::lock_guard<std::recursive_mutex> lck (base_type::ctrlMtx);
46+ base_type::tempStop ();
47+ enableSoft = enable;
48+ base_type::tempStart ();
49+ }
50+
4051 void reset () {
4152 assert (base_type::_block_init);
4253 std::lock_guard<std::recursive_mutex> lck (base_type::ctrlMtx);
@@ -70,13 +81,17 @@ class RDSDemod : public dsp::Processor<dsp::complex_t, uint8_t> {
7081
7182 base_type::_in->flush ();
7283 if (!base_type::out.swap (count)) { return -1 ; }
73- if (!soft.swap (count)) { return -1 ; }
84+ if (enableSoft) {
85+ if (!soft.swap (count)) { return -1 ; }
86+ }
7487 return count;
7588 }
7689
7790 dsp::stream<float > soft;
7891
7992private:
93+ bool enableSoft = false ;
94+
8095 dsp::loop::FastAGC<dsp::complex_t > agc;
8196 dsp::loop::Costas<2 > costas;
8297 dsp::tap<dsp::complex_t > taps;
0 commit comments