diff --git a/plugins/channelrx/chanalyzerng/chanalyzerng.cpp b/plugins/channelrx/chanalyzerng/chanalyzerng.cpp index 240b9e2a9..da208533f 100644 --- a/plugins/channelrx/chanalyzerng/chanalyzerng.cpp +++ b/plugins/channelrx/chanalyzerng/chanalyzerng.cpp @@ -37,6 +37,8 @@ ChannelAnalyzerNG::ChannelAnalyzerNG(BasebandSampleSink* sampleSink) : m_usb = true; m_ssb = true; m_magsq = 0; + m_interpolatorDistance = 1.0f; + m_interpolatorDistanceRemain = 0.0f; SSBFilter = new fftfilt(m_LowCutoff / m_running.m_inputSampleRate, m_Bandwidth / m_running.m_inputSampleRate, ssbFftLen); DSBFilter = new fftfilt(m_Bandwidth / m_running.m_inputSampleRate, 2*ssbFftLen); } @@ -214,6 +216,17 @@ void ChannelAnalyzerNG::apply(bool force) m_nco.setFreq(-m_config.m_frequency, m_config.m_inputSampleRate); } + if ((m_running.m_inputSampleRate != m_config.m_inputSampleRate) || + (m_running.m_channelSampleRate != m_config.m_channelSampleRate) || + force) + { + m_settingsMutex.lock(); + m_interpolator.create(16, m_config.m_inputSampleRate, m_config.m_inputSampleRate / 2.2); + m_interpolatorDistanceRemain = 0.0f; + m_interpolatorDistance = (Real) m_config.m_inputSampleRate / (Real) m_config.m_channelSampleRate; + m_settingsMutex.unlock(); + } + if ((m_running.m_channelSampleRate != m_config.m_channelSampleRate) || force) { diff --git a/plugins/channelrx/chanalyzerng/chanalyzerng.h b/plugins/channelrx/chanalyzerng/chanalyzerng.h index 7668233af..a00c7a224 100644 --- a/plugins/channelrx/chanalyzerng/chanalyzerng.h +++ b/plugins/channelrx/chanalyzerng/chanalyzerng.h @@ -20,6 +20,8 @@ #include #include #include + +#include "dsp/interpolator.h" #include "dsp/ncof.h" #include "dsp/fftfilt.h" #include "audio/audiofifo.h" @@ -115,6 +117,10 @@ private: Real m_magsq; NCOF m_nco; + Interpolator m_interpolator; + Real m_interpolatorDistance; + Real m_interpolatorDistanceRemain; + fftfilt* SSBFilter; fftfilt* DSBFilter;