From 084fd7b0e98f5a80e8d786455a3eda8a2070a99b Mon Sep 17 00:00:00 2001 From: f4exb Date: Sun, 2 Apr 2023 03:39:39 +0200 Subject: [PATCH] Channel analyzer: engage rational down sampler also when no channel decimation takes place. Fixes #1622 --- .../channelrx/chanalyzer/chanalyzersink.cpp | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/plugins/channelrx/chanalyzer/chanalyzersink.cpp b/plugins/channelrx/chanalyzer/chanalyzersink.cpp index 18e31d8c4..eb5d88142 100644 --- a/plugins/channelrx/chanalyzer/chanalyzersink.cpp +++ b/plugins/channelrx/chanalyzer/chanalyzersink.cpp @@ -66,7 +66,20 @@ void ChannelAnalyzerSink::feed(const SampleVector::const_iterator& begin, const if (m_decimator.getDecim() == 1) { - processOneSample(c, sideband); + if (m_settings.m_rationalDownSample) + { + Complex cj; + + if (m_interpolator.decimate(&m_interpolatorDistanceRemain, c, &cj)) + { + processOneSample(cj, sideband); + m_interpolatorDistanceRemain += m_interpolatorDistance; + } + } + else + { + processOneSample(c, sideband); + } } else { @@ -311,6 +324,9 @@ void ChannelAnalyzerSink::applySettings(const ChannelAnalyzerSettings& settings, m_settings = settings; + qDebug() << "ChannelAnalyzerSink::applySettings:" + << " m_rationalDownSample: " << settings.m_rationalDownSample; + if (doApplySampleRate) { applySampleRate(); }