mirror of
https://github.com/f4exb/sdrangel.git
synced 2024-11-26 09:48:45 -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/>. //
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "../../channelrx/demodwfm/wfmdemod.h"
|
||||
|
||||
#include <QTime>
|
||||
#include <QDebug>
|
||||
#include <stdio.h>
|
||||
#include <complex.h>
|
||||
|
||||
#include <dsp/downchannelizer.h>
|
||||
#include "dsp/threadedbasebandsamplesink.h"
|
||||
#include <device/devicesourceapi.h>
|
||||
#include "audio/audiooutput.h"
|
||||
#include "dsp/dspengine.h"
|
||||
#include "dsp/pidcontroller.h"
|
||||
|
||||
#include "wfmdemod.h"
|
||||
|
||||
MESSAGE_CLASS_DEFINITION(WFMDemod::MsgConfigureWFMDemod, Message)
|
||||
MESSAGE_CLASS_DEFINITION(WFMDemod::MsgConfigureChannelizer, Message)
|
||||
|
||||
WFMDemod::WFMDemod(BasebandSampleSink* sampleSink) :
|
||||
WFMDemod::WFMDemod(DeviceSourceAPI* deviceAPI) :
|
||||
m_deviceAPI(deviceAPI),
|
||||
m_squelchOpen(false),
|
||||
m_magsq(0.0f),
|
||||
m_magsqSum(0.0f),
|
||||
m_magsqPeak(0.0f),
|
||||
m_magsqCount(0),
|
||||
m_movingAverage(40, 0),
|
||||
m_sampleSink(sampleSink),
|
||||
m_sampleSink(0),
|
||||
m_audioFifo(250000),
|
||||
m_settingsMutex(QMutex::Recursive)
|
||||
|
||||
{
|
||||
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_phaseDiscri.setFMScaling(384000/75000);
|
||||
|
||||
@ -63,6 +72,10 @@ WFMDemod::~WFMDemod()
|
||||
}
|
||||
|
||||
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)))
|
||||
|
@ -34,6 +34,10 @@
|
||||
|
||||
#define rfFilterFftLength 1024
|
||||
|
||||
class ThreadedBasebandSampleSink;
|
||||
class DownChannelizer;
|
||||
class DeviceSourceAPI;
|
||||
|
||||
class WFMDemod : public BasebandSampleSink {
|
||||
public:
|
||||
class MsgConfigureWFMDemod : public Message {
|
||||
@ -82,8 +86,9 @@ public:
|
||||
{ }
|
||||
};
|
||||
|
||||
WFMDemod(BasebandSampleSink* sampleSink);
|
||||
WFMDemod(DeviceSourceAPI *deviceAPI);
|
||||
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 start();
|
||||
@ -110,7 +115,10 @@ private:
|
||||
RSRunning
|
||||
};
|
||||
|
||||
WFMDemodSettings m_settings;
|
||||
DeviceSourceAPI* m_deviceAPI;
|
||||
ThreadedBasebandSampleSink* m_threadedChannelizer;
|
||||
DownChannelizer* m_channelizer;
|
||||
WFMDemodSettings m_settings;
|
||||
|
||||
NCO m_nco;
|
||||
Interpolator m_interpolator; //!< Interpolator between sample rate sent from DSP engine and requested RF bandwidth (rational)
|
||||
|
@ -6,7 +6,6 @@
|
||||
#include <QMainWindow>
|
||||
#include <QDebug>
|
||||
|
||||
#include "dsp/threadedbasebandsamplesink.h"
|
||||
#include "ui_wfmdemodgui.h"
|
||||
#include "dsp/dspengine.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(menuDoubleClickEvent()), this, SLOT(onMenuDoubleClicked()));
|
||||
|
||||
m_wfmDemod = new WFMDemod(0);
|
||||
m_channelizer = new DownChannelizer(m_wfmDemod);
|
||||
m_threadedChannelizer = new ThreadedBasebandSampleSink(m_channelizer, this);
|
||||
m_deviceAPI->addThreadedSink(m_threadedChannelizer);
|
||||
m_wfmDemod = new WFMDemod(m_deviceAPI);
|
||||
|
||||
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->addRollupWidget(this);
|
||||
|
||||
m_settings.setChannelMarker(&m_channelMarker);
|
||||
|
||||
displaySettings();
|
||||
applySettings(true);
|
||||
}
|
||||
@ -200,9 +198,6 @@ WFMDemodGUI::WFMDemodGUI(PluginAPI* pluginAPI, DeviceSourceAPI *deviceAPI, QWidg
|
||||
WFMDemodGUI::~WFMDemodGUI()
|
||||
{
|
||||
m_deviceAPI->removeChannelInstance(this);
|
||||
m_deviceAPI->removeThreadedSink(m_threadedChannelizer);
|
||||
delete m_threadedChannelizer;
|
||||
delete m_channelizer;
|
||||
delete m_wfmDemod;
|
||||
//delete m_channelMarker;
|
||||
delete ui;
|
||||
@ -219,9 +214,10 @@ void WFMDemodGUI::applySettings(bool force)
|
||||
{
|
||||
setTitleColor(m_channelMarker.getColor());
|
||||
|
||||
m_channelizer->configure(m_channelizer->getInputMessageQueue(),
|
||||
requiredBW(WFMDemodSettings::getRFBW(ui->rfBW->currentIndex())), // TODO: this is where requested sample rate is specified
|
||||
m_channelMarker.getCenterFrequency());
|
||||
WFMDemod::MsgConfigureChannelizer *msgChan = WFMDemod::MsgConfigureChannelizer::create(
|
||||
requiredBW(WFMDemodSettings::getRFBW(ui->rfBW->currentIndex())),
|
||||
m_channelMarker.getCenterFrequency());
|
||||
m_wfmDemod->getInputMessageQueue()->push(msgChan);
|
||||
|
||||
ui->deltaFrequency->setValue(m_channelMarker.getCenterFrequency());
|
||||
|
||||
|
@ -12,8 +12,6 @@
|
||||
class PluginAPI;
|
||||
class DeviceSourceAPI;
|
||||
|
||||
class ThreadedBasebandSampleSink;
|
||||
class DownChannelizer;
|
||||
class WFMDemod;
|
||||
|
||||
namespace Ui {
|
||||
@ -63,8 +61,6 @@ private:
|
||||
bool m_audioMute;
|
||||
bool m_squelchOpen;
|
||||
|
||||
ThreadedBasebandSampleSink* m_threadedChannelizer;
|
||||
DownChannelizer* m_channelizer;
|
||||
WFMDemod* m_wfmDemod;
|
||||
MovingAverage<double> m_channelPowerDbAvg;
|
||||
MessageQueue m_inputMessageQueue;
|
||||
|
@ -7,7 +7,7 @@
|
||||
|
||||
const PluginDescriptor WFMPlugin::m_pluginDescriptor = {
|
||||
QString("WFM Demodulator"),
|
||||
QString("3.5.0"),
|
||||
QString("3.7.4"),
|
||||
QString("(c) Edouard Griffiths, F4EXB"),
|
||||
QString("https://github.com/f4exb/sdrangel"),
|
||||
true,
|
||||
|
Loading…
Reference in New Issue
Block a user