mirror of
https://github.com/AlexandreRouma/SDRPlusPlus.git
synced 2025-07-09 10:35:21 +02:00
Radio CW demod bugfix + more cleanup
This commit is contained in:
@ -88,8 +88,11 @@ public:
|
||||
|
||||
// Load configuration for and enabled all demodulators
|
||||
EventHandler<dsp::stream<dsp::stereo_t>*> _demodOutputChangeHandler;
|
||||
EventHandler<float> _demodAfbwChangedHandler;
|
||||
_demodOutputChangeHandler.handler = demodOutputChangeHandler;
|
||||
_demodOutputChangeHandler.ctx = this;
|
||||
_demodAfbwChangedHandler.handler = demodAfbwChangedHandler;
|
||||
_demodAfbwChangedHandler.ctx = this;
|
||||
for (auto& demod : demods) {
|
||||
if (!demod) { continue; }
|
||||
|
||||
@ -104,7 +107,7 @@ public:
|
||||
bw = std::clamp<double>(bw, demod->getMinBandwidth(), demod->getMaxBandwidth());
|
||||
|
||||
// Initialize
|
||||
demod->init(name, &config, ifChain.getOutput(), bw, _demodOutputChangeHandler, stream.getSampleRate());
|
||||
demod->init(name, &config, ifChain.getOutput(), bw, _demodOutputChangeHandler, _demodAfbwChangedHandler, stream.getSampleRate());
|
||||
}
|
||||
|
||||
// Initialize audio DSP chain
|
||||
@ -614,6 +617,17 @@ private:
|
||||
_this->afChain.setInput(output);
|
||||
}
|
||||
|
||||
static void demodAfbwChangedHandler(float output, void* ctx) {
|
||||
RadioModule* _this = (RadioModule*)ctx;
|
||||
|
||||
float audioBW = std::min<float>(_this->selectedDemod->getMaxAFBandwidth(), _this->selectedDemod->getAFBandwidth(_this->bandwidth));
|
||||
audioBW = std::min<float>(audioBW, _this->audioSampleRate / 2.0);
|
||||
|
||||
_this->win.setCutoff(audioBW);
|
||||
_this->win.setTransWidth(audioBW);
|
||||
_this->resamp.block.updateWindow(&_this->win);
|
||||
}
|
||||
|
||||
static void ifChainOutputChangeHandler(dsp::stream<dsp::complex_t>* output, void* ctx) {
|
||||
RadioModule* _this = (RadioModule*)ctx;
|
||||
if (!_this->selectedDemod) { return; }
|
||||
|
Reference in New Issue
Block a user