mirror of
https://github.com/f4exb/sdrangel.git
synced 2024-12-03 05:25:17 -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 "dsp/upchannelizer.h"
|
||||
#include "dsp/threadedbasebandsamplesource.h"
|
||||
#include "device/devicesinkapi.h"
|
||||
|
||||
#include "atvmod.h"
|
||||
|
||||
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_ssbFftLen = 1024;
|
||||
|
||||
ATVMod::ATVMod() :
|
||||
ATVMod::ATVMod(DeviceSinkAPI *deviceAPI) :
|
||||
m_deviceAPI(deviceAPI),
|
||||
m_modPhasor(0.0f),
|
||||
m_tvSampleRate(1000000),
|
||||
m_evenImage(true),
|
||||
@ -70,6 +74,10 @@ ATVMod::ATVMod() :
|
||||
setObjectName("ATVMod");
|
||||
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_SSBFilterBuffer = new Complex[m_ssbFftLen>>1]; // filter returns data exactly half of its size
|
||||
memset(m_SSBFilterBuffer, 0, sizeof(Complex)*(m_ssbFftLen>>1));
|
||||
@ -90,6 +98,9 @@ ATVMod::~ATVMod()
|
||||
{
|
||||
if (m_video.isOpened()) m_video.release();
|
||||
releaseCameras();
|
||||
m_deviceAPI->removeThreadedSource(m_threadedChannelizer);
|
||||
delete m_threadedChannelizer;
|
||||
delete m_channelizer;
|
||||
}
|
||||
|
||||
void ATVMod::pullAudio(int nbSamples __attribute__((unused)))
|
||||
@ -495,6 +506,19 @@ bool ATVMod::handleMessage(const Message& cmd)
|
||||
|
||||
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))
|
||||
{
|
||||
MsgConfigureATVMod& cfg = (MsgConfigureATVMod&) cmd;
|
||||
|
@ -36,6 +36,10 @@
|
||||
|
||||
#include "atvmodsettings.h"
|
||||
|
||||
class DeviceSinkAPI;
|
||||
class ThreadedBasebandSampleSource;
|
||||
class UpChannelizer;
|
||||
|
||||
class ATVMod : public BasebandSampleSource {
|
||||
Q_OBJECT
|
||||
|
||||
@ -67,21 +71,18 @@ public:
|
||||
MESSAGE_CLASS_DECLARATION
|
||||
|
||||
public:
|
||||
int getSampleRate() const { return m_sampleRate; }
|
||||
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:
|
||||
int m_sampleRate;
|
||||
int m_centerFrequency;
|
||||
|
||||
MsgConfigureChannelizer(int sampleRate, int centerFrequency) :
|
||||
MsgConfigureChannelizer(int centerFrequency) :
|
||||
Message(),
|
||||
m_sampleRate(sampleRate),
|
||||
m_centerFrequency(centerFrequency)
|
||||
{ }
|
||||
};
|
||||
@ -390,7 +391,7 @@ public:
|
||||
{ }
|
||||
};
|
||||
|
||||
ATVMod();
|
||||
ATVMod(DeviceSinkAPI *deviceAPI);
|
||||
~ATVMod();
|
||||
|
||||
virtual void pull(Sample& sample);
|
||||
@ -450,6 +451,9 @@ private:
|
||||
{}
|
||||
};
|
||||
|
||||
DeviceSinkAPI* m_deviceAPI;
|
||||
ThreadedBasebandSampleSource* m_threadedChannelizer;
|
||||
UpChannelizer* m_channelizer;
|
||||
ATVModSettings m_settings;
|
||||
|
||||
NCO m_carrierNco;
|
||||
|
@ -24,8 +24,6 @@
|
||||
#include <cmath>
|
||||
|
||||
#include "device/devicesinkapi.h"
|
||||
#include "dsp/upchannelizer.h"
|
||||
#include "dsp/threadedbasebandsamplesource.h"
|
||||
#include "plugin/pluginapi.h"
|
||||
#include "util/simpleserializer.h"
|
||||
#include "gui/basicchannelsettingswidget.h"
|
||||
@ -159,11 +157,6 @@ void ATVModGUI::channelMarkerChanged()
|
||||
applySettings();
|
||||
}
|
||||
|
||||
void ATVModGUI::channelizerOutputSampleRateChanged()
|
||||
{
|
||||
//setRFFiltersSlidersRange(m_channelizer->getOutputSampleRate());
|
||||
}
|
||||
|
||||
void ATVModGUI::setRFFiltersSlidersRange(int sampleRate)
|
||||
{
|
||||
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(menuDoubleClickEvent()), this, SLOT(onMenuDoubleClicked()));
|
||||
|
||||
m_atvMod = new ATVMod();
|
||||
m_atvMod = new ATVMod(m_deviceAPI);
|
||||
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()));
|
||||
|
||||
@ -662,9 +650,6 @@ ATVModGUI::ATVModGUI(PluginAPI* pluginAPI, DeviceSinkAPI *deviceAPI, QWidget* pa
|
||||
ATVModGUI::~ATVModGUI()
|
||||
{
|
||||
m_deviceAPI->removeChannelInstance(this);
|
||||
m_deviceAPI->removeThreadedSource(m_threadedChannelizer);
|
||||
delete m_threadedChannelizer;
|
||||
delete m_channelizer;
|
||||
delete m_atvMod;
|
||||
delete ui;
|
||||
}
|
||||
@ -678,9 +663,9 @@ void ATVModGUI::applySettings(bool force)
|
||||
{
|
||||
if (m_doApplySettings)
|
||||
{
|
||||
m_channelizer->configure(m_channelizer->getInputMessageQueue(),
|
||||
m_channelizer->getOutputSampleRate(),
|
||||
m_channelMarker.getCenterFrequency());
|
||||
ATVMod::MsgConfigureChannelizer *msgChan = ATVMod::MsgConfigureChannelizer::create(
|
||||
m_channelMarker.getCenterFrequency());
|
||||
m_atvMod->getInputMessageQueue()->push(msgChan);
|
||||
|
||||
ATVMod::MsgConfigureATVMod *msg = ATVMod::MsgConfigureATVMod::create(m_settings, force);
|
||||
m_atvMod->getInputMessageQueue()->push(msg);
|
||||
|
@ -29,8 +29,6 @@
|
||||
class PluginAPI;
|
||||
class DeviceSinkAPI;
|
||||
|
||||
class ThreadedBasebandSampleSource;
|
||||
class UpChannelizer;
|
||||
class ATVMod;
|
||||
class QMessageBox;
|
||||
|
||||
@ -60,7 +58,6 @@ public:
|
||||
|
||||
private slots:
|
||||
void channelMarkerChanged();
|
||||
void channelizerOutputSampleRateChanged();
|
||||
void handleSourceMessages();
|
||||
|
||||
void on_deltaFrequency_changed(qint64 value);
|
||||
@ -108,8 +105,6 @@ private:
|
||||
bool m_basicSettingsShown;
|
||||
bool m_doApplySettings;
|
||||
|
||||
ThreadedBasebandSampleSource* m_threadedChannelizer;
|
||||
UpChannelizer* m_channelizer;
|
||||
ATVMod* m_atvMod;
|
||||
MovingAverage<double> m_channelPowerDbAvg;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user