From 18b22b58fb0f5a876608ba76e0595ed5228def07 Mon Sep 17 00:00:00 2001 From: f4exb Date: Sun, 6 Aug 2017 17:38:17 +0200 Subject: [PATCH] NFM modulator: pull a number of input audio samples depending on total interpolation. Fixes issue #43 --- plugins/channeltx/modnfm/nfmmod.cpp | 8 +++++--- plugins/channeltx/modnfm/nfmmod.h | 2 ++ plugins/channeltx/modnfm/nfmmodplugin.cpp | 2 +- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/plugins/channeltx/modnfm/nfmmod.cpp b/plugins/channeltx/modnfm/nfmmod.cpp index 7a9b4c61ff..1a7b8c520b 100644 --- a/plugins/channeltx/modnfm/nfmmod.cpp +++ b/plugins/channeltx/modnfm/nfmmod.cpp @@ -154,7 +154,7 @@ void NFMMod::pull(Sample& sample) void NFMMod::pullAudio(int nbSamples) { - unsigned int nbSamplesAudio = nbSamples * m_interpolatorDistance; + unsigned int nbSamplesAudio = nbSamples * ((Real) m_config.m_audioSampleRate / (Real) m_config.m_basebandSampleRate); if (nbSamplesAudio > m_audioBuffer.size()) { @@ -291,13 +291,15 @@ bool NFMMod::handleMessage(const Message& cmd) { UpChannelizer::MsgChannelizerNotification& notif = (UpChannelizer::MsgChannelizerNotification&) cmd; - m_config.m_outputSampleRate = notif.getSampleRate(); + m_config.m_basebandSampleRate = notif.getBasebandSampleRate(); + m_config.m_outputSampleRate = notif.getSampleRate(); m_config.m_inputFrequencyOffset = notif.getFrequencyOffset(); apply(); qDebug() << "NFMMod::handleMessage: MsgChannelizerNotification:" - << " m_outputSampleRate: " << m_config.m_outputSampleRate + << " m_basebandSampleRate: " << m_config.m_basebandSampleRate + << " m_outputSampleRate: " << m_config.m_outputSampleRate << " m_inputFrequencyOffset: " << m_config.m_inputFrequencyOffset; return true; diff --git a/plugins/channeltx/modnfm/nfmmod.h b/plugins/channeltx/modnfm/nfmmod.h index 595466b799..f7e848b729 100644 --- a/plugins/channeltx/modnfm/nfmmod.h +++ b/plugins/channeltx/modnfm/nfmmod.h @@ -293,6 +293,7 @@ class NFMMod : public BasebandSampleSource { }; struct Config { + int m_basebandSampleRate; int m_outputSampleRate; qint64 m_inputFrequencyOffset; Real m_rfBandwidth; @@ -307,6 +308,7 @@ class NFMMod : public BasebandSampleSource { float m_ctcssFrequency; Config() : + m_basebandSampleRate(0), m_outputSampleRate(-1), m_inputFrequencyOffset(0), m_rfBandwidth(-1), diff --git a/plugins/channeltx/modnfm/nfmmodplugin.cpp b/plugins/channeltx/modnfm/nfmmodplugin.cpp index 7e9ae6ce36..68b9cb7c48 100644 --- a/plugins/channeltx/modnfm/nfmmodplugin.cpp +++ b/plugins/channeltx/modnfm/nfmmodplugin.cpp @@ -23,7 +23,7 @@ const PluginDescriptor NFMModPlugin::m_pluginDescriptor = { QString("NFM Modulator"), - QString("3.5.0"), + QString("3.5.4"), QString("(c) Edouard Griffiths, F4EXB"), QString("https://github.com/f4exb/sdrangel"), true,