mirror of
				https://github.com/AlexandreRouma/SDRPlusPlus.git
				synced 2025-10-31 00:48:11 +01:00 
			
		
		
		
	disable rds symbol diagram data stream when not visible
This commit is contained in:
		| @@ -47,7 +47,7 @@ namespace demod { | ||||
|  | ||||
|             // Init DSP | ||||
|             demod.init(input, bandwidth / 2.0f, getIFSampleRate(), _stereo, _lowPass, _rds); | ||||
|             rdsDemod.init(&demod.rdsOut); | ||||
|             rdsDemod.init(&demod.rdsOut, _rdsInfo); | ||||
|             hs.init(&rdsDemod.out, rdsHandler, this); | ||||
|             reshape.init(&rdsDemod.soft, 4096, (1187 / 30) - 4096); | ||||
|             diagHandler.init(&reshape.out, _diagHandler, this); | ||||
| @@ -96,6 +96,7 @@ namespace demod { | ||||
|             // TODO: This will break when the entire radio module is disabled | ||||
|             if (!_rds) { ImGui::BeginDisabled(); } | ||||
|             if (ImGui::Checkbox(("Advanced RDS Info##_radio_wfm_rds_info_" + name).c_str(), &_rdsInfo)) { | ||||
|                 setAdvancedRds(_rdsInfo); | ||||
|                 _config->acquire(); | ||||
|                 _config->conf[name][getName()]["rdsInfo"] = _rdsInfo; | ||||
|                 _config->release(true); | ||||
| @@ -229,13 +230,17 @@ namespace demod { | ||||
|             demod.setStereo(_stereo); | ||||
|         } | ||||
|  | ||||
|         void setAdvancedRds(bool enabled) { | ||||
|             rdsDemod.setSoftEnabled(enabled); | ||||
|             _rdsInfo = enabled; | ||||
|         } | ||||
|  | ||||
|     private: | ||||
|         static void rdsHandler(uint8_t* data, int count, void* ctx) { | ||||
|             WFM* _this = (WFM*)ctx; | ||||
|             _this->rdsDecode.process(data, count); | ||||
|         } | ||||
|  | ||||
|         // DEBUGGING ONLY | ||||
|         static void _diagHandler(float* data, int count, void* ctx) { | ||||
|             WFM* _this = (WFM*)ctx; | ||||
|             float* buf = _this->diag.acquireBuffer(); | ||||
|   | ||||
| @@ -13,10 +13,13 @@ class RDSDemod : public dsp::Processor<dsp::complex_t, uint8_t> { | ||||
|     using base_type = dsp::Processor<dsp::complex_t, uint8_t>; | ||||
| public: | ||||
|     RDSDemod() {} | ||||
|     RDSDemod(dsp::stream<dsp::complex_t>* in) { init(in); } | ||||
|     RDSDemod(dsp::stream<dsp::complex_t>* in, bool enableSoft) { init(in, enableSoft); } | ||||
|     ~RDSDemod() {} | ||||
|  | ||||
|     void init(dsp::stream<dsp::complex_t>* in) { | ||||
|     void init(dsp::stream<dsp::complex_t>* in, bool enableSoft) { | ||||
|         // Save config | ||||
|         this->enableSoft = enableSoft; | ||||
|  | ||||
|         // Initialize the DSP | ||||
|         agc.init(NULL, 1.0, 1e6, 0.1); | ||||
|         costas.init(NULL, 0.005f); | ||||
| @@ -37,6 +40,14 @@ public: | ||||
|         base_type::init(in); | ||||
|     } | ||||
|  | ||||
|     void setSoftEnabled(bool enable) { | ||||
|         assert(base_type::_block_init); | ||||
|         std::lock_guard<std::recursive_mutex> lck(base_type::ctrlMtx); | ||||
|         base_type::tempStop(); | ||||
|         enableSoft = enable; | ||||
|         base_type::tempStart(); | ||||
|     } | ||||
|  | ||||
|     void reset() { | ||||
|         assert(base_type::_block_init); | ||||
|         std::lock_guard<std::recursive_mutex> lck(base_type::ctrlMtx); | ||||
| @@ -70,13 +81,17 @@ public: | ||||
|  | ||||
|         base_type::_in->flush(); | ||||
|         if (!base_type::out.swap(count)) { return -1; } | ||||
|         if (!soft.swap(count)) { return -1; } | ||||
|         if (enableSoft) { | ||||
|             if (!soft.swap(count)) { return -1; } | ||||
|         } | ||||
|         return count; | ||||
|     } | ||||
|  | ||||
|     dsp::stream<float> soft; | ||||
|  | ||||
| private: | ||||
|     bool enableSoft = false; | ||||
|      | ||||
|     dsp::loop::FastAGC<dsp::complex_t> agc; | ||||
|     dsp::loop::Costas<2> costas; | ||||
|     dsp::tap<dsp::complex_t> taps; | ||||
|   | ||||
		Reference in New Issue
	
	Block a user