mirror of
https://github.com/f4exb/sdrangel.git
synced 2024-11-10 10:33:29 -05:00
AM demod: move channelizer and threaded channelizer from GUI to demod
This commit is contained in:
parent
95891164d5
commit
ff5e233eb0
@ -26,12 +26,16 @@
|
|||||||
#include "audio/audiooutput.h"
|
#include "audio/audiooutput.h"
|
||||||
#include "dsp/dspengine.h"
|
#include "dsp/dspengine.h"
|
||||||
#include "dsp/pidcontroller.h"
|
#include "dsp/pidcontroller.h"
|
||||||
|
#include "dsp/threadedbasebandsamplesink.h"
|
||||||
|
#include "device/devicesourceapi.h"
|
||||||
|
|
||||||
MESSAGE_CLASS_DEFINITION(AMDemod::MsgConfigureAMDemod, Message)
|
MESSAGE_CLASS_DEFINITION(AMDemod::MsgConfigureAMDemod, Message)
|
||||||
|
MESSAGE_CLASS_DEFINITION(AMDemod::MsgConfigureChannelizer, Message)
|
||||||
|
|
||||||
const int AMDemod::m_udpBlockSize = 512;
|
const int AMDemod::m_udpBlockSize = 512;
|
||||||
|
|
||||||
AMDemod::AMDemod() :
|
AMDemod::AMDemod(DeviceSourceAPI *deviceAPI) :
|
||||||
|
m_deviceAPI(deviceAPI),
|
||||||
m_squelchOpen(false),
|
m_squelchOpen(false),
|
||||||
m_magsqSum(0.0f),
|
m_magsqSum(0.0f),
|
||||||
m_magsqPeak(0.0f),
|
m_magsqPeak(0.0f),
|
||||||
@ -43,6 +47,10 @@ AMDemod::AMDemod() :
|
|||||||
{
|
{
|
||||||
setObjectName("AMDemod");
|
setObjectName("AMDemod");
|
||||||
|
|
||||||
|
m_channelizer = new DownChannelizer(this);
|
||||||
|
m_threadedChannelizer = new ThreadedBasebandSampleSink(m_channelizer, this);
|
||||||
|
m_deviceAPI->addThreadedSink(m_threadedChannelizer);
|
||||||
|
|
||||||
m_audioBuffer.resize(1<<14);
|
m_audioBuffer.resize(1<<14);
|
||||||
m_audioBufferFill = 0;
|
m_audioBufferFill = 0;
|
||||||
|
|
||||||
@ -144,6 +152,16 @@ bool AMDemod::handleMessage(const Message& cmd)
|
|||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
else if (MsgConfigureChannelizer::match(cmd))
|
||||||
|
{
|
||||||
|
MsgConfigureChannelizer& cfg = (MsgConfigureChannelizer&) cmd;
|
||||||
|
|
||||||
|
m_channelizer->configure(m_channelizer->getInputMessageQueue(),
|
||||||
|
cfg.getSampleRate(),
|
||||||
|
cfg.getCenterFrequency());
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
else if (MsgConfigureAMDemod::match(cmd))
|
else if (MsgConfigureAMDemod::match(cmd))
|
||||||
{
|
{
|
||||||
MsgConfigureAMDemod& cfg = (MsgConfigureAMDemod&) cmd;
|
MsgConfigureAMDemod& cfg = (MsgConfigureAMDemod&) cmd;
|
||||||
|
@ -29,6 +29,10 @@
|
|||||||
#include "util/message.h"
|
#include "util/message.h"
|
||||||
#include "amdemodsettings.h"
|
#include "amdemodsettings.h"
|
||||||
|
|
||||||
|
class DeviceSourceAPI;
|
||||||
|
class DownChannelizer;
|
||||||
|
class ThreadedBasebandSampleSink;
|
||||||
|
|
||||||
class AMDemod : public BasebandSampleSink {
|
class AMDemod : public BasebandSampleSink {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
@ -55,7 +59,30 @@ public:
|
|||||||
{ }
|
{ }
|
||||||
};
|
};
|
||||||
|
|
||||||
AMDemod();
|
class MsgConfigureChannelizer : public Message {
|
||||||
|
MESSAGE_CLASS_DECLARATION
|
||||||
|
|
||||||
|
public:
|
||||||
|
int getSampleRate() const { return m_sampleRate; }
|
||||||
|
int getCenterFrequency() const { return m_centerFrequency; }
|
||||||
|
|
||||||
|
static MsgConfigureChannelizer* create(int sampleRate, int centerFrequency)
|
||||||
|
{
|
||||||
|
return new MsgConfigureChannelizer(sampleRate, centerFrequency);
|
||||||
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
int m_sampleRate;
|
||||||
|
int m_centerFrequency;
|
||||||
|
|
||||||
|
MsgConfigureChannelizer(int sampleRate, int centerFrequency) :
|
||||||
|
Message(),
|
||||||
|
m_sampleRate(sampleRate),
|
||||||
|
m_centerFrequency(centerFrequency)
|
||||||
|
{ }
|
||||||
|
};
|
||||||
|
|
||||||
|
AMDemod(DeviceSourceAPI *deviceAPI);
|
||||||
~AMDemod();
|
~AMDemod();
|
||||||
|
|
||||||
virtual void feed(const SampleVector::const_iterator& begin, const SampleVector::const_iterator& end, bool po);
|
virtual void feed(const SampleVector::const_iterator& begin, const SampleVector::const_iterator& end, bool po);
|
||||||
@ -82,6 +109,10 @@ private:
|
|||||||
RSRunning
|
RSRunning
|
||||||
};
|
};
|
||||||
|
|
||||||
|
DeviceSourceAPI *m_deviceAPI;
|
||||||
|
ThreadedBasebandSampleSink* m_threadedChannelizer;
|
||||||
|
DownChannelizer* m_channelizer;
|
||||||
|
|
||||||
AMDemodSettings m_settings;
|
AMDemodSettings m_settings;
|
||||||
|
|
||||||
NCO m_nco;
|
NCO m_nco;
|
||||||
|
@ -185,11 +185,7 @@ AMDemodGUI::AMDemodGUI(PluginAPI* pluginAPI, DeviceSourceAPI *deviceAPI, QWidget
|
|||||||
connect(this, SIGNAL(widgetRolled(QWidget*,bool)), this, SLOT(onWidgetRolled(QWidget*,bool)));
|
connect(this, SIGNAL(widgetRolled(QWidget*,bool)), this, SLOT(onWidgetRolled(QWidget*,bool)));
|
||||||
connect(this, SIGNAL(customContextMenuRequested(const QPoint &)), this, SLOT(onMenuDialogCalled(const QPoint &)));
|
connect(this, SIGNAL(customContextMenuRequested(const QPoint &)), this, SLOT(onMenuDialogCalled(const QPoint &)));
|
||||||
|
|
||||||
m_amDemod = new AMDemod();
|
m_amDemod = new AMDemod(m_deviceAPI);
|
||||||
m_channelizer = new DownChannelizer(m_amDemod);
|
|
||||||
m_threadedChannelizer = new ThreadedBasebandSampleSink(m_channelizer, this);
|
|
||||||
//m_pluginAPI->addThreadedSink(m_threadedChannelizer);
|
|
||||||
m_deviceAPI->addThreadedSink(m_threadedChannelizer);
|
|
||||||
|
|
||||||
connect(&m_pluginAPI->getMainWindow()->getMasterTimer(), SIGNAL(timeout()), this, SLOT(tick())); // 50 ms
|
connect(&m_pluginAPI->getMainWindow()->getMasterTimer(), SIGNAL(timeout()), this, SLOT(tick())); // 50 ms
|
||||||
|
|
||||||
@ -220,9 +216,6 @@ AMDemodGUI::AMDemodGUI(PluginAPI* pluginAPI, DeviceSourceAPI *deviceAPI, QWidget
|
|||||||
AMDemodGUI::~AMDemodGUI()
|
AMDemodGUI::~AMDemodGUI()
|
||||||
{
|
{
|
||||||
m_deviceAPI->removeChannelInstance(this);
|
m_deviceAPI->removeChannelInstance(this);
|
||||||
m_deviceAPI->removeThreadedSink(m_threadedChannelizer);
|
|
||||||
delete m_threadedChannelizer;
|
|
||||||
delete m_channelizer;
|
|
||||||
delete m_amDemod;
|
delete m_amDemod;
|
||||||
delete ui;
|
delete ui;
|
||||||
}
|
}
|
||||||
@ -238,9 +231,9 @@ void AMDemodGUI::applySettings(bool force)
|
|||||||
{
|
{
|
||||||
setTitleColor(m_channelMarker.getColor());
|
setTitleColor(m_channelMarker.getColor());
|
||||||
|
|
||||||
m_channelizer->configure(m_channelizer->getInputMessageQueue(),
|
AMDemod::MsgConfigureChannelizer* channelConfigMsg = AMDemod::MsgConfigureChannelizer::create(
|
||||||
48000,
|
48000, m_channelMarker.getCenterFrequency());
|
||||||
m_channelMarker.getCenterFrequency());
|
m_amDemod->getInputMessageQueue()->push(channelConfigMsg);
|
||||||
|
|
||||||
ui->deltaFrequency->setValue(m_channelMarker.getCenterFrequency());
|
ui->deltaFrequency->setValue(m_channelMarker.getCenterFrequency());
|
||||||
|
|
||||||
|
@ -60,8 +60,8 @@ private:
|
|||||||
AMDemodSettings m_settings;
|
AMDemodSettings m_settings;
|
||||||
bool m_doApplySettings;
|
bool m_doApplySettings;
|
||||||
|
|
||||||
ThreadedBasebandSampleSink* m_threadedChannelizer;
|
// ThreadedBasebandSampleSink* m_threadedChannelizer;
|
||||||
DownChannelizer* m_channelizer;
|
// DownChannelizer* m_channelizer;
|
||||||
AMDemod* m_amDemod;
|
AMDemod* m_amDemod;
|
||||||
bool m_squelchOpen;
|
bool m_squelchOpen;
|
||||||
uint32_t m_tickCount;
|
uint32_t m_tickCount;
|
||||||
|
Loading…
Reference in New Issue
Block a user