Skip to content

Commit

Permalink
NFM modulator: pull a number of input audio samples depending on tota…
Browse files Browse the repository at this point in the history
…l interpolation. Fixes issue #43
  • Loading branch information
f4exb committed Aug 6, 2017
1 parent fdfa435 commit 18b22b5
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
8 changes: 5 additions & 3 deletions plugins/channeltx/modnfm/nfmmod.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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())
{
Expand Down Expand Up @@ -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;
Expand Down
2 changes: 2 additions & 0 deletions plugins/channeltx/modnfm/nfmmod.h
Original file line number Diff line number Diff line change
Expand Up @@ -293,6 +293,7 @@ class NFMMod : public BasebandSampleSource {
};

struct Config {
int m_basebandSampleRate;
int m_outputSampleRate;
qint64 m_inputFrequencyOffset;
Real m_rfBandwidth;
Expand All @@ -307,6 +308,7 @@ class NFMMod : public BasebandSampleSource {
float m_ctcssFrequency;

Config() :
m_basebandSampleRate(0),
m_outputSampleRate(-1),
m_inputFrequencyOffset(0),
m_rfBandwidth(-1),
Expand Down
2 changes: 1 addition & 1 deletion plugins/channeltx/modnfm/nfmmodplugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit 18b22b5

Please sign in to comment.