1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2024-11-16 05:11:49 -05:00

NFM modulator: GUI and modulator separation phase 1 (3)

This commit is contained in:
f4exb 2017-10-12 21:51:25 +02:00
parent 2e5380e939
commit 76bdd497a7
3 changed files with 16 additions and 22 deletions

View File

@ -26,6 +26,7 @@
#include "dsp/dspengine.h" #include "dsp/dspengine.h"
#include "dsp/pidcontroller.h" #include "dsp/pidcontroller.h"
#include "device/devicesinkapi.h" #include "device/devicesinkapi.h"
#include "dsp/threadedbasebandsamplesource.h"
#include "nfmmod.h" #include "nfmmod.h"
@ -74,12 +75,19 @@ NFMMod::NFMMod(DeviceSinkAPI *deviceAPI) :
m_cwKeyer.setMode(CWKeyer::CWNone); m_cwKeyer.setMode(CWKeyer::CWNone);
m_cwSmoother.setNbFadeSamples(192); // 2 ms @ 48 kHz m_cwSmoother.setNbFadeSamples(192); // 2 ms @ 48 kHz
m_channelizer = new UpChannelizer(this);
m_threadedChannelizer = new ThreadedBasebandSampleSource(m_channelizer, this);
m_deviceAPI->addThreadedSource(m_threadedChannelizer);
applySettings(m_settings, true); applySettings(m_settings, true);
} }
NFMMod::~NFMMod() NFMMod::~NFMMod()
{ {
DSPEngine::instance()->removeAudioSource(&m_audioFifo); DSPEngine::instance()->removeAudioSource(&m_audioFifo);
m_deviceAPI->removeThreadedSource(m_threadedChannelizer);
delete m_threadedChannelizer;
delete m_channelizer;
} }
void NFMMod::pull(Sample& sample) void NFMMod::pull(Sample& sample)
@ -285,9 +293,9 @@ bool NFMMod::handleMessage(const Message& cmd)
{ {
MsgConfigureChannelizer& cfg = (MsgConfigureChannelizer&) cmd; MsgConfigureChannelizer& cfg = (MsgConfigureChannelizer&) cmd;
// m_channelizer->configure(m_channelizer->getInputMessageQueue(), m_channelizer->configure(m_channelizer->getInputMessageQueue(),
// cfg.getSampleRate(), cfg.getSampleRate(),
// cfg.getCenterFrequency()); cfg.getCenterFrequency());
qDebug() << "NFMMod::handleMessage: MsgConfigureChannelizer:" qDebug() << "NFMMod::handleMessage: MsgConfigureChannelizer:"
<< " getSampleRate: " << cfg.getSampleRate() << " getSampleRate: " << cfg.getSampleRate()

View File

@ -21,16 +21,14 @@
#include <QDebug> #include <QDebug>
#include "device/devicesinkapi.h" #include "device/devicesinkapi.h"
#include "dsp/upchannelizer.h"
#include "dsp/threadedbasebandsamplesource.h"
#include "ui_nfmmodgui.h"
#include "plugin/pluginapi.h" #include "plugin/pluginapi.h"
#include "util/simpleserializer.h" #include "util/simpleserializer.h"
#include "util/db.h" #include "util/db.h"
#include "gui/basicchannelsettingswidget.h" #include "gui/basicchannelsettingswidget.h"
#include "dsp/dspengine.h" #include "dsp/dspengine.h"
#include "mainwindow.h" #include "mainwindow.h"
#include "ui_nfmmodgui.h"
#include "nfmmodgui.h" #include "nfmmodgui.h"
const QString NFMModGUI::m_channelID = "sdrangel.channeltx.modnfm"; const QString NFMModGUI::m_channelID = "sdrangel.channeltx.modnfm";
@ -321,10 +319,6 @@ NFMModGUI::NFMModGUI(PluginAPI* pluginAPI, DeviceSinkAPI *deviceAPI, QWidget* pa
m_nfmMod = new NFMMod(m_deviceAPI); m_nfmMod = new NFMMod(m_deviceAPI);
m_nfmMod->setMessageQueueToGUI(getInputMessageQueue()); m_nfmMod->setMessageQueueToGUI(getInputMessageQueue());
m_channelizer = new UpChannelizer(m_nfmMod);
m_threadedChannelizer = new ThreadedBasebandSampleSource(m_channelizer, this);
//m_pluginAPI->addThreadedSink(m_threadedChannelizer);
m_deviceAPI->addThreadedSource(m_threadedChannelizer);
connect(&m_pluginAPI->getMainWindow()->getMasterTimer(), SIGNAL(timeout()), this, SLOT(tick())); connect(&m_pluginAPI->getMainWindow()->getMasterTimer(), SIGNAL(timeout()), this, SLOT(tick()));
@ -366,9 +360,6 @@ NFMModGUI::NFMModGUI(PluginAPI* pluginAPI, DeviceSinkAPI *deviceAPI, QWidget* pa
NFMModGUI::~NFMModGUI() NFMModGUI::~NFMModGUI()
{ {
m_deviceAPI->removeChannelInstance(this); m_deviceAPI->removeChannelInstance(this);
m_deviceAPI->removeThreadedSource(m_threadedChannelizer);
delete m_threadedChannelizer;
delete m_channelizer;
delete m_nfmMod; delete m_nfmMod;
delete ui; delete ui;
} }
@ -384,9 +375,9 @@ void NFMModGUI::applySettings(bool force)
{ {
setTitleColor(m_channelMarker.getColor()); setTitleColor(m_channelMarker.getColor());
m_channelizer->configure(m_channelizer->getInputMessageQueue(), NFMMod::MsgConfigureChannelizer *msgChan = NFMMod::MsgConfigureChannelizer::create(
48000, 48000, m_channelMarker.getCenterFrequency());
m_channelMarker.getCenterFrequency()); m_nfmMod->getInputMessageQueue()->push(msgChan);
ui->deltaFrequency->setValue(m_channelMarker.getCenterFrequency()); ui->deltaFrequency->setValue(m_channelMarker.getCenterFrequency());

View File

@ -28,9 +28,6 @@
class PluginAPI; class PluginAPI;
class DeviceSinkAPI; class DeviceSinkAPI;
class ThreadedBasebandSampleSource;
class UpChannelizer;
class NFMMod; class NFMMod;
namespace Ui { namespace Ui {
@ -95,8 +92,6 @@ private:
bool m_basicSettingsShown; bool m_basicSettingsShown;
bool m_doApplySettings; bool m_doApplySettings;
ThreadedBasebandSampleSource* m_threadedChannelizer;
UpChannelizer* m_channelizer;
NFMMod* m_nfmMod; NFMMod* m_nfmMod;
MovingAverage<double> m_channelPowerDbAvg; MovingAverage<double> m_channelPowerDbAvg;