mirror of
https://github.com/f4exb/sdrangel.git
synced 2024-11-15 12:51:49 -05:00
ATV mod: separate GUI and modulator phase 1
This commit is contained in:
parent
b14066a8f0
commit
f1bad36f2c
@ -20,6 +20,9 @@
|
|||||||
#include "opencv2/imgproc/imgproc.hpp"
|
#include "opencv2/imgproc/imgproc.hpp"
|
||||||
|
|
||||||
#include "dsp/upchannelizer.h"
|
#include "dsp/upchannelizer.h"
|
||||||
|
#include "dsp/threadedbasebandsamplesource.h"
|
||||||
|
#include "device/devicesinkapi.h"
|
||||||
|
|
||||||
#include "atvmod.h"
|
#include "atvmod.h"
|
||||||
|
|
||||||
MESSAGE_CLASS_DEFINITION(ATVMod::MsgConfigureATVMod, Message)
|
MESSAGE_CLASS_DEFINITION(ATVMod::MsgConfigureATVMod, Message)
|
||||||
@ -44,7 +47,8 @@ const int ATVMod::m_nbBars = 6;
|
|||||||
const int ATVMod::m_cameraFPSTestNbFrames = 100;
|
const int ATVMod::m_cameraFPSTestNbFrames = 100;
|
||||||
const int ATVMod::m_ssbFftLen = 1024;
|
const int ATVMod::m_ssbFftLen = 1024;
|
||||||
|
|
||||||
ATVMod::ATVMod() :
|
ATVMod::ATVMod(DeviceSinkAPI *deviceAPI) :
|
||||||
|
m_deviceAPI(deviceAPI),
|
||||||
m_modPhasor(0.0f),
|
m_modPhasor(0.0f),
|
||||||
m_tvSampleRate(1000000),
|
m_tvSampleRate(1000000),
|
||||||
m_evenImage(true),
|
m_evenImage(true),
|
||||||
@ -70,6 +74,10 @@ ATVMod::ATVMod() :
|
|||||||
setObjectName("ATVMod");
|
setObjectName("ATVMod");
|
||||||
scanCameras();
|
scanCameras();
|
||||||
|
|
||||||
|
m_channelizer = new UpChannelizer(this);
|
||||||
|
m_threadedChannelizer = new ThreadedBasebandSampleSource(m_channelizer, this);
|
||||||
|
m_deviceAPI->addThreadedSource(m_threadedChannelizer);
|
||||||
|
|
||||||
m_SSBFilter = new fftfilt(0, m_settings.m_rfBandwidth / m_settings.m_outputSampleRate, m_ssbFftLen);
|
m_SSBFilter = new fftfilt(0, m_settings.m_rfBandwidth / m_settings.m_outputSampleRate, m_ssbFftLen);
|
||||||
m_SSBFilterBuffer = new Complex[m_ssbFftLen>>1]; // filter returns data exactly half of its size
|
m_SSBFilterBuffer = new Complex[m_ssbFftLen>>1]; // filter returns data exactly half of its size
|
||||||
memset(m_SSBFilterBuffer, 0, sizeof(Complex)*(m_ssbFftLen>>1));
|
memset(m_SSBFilterBuffer, 0, sizeof(Complex)*(m_ssbFftLen>>1));
|
||||||
@ -90,6 +98,9 @@ ATVMod::~ATVMod()
|
|||||||
{
|
{
|
||||||
if (m_video.isOpened()) m_video.release();
|
if (m_video.isOpened()) m_video.release();
|
||||||
releaseCameras();
|
releaseCameras();
|
||||||
|
m_deviceAPI->removeThreadedSource(m_threadedChannelizer);
|
||||||
|
delete m_threadedChannelizer;
|
||||||
|
delete m_channelizer;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ATVMod::pullAudio(int nbSamples __attribute__((unused)))
|
void ATVMod::pullAudio(int nbSamples __attribute__((unused)))
|
||||||
@ -495,6 +506,19 @@ bool ATVMod::handleMessage(const Message& cmd)
|
|||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
else if (MsgConfigureChannelizer::match(cmd))
|
||||||
|
{
|
||||||
|
MsgConfigureChannelizer& cfg = (MsgConfigureChannelizer&) cmd;
|
||||||
|
|
||||||
|
m_channelizer->configure(m_channelizer->getInputMessageQueue(),
|
||||||
|
m_channelizer->getOutputSampleRate(),
|
||||||
|
cfg.getCenterFrequency());
|
||||||
|
|
||||||
|
qDebug() << "SSBMod::handleMessage: MsgConfigureChannelizer: sampleRate: " << m_channelizer->getOutputSampleRate()
|
||||||
|
<< " centerFrequency: " << cfg.getCenterFrequency();
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
else if (MsgConfigureATVMod::match(cmd))
|
else if (MsgConfigureATVMod::match(cmd))
|
||||||
{
|
{
|
||||||
MsgConfigureATVMod& cfg = (MsgConfigureATVMod&) cmd;
|
MsgConfigureATVMod& cfg = (MsgConfigureATVMod&) cmd;
|
||||||
|
@ -36,6 +36,10 @@
|
|||||||
|
|
||||||
#include "atvmodsettings.h"
|
#include "atvmodsettings.h"
|
||||||
|
|
||||||
|
class DeviceSinkAPI;
|
||||||
|
class ThreadedBasebandSampleSource;
|
||||||
|
class UpChannelizer;
|
||||||
|
|
||||||
class ATVMod : public BasebandSampleSource {
|
class ATVMod : public BasebandSampleSource {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
@ -67,21 +71,18 @@ public:
|
|||||||
MESSAGE_CLASS_DECLARATION
|
MESSAGE_CLASS_DECLARATION
|
||||||
|
|
||||||
public:
|
public:
|
||||||
int getSampleRate() const { return m_sampleRate; }
|
|
||||||
int getCenterFrequency() const { return m_centerFrequency; }
|
int getCenterFrequency() const { return m_centerFrequency; }
|
||||||
|
|
||||||
static MsgConfigureChannelizer* create(int sampleRate, int centerFrequency)
|
static MsgConfigureChannelizer* create(int centerFrequency)
|
||||||
{
|
{
|
||||||
return new MsgConfigureChannelizer(sampleRate, centerFrequency);
|
return new MsgConfigureChannelizer(centerFrequency);
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
int m_sampleRate;
|
|
||||||
int m_centerFrequency;
|
int m_centerFrequency;
|
||||||
|
|
||||||
MsgConfigureChannelizer(int sampleRate, int centerFrequency) :
|
MsgConfigureChannelizer(int centerFrequency) :
|
||||||
Message(),
|
Message(),
|
||||||
m_sampleRate(sampleRate),
|
|
||||||
m_centerFrequency(centerFrequency)
|
m_centerFrequency(centerFrequency)
|
||||||
{ }
|
{ }
|
||||||
};
|
};
|
||||||
@ -390,7 +391,7 @@ public:
|
|||||||
{ }
|
{ }
|
||||||
};
|
};
|
||||||
|
|
||||||
ATVMod();
|
ATVMod(DeviceSinkAPI *deviceAPI);
|
||||||
~ATVMod();
|
~ATVMod();
|
||||||
|
|
||||||
virtual void pull(Sample& sample);
|
virtual void pull(Sample& sample);
|
||||||
@ -450,6 +451,9 @@ private:
|
|||||||
{}
|
{}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
DeviceSinkAPI* m_deviceAPI;
|
||||||
|
ThreadedBasebandSampleSource* m_threadedChannelizer;
|
||||||
|
UpChannelizer* m_channelizer;
|
||||||
ATVModSettings m_settings;
|
ATVModSettings m_settings;
|
||||||
|
|
||||||
NCO m_carrierNco;
|
NCO m_carrierNco;
|
||||||
|
@ -24,8 +24,6 @@
|
|||||||
#include <cmath>
|
#include <cmath>
|
||||||
|
|
||||||
#include "device/devicesinkapi.h"
|
#include "device/devicesinkapi.h"
|
||||||
#include "dsp/upchannelizer.h"
|
|
||||||
#include "dsp/threadedbasebandsamplesource.h"
|
|
||||||
#include "plugin/pluginapi.h"
|
#include "plugin/pluginapi.h"
|
||||||
#include "util/simpleserializer.h"
|
#include "util/simpleserializer.h"
|
||||||
#include "gui/basicchannelsettingswidget.h"
|
#include "gui/basicchannelsettingswidget.h"
|
||||||
@ -159,11 +157,6 @@ void ATVModGUI::channelMarkerChanged()
|
|||||||
applySettings();
|
applySettings();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ATVModGUI::channelizerOutputSampleRateChanged()
|
|
||||||
{
|
|
||||||
//setRFFiltersSlidersRange(m_channelizer->getOutputSampleRate());
|
|
||||||
}
|
|
||||||
|
|
||||||
void ATVModGUI::setRFFiltersSlidersRange(int sampleRate)
|
void ATVModGUI::setRFFiltersSlidersRange(int sampleRate)
|
||||||
{
|
{
|
||||||
int scaleFactor = (int) std::log10(sampleRate/2);
|
int scaleFactor = (int) std::log10(sampleRate/2);
|
||||||
@ -615,13 +608,8 @@ ATVModGUI::ATVModGUI(PluginAPI* pluginAPI, DeviceSinkAPI *deviceAPI, QWidget* pa
|
|||||||
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_atvMod = new ATVMod();
|
m_atvMod = new ATVMod(m_deviceAPI);
|
||||||
m_atvMod->setMessageQueueToGUI(getInputMessageQueue());
|
m_atvMod->setMessageQueueToGUI(getInputMessageQueue());
|
||||||
m_channelizer = new UpChannelizer(m_atvMod);
|
|
||||||
m_threadedChannelizer = new ThreadedBasebandSampleSource(m_channelizer, this);
|
|
||||||
//m_pluginAPI->addThreadedSink(m_threadedChannelizer);
|
|
||||||
connect(m_channelizer, SIGNAL(outputSampleRateChanged()), this, SLOT(channelizerOutputSampleRateChanged()));
|
|
||||||
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()));
|
||||||
|
|
||||||
@ -662,9 +650,6 @@ ATVModGUI::ATVModGUI(PluginAPI* pluginAPI, DeviceSinkAPI *deviceAPI, QWidget* pa
|
|||||||
ATVModGUI::~ATVModGUI()
|
ATVModGUI::~ATVModGUI()
|
||||||
{
|
{
|
||||||
m_deviceAPI->removeChannelInstance(this);
|
m_deviceAPI->removeChannelInstance(this);
|
||||||
m_deviceAPI->removeThreadedSource(m_threadedChannelizer);
|
|
||||||
delete m_threadedChannelizer;
|
|
||||||
delete m_channelizer;
|
|
||||||
delete m_atvMod;
|
delete m_atvMod;
|
||||||
delete ui;
|
delete ui;
|
||||||
}
|
}
|
||||||
@ -678,9 +663,9 @@ void ATVModGUI::applySettings(bool force)
|
|||||||
{
|
{
|
||||||
if (m_doApplySettings)
|
if (m_doApplySettings)
|
||||||
{
|
{
|
||||||
m_channelizer->configure(m_channelizer->getInputMessageQueue(),
|
ATVMod::MsgConfigureChannelizer *msgChan = ATVMod::MsgConfigureChannelizer::create(
|
||||||
m_channelizer->getOutputSampleRate(),
|
m_channelMarker.getCenterFrequency());
|
||||||
m_channelMarker.getCenterFrequency());
|
m_atvMod->getInputMessageQueue()->push(msgChan);
|
||||||
|
|
||||||
ATVMod::MsgConfigureATVMod *msg = ATVMod::MsgConfigureATVMod::create(m_settings, force);
|
ATVMod::MsgConfigureATVMod *msg = ATVMod::MsgConfigureATVMod::create(m_settings, force);
|
||||||
m_atvMod->getInputMessageQueue()->push(msg);
|
m_atvMod->getInputMessageQueue()->push(msg);
|
||||||
|
@ -29,8 +29,6 @@
|
|||||||
class PluginAPI;
|
class PluginAPI;
|
||||||
class DeviceSinkAPI;
|
class DeviceSinkAPI;
|
||||||
|
|
||||||
class ThreadedBasebandSampleSource;
|
|
||||||
class UpChannelizer;
|
|
||||||
class ATVMod;
|
class ATVMod;
|
||||||
class QMessageBox;
|
class QMessageBox;
|
||||||
|
|
||||||
@ -60,7 +58,6 @@ public:
|
|||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void channelMarkerChanged();
|
void channelMarkerChanged();
|
||||||
void channelizerOutputSampleRateChanged();
|
|
||||||
void handleSourceMessages();
|
void handleSourceMessages();
|
||||||
|
|
||||||
void on_deltaFrequency_changed(qint64 value);
|
void on_deltaFrequency_changed(qint64 value);
|
||||||
@ -108,8 +105,6 @@ private:
|
|||||||
bool m_basicSettingsShown;
|
bool m_basicSettingsShown;
|
||||||
bool m_doApplySettings;
|
bool m_doApplySettings;
|
||||||
|
|
||||||
ThreadedBasebandSampleSource* m_threadedChannelizer;
|
|
||||||
UpChannelizer* m_channelizer;
|
|
||||||
ATVMod* m_atvMod;
|
ATVMod* m_atvMod;
|
||||||
MovingAverage<double> m_channelPowerDbAvg;
|
MovingAverage<double> m_channelPowerDbAvg;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user