diff --git a/plugins/channelrx/demoddatv/leansdr/sdr.h b/plugins/channelrx/demoddatv/leansdr/sdr.h index e56e85ff9..f658df9da 100644 --- a/plugins/channelrx/demoddatv/leansdr/sdr.h +++ b/plugins/channelrx/demoddatv/leansdr/sdr.h @@ -891,10 +891,11 @@ struct sampler_interface { } virtual complex interp(const complex *pin, float mu, float phase) = 0; - virtual void update_freq(float freqw, int period = 1) + + virtual void update_freq(float freqw, int weight = 0) { (void) freqw; - (void) period; + (void) weight; } // 65536 = 1 Hz virtual int readahead() = 0; }; @@ -940,9 +941,9 @@ struct linear_sampler : sampler_interface return s0 * (1 - mu) + s1 * mu; } - void update_freq(float _freqw, int period = 1) + void update_freq(float _freqw, int weight = 0) { - (void) period; + (void) weight; freqw = _freqw; } @@ -998,11 +999,14 @@ struct fir_sampler : sampler_interface return trig.expi(-phase) * acc; } - void update_freq(float freqw, int period) + void update_freq(float freqw, int weight = 0) { + if (!weight) { + update_freq_phase = 0; // Force refresh. + } // Throttling: Update one coeff per 16 processed samples, // to keep the overhead of freq tracking below about 10%. - update_freq_phase -= period; + update_freq_phase -= weight; if (update_freq_phase <= 0) {