1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2024-11-22 16:08:39 -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/pidcontroller.h"
#include "device/devicesinkapi.h"
#include "dsp/threadedbasebandsamplesource.h"
#include "nfmmod.h"
@ -74,12 +75,19 @@ NFMMod::NFMMod(DeviceSinkAPI *deviceAPI) :
m_cwKeyer.setMode(CWKeyer::CWNone);
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);
}
NFMMod::~NFMMod()
{
DSPEngine::instance()->removeAudioSource(&m_audioFifo);
m_deviceAPI->removeThreadedSource(m_threadedChannelizer);
delete m_threadedChannelizer;
delete m_channelizer;
}
void NFMMod::pull(Sample& sample)
@ -285,9 +293,9 @@ bool NFMMod::handleMessage(const Message& cmd)
{
MsgConfigureChannelizer& cfg = (MsgConfigureChannelizer&) cmd;
// m_channelizer->configure(m_channelizer->getInputMessageQueue(),
// cfg.getSampleRate(),
// cfg.getCenterFrequency());
m_channelizer->configure(m_channelizer->getInputMessageQueue(),
cfg.getSampleRate(),
cfg.getCenterFrequency());
qDebug() << "NFMMod::handleMessage: MsgConfigureChannelizer:"
<< " getSampleRate: " << cfg.getSampleRate()

View File

@ -21,16 +21,14 @@
#include <QDebug>
#include "device/devicesinkapi.h"
#include "dsp/upchannelizer.h"
#include "dsp/threadedbasebandsamplesource.h"
#include "ui_nfmmodgui.h"
#include "plugin/pluginapi.h"
#include "util/simpleserializer.h"
#include "util/db.h"
#include "gui/basicchannelsettingswidget.h"
#include "dsp/dspengine.h"
#include "mainwindow.h"
#include "ui_nfmmodgui.h"
#include "nfmmodgui.h"
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->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()));
@ -366,9 +360,6 @@ NFMModGUI::NFMModGUI(PluginAPI* pluginAPI, DeviceSinkAPI *deviceAPI, QWidget* pa
NFMModGUI::~NFMModGUI()
{
m_deviceAPI->removeChannelInstance(this);
m_deviceAPI->removeThreadedSource(m_threadedChannelizer);
delete m_threadedChannelizer;
delete m_channelizer;
delete m_nfmMod;
delete ui;
}
@ -384,9 +375,9 @@ void NFMModGUI::applySettings(bool force)
{
setTitleColor(m_channelMarker.getColor());
m_channelizer->configure(m_channelizer->getInputMessageQueue(),
48000,
m_channelMarker.getCenterFrequency());
NFMMod::MsgConfigureChannelizer *msgChan = NFMMod::MsgConfigureChannelizer::create(
48000, m_channelMarker.getCenterFrequency());
m_nfmMod->getInputMessageQueue()->push(msgChan);
ui->deltaFrequency->setValue(m_channelMarker.getCenterFrequency());

View File

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