mirror of
https://github.com/f4exb/sdrangel.git
synced 2025-02-03 09:44:01 -05:00
WFM demod: separate GUI and demod phase 1
This commit is contained in:
parent
f9b426de69
commit
08cc475583
@ -15,34 +15,43 @@
|
|||||||
// along with this program. If not, see <http://www.gnu.org/licenses/>. //
|
// along with this program. If not, see <http://www.gnu.org/licenses/>. //
|
||||||
///////////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
#include "../../channelrx/demodwfm/wfmdemod.h"
|
|
||||||
|
|
||||||
#include <QTime>
|
#include <QTime>
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <complex.h>
|
#include <complex.h>
|
||||||
|
|
||||||
#include <dsp/downchannelizer.h>
|
#include <dsp/downchannelizer.h>
|
||||||
|
#include "dsp/threadedbasebandsamplesink.h"
|
||||||
|
#include <device/devicesourceapi.h>
|
||||||
#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 "wfmdemod.h"
|
||||||
|
|
||||||
MESSAGE_CLASS_DEFINITION(WFMDemod::MsgConfigureWFMDemod, Message)
|
MESSAGE_CLASS_DEFINITION(WFMDemod::MsgConfigureWFMDemod, Message)
|
||||||
MESSAGE_CLASS_DEFINITION(WFMDemod::MsgConfigureChannelizer, Message)
|
MESSAGE_CLASS_DEFINITION(WFMDemod::MsgConfigureChannelizer, Message)
|
||||||
|
|
||||||
WFMDemod::WFMDemod(BasebandSampleSink* sampleSink) :
|
WFMDemod::WFMDemod(DeviceSourceAPI* deviceAPI) :
|
||||||
|
m_deviceAPI(deviceAPI),
|
||||||
m_squelchOpen(false),
|
m_squelchOpen(false),
|
||||||
m_magsq(0.0f),
|
m_magsq(0.0f),
|
||||||
m_magsqSum(0.0f),
|
m_magsqSum(0.0f),
|
||||||
m_magsqPeak(0.0f),
|
m_magsqPeak(0.0f),
|
||||||
m_magsqCount(0),
|
m_magsqCount(0),
|
||||||
m_movingAverage(40, 0),
|
m_movingAverage(40, 0),
|
||||||
m_sampleSink(sampleSink),
|
m_sampleSink(0),
|
||||||
m_audioFifo(250000),
|
m_audioFifo(250000),
|
||||||
m_settingsMutex(QMutex::Recursive)
|
m_settingsMutex(QMutex::Recursive)
|
||||||
|
|
||||||
{
|
{
|
||||||
setObjectName("WFMDemod");
|
setObjectName("WFMDemod");
|
||||||
|
|
||||||
|
m_channelizer = new DownChannelizer(this);
|
||||||
|
m_threadedChannelizer = new ThreadedBasebandSampleSink(m_channelizer, this);
|
||||||
|
m_deviceAPI->addThreadedSink(m_threadedChannelizer);
|
||||||
|
|
||||||
m_rfFilter = new fftfilt(-50000.0 / 384000.0, 50000.0 / 384000.0, rfFilterFftLength);
|
m_rfFilter = new fftfilt(-50000.0 / 384000.0, 50000.0 / 384000.0, rfFilterFftLength);
|
||||||
m_phaseDiscri.setFMScaling(384000/75000);
|
m_phaseDiscri.setFMScaling(384000/75000);
|
||||||
|
|
||||||
@ -63,6 +72,10 @@ WFMDemod::~WFMDemod()
|
|||||||
}
|
}
|
||||||
|
|
||||||
DSPEngine::instance()->removeAudioSink(&m_audioFifo);
|
DSPEngine::instance()->removeAudioSink(&m_audioFifo);
|
||||||
|
|
||||||
|
m_deviceAPI->removeThreadedSink(m_threadedChannelizer);
|
||||||
|
delete m_threadedChannelizer;
|
||||||
|
delete m_channelizer;
|
||||||
}
|
}
|
||||||
|
|
||||||
void WFMDemod::feed(const SampleVector::const_iterator& begin, const SampleVector::const_iterator& end, bool firstOfBurst __attribute__((unused)))
|
void WFMDemod::feed(const SampleVector::const_iterator& begin, const SampleVector::const_iterator& end, bool firstOfBurst __attribute__((unused)))
|
||||||
|
@ -34,6 +34,10 @@
|
|||||||
|
|
||||||
#define rfFilterFftLength 1024
|
#define rfFilterFftLength 1024
|
||||||
|
|
||||||
|
class ThreadedBasebandSampleSink;
|
||||||
|
class DownChannelizer;
|
||||||
|
class DeviceSourceAPI;
|
||||||
|
|
||||||
class WFMDemod : public BasebandSampleSink {
|
class WFMDemod : public BasebandSampleSink {
|
||||||
public:
|
public:
|
||||||
class MsgConfigureWFMDemod : public Message {
|
class MsgConfigureWFMDemod : public Message {
|
||||||
@ -82,8 +86,9 @@ public:
|
|||||||
{ }
|
{ }
|
||||||
};
|
};
|
||||||
|
|
||||||
WFMDemod(BasebandSampleSink* sampleSink);
|
WFMDemod(DeviceSourceAPI *deviceAPI);
|
||||||
virtual ~WFMDemod();
|
virtual ~WFMDemod();
|
||||||
|
void setSampleSink(BasebandSampleSink* sampleSink) { m_sampleSink = sampleSink; }
|
||||||
|
|
||||||
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);
|
||||||
virtual void start();
|
virtual void start();
|
||||||
@ -110,7 +115,10 @@ private:
|
|||||||
RSRunning
|
RSRunning
|
||||||
};
|
};
|
||||||
|
|
||||||
WFMDemodSettings m_settings;
|
DeviceSourceAPI* m_deviceAPI;
|
||||||
|
ThreadedBasebandSampleSink* m_threadedChannelizer;
|
||||||
|
DownChannelizer* m_channelizer;
|
||||||
|
WFMDemodSettings m_settings;
|
||||||
|
|
||||||
NCO m_nco;
|
NCO m_nco;
|
||||||
Interpolator m_interpolator; //!< Interpolator between sample rate sent from DSP engine and requested RF bandwidth (rational)
|
Interpolator m_interpolator; //!< Interpolator between sample rate sent from DSP engine and requested RF bandwidth (rational)
|
||||||
|
@ -6,7 +6,6 @@
|
|||||||
#include <QMainWindow>
|
#include <QMainWindow>
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
|
|
||||||
#include "dsp/threadedbasebandsamplesink.h"
|
|
||||||
#include "ui_wfmdemodgui.h"
|
#include "ui_wfmdemodgui.h"
|
||||||
#include "dsp/dspengine.h"
|
#include "dsp/dspengine.h"
|
||||||
#include "plugin/pluginapi.h"
|
#include "plugin/pluginapi.h"
|
||||||
@ -173,10 +172,7 @@ WFMDemodGUI::WFMDemodGUI(PluginAPI* pluginAPI, DeviceSourceAPI *deviceAPI, QWidg
|
|||||||
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(menuDoubleClickEvent()), this, SLOT(onMenuDoubleClicked()));
|
connect(this, SIGNAL(menuDoubleClickEvent()), this, SLOT(onMenuDoubleClicked()));
|
||||||
|
|
||||||
m_wfmDemod = new WFMDemod(0);
|
m_wfmDemod = new WFMDemod(m_deviceAPI);
|
||||||
m_channelizer = new DownChannelizer(m_wfmDemod);
|
|
||||||
m_threadedChannelizer = new ThreadedBasebandSampleSink(m_channelizer, this);
|
|
||||||
m_deviceAPI->addThreadedSink(m_threadedChannelizer);
|
|
||||||
|
|
||||||
connect(&m_pluginAPI->getMainWindow()->getMasterTimer(), SIGNAL(timeout()), this, SLOT(tick()));
|
connect(&m_pluginAPI->getMainWindow()->getMasterTimer(), SIGNAL(timeout()), this, SLOT(tick()));
|
||||||
|
|
||||||
@ -193,6 +189,8 @@ WFMDemodGUI::WFMDemodGUI(PluginAPI* pluginAPI, DeviceSourceAPI *deviceAPI, QWidg
|
|||||||
m_deviceAPI->addChannelMarker(&m_channelMarker);
|
m_deviceAPI->addChannelMarker(&m_channelMarker);
|
||||||
m_deviceAPI->addRollupWidget(this);
|
m_deviceAPI->addRollupWidget(this);
|
||||||
|
|
||||||
|
m_settings.setChannelMarker(&m_channelMarker);
|
||||||
|
|
||||||
displaySettings();
|
displaySettings();
|
||||||
applySettings(true);
|
applySettings(true);
|
||||||
}
|
}
|
||||||
@ -200,9 +198,6 @@ WFMDemodGUI::WFMDemodGUI(PluginAPI* pluginAPI, DeviceSourceAPI *deviceAPI, QWidg
|
|||||||
WFMDemodGUI::~WFMDemodGUI()
|
WFMDemodGUI::~WFMDemodGUI()
|
||||||
{
|
{
|
||||||
m_deviceAPI->removeChannelInstance(this);
|
m_deviceAPI->removeChannelInstance(this);
|
||||||
m_deviceAPI->removeThreadedSink(m_threadedChannelizer);
|
|
||||||
delete m_threadedChannelizer;
|
|
||||||
delete m_channelizer;
|
|
||||||
delete m_wfmDemod;
|
delete m_wfmDemod;
|
||||||
//delete m_channelMarker;
|
//delete m_channelMarker;
|
||||||
delete ui;
|
delete ui;
|
||||||
@ -219,9 +214,10 @@ void WFMDemodGUI::applySettings(bool force)
|
|||||||
{
|
{
|
||||||
setTitleColor(m_channelMarker.getColor());
|
setTitleColor(m_channelMarker.getColor());
|
||||||
|
|
||||||
m_channelizer->configure(m_channelizer->getInputMessageQueue(),
|
WFMDemod::MsgConfigureChannelizer *msgChan = WFMDemod::MsgConfigureChannelizer::create(
|
||||||
requiredBW(WFMDemodSettings::getRFBW(ui->rfBW->currentIndex())), // TODO: this is where requested sample rate is specified
|
requiredBW(WFMDemodSettings::getRFBW(ui->rfBW->currentIndex())),
|
||||||
m_channelMarker.getCenterFrequency());
|
m_channelMarker.getCenterFrequency());
|
||||||
|
m_wfmDemod->getInputMessageQueue()->push(msgChan);
|
||||||
|
|
||||||
ui->deltaFrequency->setValue(m_channelMarker.getCenterFrequency());
|
ui->deltaFrequency->setValue(m_channelMarker.getCenterFrequency());
|
||||||
|
|
||||||
|
@ -12,8 +12,6 @@
|
|||||||
class PluginAPI;
|
class PluginAPI;
|
||||||
class DeviceSourceAPI;
|
class DeviceSourceAPI;
|
||||||
|
|
||||||
class ThreadedBasebandSampleSink;
|
|
||||||
class DownChannelizer;
|
|
||||||
class WFMDemod;
|
class WFMDemod;
|
||||||
|
|
||||||
namespace Ui {
|
namespace Ui {
|
||||||
@ -63,8 +61,6 @@ private:
|
|||||||
bool m_audioMute;
|
bool m_audioMute;
|
||||||
bool m_squelchOpen;
|
bool m_squelchOpen;
|
||||||
|
|
||||||
ThreadedBasebandSampleSink* m_threadedChannelizer;
|
|
||||||
DownChannelizer* m_channelizer;
|
|
||||||
WFMDemod* m_wfmDemod;
|
WFMDemod* m_wfmDemod;
|
||||||
MovingAverage<double> m_channelPowerDbAvg;
|
MovingAverage<double> m_channelPowerDbAvg;
|
||||||
MessageQueue m_inputMessageQueue;
|
MessageQueue m_inputMessageQueue;
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
|
|
||||||
const PluginDescriptor WFMPlugin::m_pluginDescriptor = {
|
const PluginDescriptor WFMPlugin::m_pluginDescriptor = {
|
||||||
QString("WFM Demodulator"),
|
QString("WFM Demodulator"),
|
||||||
QString("3.5.0"),
|
QString("3.7.4"),
|
||||||
QString("(c) Edouard Griffiths, F4EXB"),
|
QString("(c) Edouard Griffiths, F4EXB"),
|
||||||
QString("https://github.com/f4exb/sdrangel"),
|
QString("https://github.com/f4exb/sdrangel"),
|
||||||
true,
|
true,
|
||||||
|
Loading…
Reference in New Issue
Block a user