mirror of
https://github.com/f4exb/sdrangel.git
synced 2025-02-03 09:44:01 -05:00
Separate construction/destruction for the sink output plugin core and the GUI
This commit is contained in:
parent
1d4cb21bb5
commit
9dd99a4530
@ -51,6 +51,11 @@ BladerfOutput::~BladerfOutput()
|
||||
m_deviceAPI->setBuddySharedPtr(0);
|
||||
}
|
||||
|
||||
void BladerfOutput::destroy()
|
||||
{
|
||||
delete this;
|
||||
}
|
||||
|
||||
bool BladerfOutput::openDevice()
|
||||
{
|
||||
if (m_dev != 0)
|
||||
|
@ -70,6 +70,7 @@ public:
|
||||
|
||||
BladerfOutput(DeviceSinkAPI *deviceAPI);
|
||||
virtual ~BladerfOutput();
|
||||
virtual void destroy();
|
||||
|
||||
virtual bool start();
|
||||
virtual void stop();
|
||||
|
@ -37,8 +37,7 @@ BladerfOutputGui::BladerfOutputGui(DeviceSinkAPI *deviceAPI, QWidget* parent) :
|
||||
m_sampleRate(0),
|
||||
m_lastEngineState((DSPDeviceSinkEngine::State)-1)
|
||||
{
|
||||
m_deviceSampleSink = new BladerfOutput(m_deviceAPI);
|
||||
m_deviceAPI->setSink(m_deviceSampleSink);
|
||||
m_deviceSampleSink = (BladerfOutput*) m_deviceAPI->getSampleSink();
|
||||
|
||||
ui->setupUi(this);
|
||||
ui->centerFrequency->setColorMapper(ColorMapper(ColorMapper::GrayGold));
|
||||
@ -68,7 +67,6 @@ BladerfOutputGui::BladerfOutputGui(DeviceSinkAPI *deviceAPI, QWidget* parent) :
|
||||
|
||||
BladerfOutputGui::~BladerfOutputGui()
|
||||
{
|
||||
delete m_deviceSampleSink; // Valgrind memcheck
|
||||
delete ui;
|
||||
}
|
||||
|
||||
|
@ -65,9 +65,8 @@ FileSinkGui::FileSinkGui(DeviceSinkAPI *deviceAPI, QWidget* parent) :
|
||||
|
||||
displaySettings();
|
||||
|
||||
m_deviceSampleSink = new FileSinkOutput(m_deviceAPI);
|
||||
m_deviceSampleSink = (FileSinkOutput*) m_deviceAPI->getSampleSink();
|
||||
connect(m_deviceSampleSink->getOutputMessageQueueToGUI(), SIGNAL(messageEnqueued()), this, SLOT(handleSinkMessages()));
|
||||
m_deviceAPI->setSink(m_deviceSampleSink);
|
||||
|
||||
connect(m_deviceAPI->getDeviceEngineOutputMessageQueue(), SIGNAL(messageEnqueued()), this, SLOT(handleDSPMessages()), Qt::QueuedConnection);
|
||||
}
|
||||
|
@ -52,6 +52,11 @@ FileSinkOutput::~FileSinkOutput()
|
||||
stop();
|
||||
}
|
||||
|
||||
void FileSinkOutput::destroy()
|
||||
{
|
||||
delete this;
|
||||
}
|
||||
|
||||
void FileSinkOutput::openFileStream()
|
||||
{
|
||||
if (m_ofstream.is_open()) {
|
||||
|
@ -150,6 +150,7 @@ public:
|
||||
|
||||
FileSinkOutput(DeviceSinkAPI *deviceAPI);
|
||||
virtual ~FileSinkOutput();
|
||||
virtual void destroy();
|
||||
|
||||
virtual bool start();
|
||||
virtual void stop();
|
||||
|
@ -52,6 +52,11 @@ HackRFOutput::~HackRFOutput()
|
||||
m_deviceAPI->setBuddySharedPtr(0);
|
||||
}
|
||||
|
||||
void HackRFOutput::destroy()
|
||||
{
|
||||
delete this;
|
||||
}
|
||||
|
||||
bool HackRFOutput::openDevice()
|
||||
{
|
||||
if (m_dev != 0)
|
||||
|
@ -70,6 +70,7 @@ public:
|
||||
|
||||
HackRFOutput(DeviceSinkAPI *deviceAPI);
|
||||
virtual ~HackRFOutput();
|
||||
virtual void destroy();
|
||||
|
||||
virtual bool start();
|
||||
virtual void stop();
|
||||
|
@ -40,8 +40,7 @@ HackRFOutputGui::HackRFOutputGui(DeviceSinkAPI *deviceAPI, QWidget* parent) :
|
||||
m_deviceSampleSink(0),
|
||||
m_lastEngineState((DSPDeviceSinkEngine::State)-1)
|
||||
{
|
||||
m_deviceSampleSink = new HackRFOutput(m_deviceAPI);
|
||||
m_deviceAPI->setSink(m_deviceSampleSink);
|
||||
m_deviceSampleSink = (HackRFOutput*) m_deviceAPI->getSampleSink();
|
||||
|
||||
ui->setupUi(this);
|
||||
ui->centerFrequency->setColorMapper(ColorMapper(ColorMapper::GrayGold));
|
||||
@ -62,7 +61,6 @@ HackRFOutputGui::HackRFOutputGui(DeviceSinkAPI *deviceAPI, QWidget* parent) :
|
||||
|
||||
HackRFOutputGui::~HackRFOutputGui()
|
||||
{
|
||||
delete m_deviceSampleSink; // Valgrind memcheck
|
||||
delete ui;
|
||||
}
|
||||
|
||||
|
@ -59,6 +59,11 @@ LimeSDROutput::~LimeSDROutput()
|
||||
resumeBuddies();
|
||||
}
|
||||
|
||||
void LimeSDROutput::destroy()
|
||||
{
|
||||
delete this;
|
||||
}
|
||||
|
||||
bool LimeSDROutput::openDevice()
|
||||
{
|
||||
// look for Tx buddies and get reference to common parameters
|
||||
|
@ -210,6 +210,7 @@ public:
|
||||
|
||||
LimeSDROutput(DeviceSinkAPI *deviceAPI);
|
||||
virtual ~LimeSDROutput();
|
||||
virtual void destroy();
|
||||
|
||||
virtual bool start();
|
||||
virtual void stop();
|
||||
|
@ -37,9 +37,8 @@ LimeSDROutputGUI::LimeSDROutputGUI(DeviceSinkAPI *deviceAPI, QWidget* parent) :
|
||||
m_statusCounter(0),
|
||||
m_deviceStatusCounter(0)
|
||||
{
|
||||
m_limeSDROutput = new LimeSDROutput(m_deviceAPI);
|
||||
m_sampleSink = (DeviceSampleSink *) m_limeSDROutput;
|
||||
m_deviceAPI->setSink(m_sampleSink);
|
||||
m_limeSDROutput = (LimeSDROutput*) m_deviceAPI->getSampleSink();
|
||||
m_deviceAPI->setSampleSink(m_sampleSink);
|
||||
|
||||
ui->setupUi(this);
|
||||
|
||||
@ -81,7 +80,6 @@ LimeSDROutputGUI::LimeSDROutputGUI(DeviceSinkAPI *deviceAPI, QWidget* parent) :
|
||||
|
||||
LimeSDROutputGUI::~LimeSDROutputGUI()
|
||||
{
|
||||
delete m_sampleSink; // Valgrind memcheck
|
||||
delete ui;
|
||||
}
|
||||
|
||||
|
@ -83,9 +83,8 @@ SDRdaemonSinkGui::SDRdaemonSinkGui(DeviceSinkAPI *deviceAPI, QWidget* parent) :
|
||||
connect(&m_statusTimer, SIGNAL(timeout()), this, SLOT(updateStatus()));
|
||||
m_statusTimer.start(500);
|
||||
|
||||
m_deviceSampleSink = new SDRdaemonSinkOutput(m_deviceAPI);
|
||||
m_deviceSampleSink = (SDRdaemonSinkOutput*) m_deviceAPI->getSampleSink();
|
||||
connect(m_deviceSampleSink->getOutputMessageQueueToGUI(), SIGNAL(messageEnqueued()), this, SLOT(handleSinkMessages()));
|
||||
m_deviceAPI->setSink(m_deviceSampleSink);
|
||||
|
||||
connect(m_deviceAPI->getDeviceEngineOutputMessageQueue(), SIGNAL(messageEnqueued()), this, SLOT(handleDSPMessages()), Qt::QueuedConnection);
|
||||
|
||||
|
@ -50,6 +50,11 @@ SDRdaemonSinkOutput::~SDRdaemonSinkOutput()
|
||||
stop();
|
||||
}
|
||||
|
||||
void SDRdaemonSinkOutput::destroy()
|
||||
{
|
||||
delete this;
|
||||
}
|
||||
|
||||
bool SDRdaemonSinkOutput::start()
|
||||
{
|
||||
QMutexLocker mutexLocker(&m_mutex);
|
||||
|
@ -134,6 +134,7 @@ public:
|
||||
|
||||
SDRdaemonSinkOutput(DeviceSinkAPI *deviceAPI);
|
||||
virtual ~SDRdaemonSinkOutput();
|
||||
virtual void destroy();
|
||||
|
||||
virtual bool start();
|
||||
virtual void stop();
|
||||
|
@ -83,11 +83,16 @@ uint32_t DeviceSinkAPI::getNumberOfSources()
|
||||
return m_deviceSinkEngine->getNumberOfSources();
|
||||
}
|
||||
|
||||
void DeviceSinkAPI::setSink(DeviceSampleSink* sink)
|
||||
void DeviceSinkAPI::setSampleSink(DeviceSampleSink* sink)
|
||||
{
|
||||
m_deviceSinkEngine->setSink(sink);
|
||||
}
|
||||
|
||||
DeviceSampleSink *DeviceSinkAPI::getSampleSink()
|
||||
{
|
||||
return m_deviceSinkEngine->getSink();
|
||||
}
|
||||
|
||||
bool DeviceSinkAPI::initGeneration()
|
||||
{
|
||||
return m_deviceSinkEngine->initGeneration();
|
||||
@ -157,6 +162,11 @@ void DeviceSinkAPI::setSampleSinkId(const QString& id)
|
||||
m_sampleSinkId = id;
|
||||
}
|
||||
|
||||
void DeviceSinkAPI::resetSampleSinkId()
|
||||
{
|
||||
m_sampleSinkId.clear();
|
||||
}
|
||||
|
||||
void DeviceSinkAPI::setSampleSinkSerial(const QString& serial)
|
||||
{
|
||||
m_sampleSinkSerial = serial;
|
||||
@ -180,12 +190,6 @@ void DeviceSinkAPI::setSampleSinkPluginInterface(PluginInterface *iface)
|
||||
|
||||
void DeviceSinkAPI::setSampleSinkPluginInstanceUI(PluginInstanceUI *gui)
|
||||
{
|
||||
if (m_sampleSinkPluginInstanceUI != 0)
|
||||
{
|
||||
m_sampleSinkPluginInstanceUI->destroy();
|
||||
m_sampleSinkId.clear();
|
||||
}
|
||||
|
||||
m_sampleSinkPluginInstanceUI = gui;
|
||||
}
|
||||
|
||||
@ -217,23 +221,13 @@ void DeviceSinkAPI::renameChannelInstances()
|
||||
}
|
||||
}
|
||||
|
||||
void DeviceSinkAPI::freeAll()
|
||||
void DeviceSinkAPI::freeChannels()
|
||||
{
|
||||
for(int i = 0; i < m_channelInstanceRegistrations.count(); i++)
|
||||
{
|
||||
qDebug("DeviceSinkAPI::freeAll: destroying channel [%s]", qPrintable(m_channelInstanceRegistrations[i].m_channelName));
|
||||
m_channelInstanceRegistrations[i].m_gui->destroy();
|
||||
}
|
||||
|
||||
|
||||
if(m_sampleSinkPluginInstanceUI != 0)
|
||||
{
|
||||
qDebug("DeviceSinkAPI::freeAll: destroying m_sampleSourcePluginGUI");
|
||||
m_deviceSinkEngine->setSink(0);
|
||||
m_sampleSinkPluginInstanceUI->destroy();
|
||||
m_sampleSinkPluginInstanceUI = 0;
|
||||
m_sampleSinkId.clear();
|
||||
}
|
||||
}
|
||||
|
||||
void DeviceSinkAPI::loadSinkSettings(const Preset* preset)
|
||||
|
@ -50,7 +50,8 @@ public:
|
||||
void addThreadedSource(ThreadedBasebandSampleSource* sink); //!< Add a baseband sample source that will run on its own thread to device engine
|
||||
void removeThreadedSource(ThreadedBasebandSampleSource* sink); //!< Remove a baseband sample source that runs on its own thread from device engine
|
||||
uint32_t getNumberOfSources();
|
||||
void setSink(DeviceSampleSink* sink); //!< Set device engine sample sink type
|
||||
void setSampleSink(DeviceSampleSink* sink); //!< Set device engine sample sink type
|
||||
DeviceSampleSink *getSampleSink(); //!< Return pointer to the device sample sink
|
||||
bool initGeneration(); //!< Initialize device engine generation sequence
|
||||
bool startGeneration(); //!< Start device engine generation sequence
|
||||
void stopGeneration(); //!< Stop device engine generation sequence
|
||||
@ -67,6 +68,7 @@ public:
|
||||
|
||||
void setHardwareId(const QString& id);
|
||||
void setSampleSinkId(const QString& id);
|
||||
void resetSampleSinkId();
|
||||
void setSampleSinkSerial(const QString& serial);
|
||||
void setSampleSinkDisplayName(const QString& serial);
|
||||
void setSampleSinkSequence(int sequence);
|
||||
@ -77,13 +79,14 @@ public:
|
||||
const QString& getSampleSinkId() const { return m_sampleSinkId; }
|
||||
const QString& getSampleSinkSerial() const { return m_sampleSinkSerial; }
|
||||
const QString& getSampleSinkDisplayName() const { return m_sampleSinkDisplayName; }
|
||||
PluginInterface *getSampleSinkPluginInterface() { return m_pluginInterface; }
|
||||
PluginInterface *getPluginInterface() { return m_pluginInterface; }
|
||||
uint32_t getSampleSinkSequence() const { return m_sampleSinkSequence; }
|
||||
PluginInstanceUI *getSampleSinkPluginInstanceGUI() { return m_sampleSinkPluginInstanceUI; }
|
||||
|
||||
void registerChannelInstance(const QString& channelName, PluginInstanceUI* pluginGUI);
|
||||
void removeChannelInstance(PluginInstanceUI* pluginGUI);
|
||||
|
||||
void freeAll();
|
||||
void freeChannels();
|
||||
|
||||
void loadSinkSettings(const Preset* preset);
|
||||
void saveSinkSettings(Preset* preset);
|
||||
|
@ -1,56 +1,57 @@
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
// Copyright (C) 2016 F4EXB //
|
||||
// written by Edouard Griffiths //
|
||||
// //
|
||||
// This program is free software; you can redistribute it and/or modify //
|
||||
// it under the terms of the GNU General Public License as published by //
|
||||
// the Free Software Foundation as version 3 of the License, or //
|
||||
// //
|
||||
// This program is distributed in the hope that it will be useful, //
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of //
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
|
||||
// GNU General Public License V3 for more details. //
|
||||
// //
|
||||
// You should have received a copy of the GNU General Public License //
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>. //
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef SDRBASE_DSP_DEVICESAMPLESINK_H_
|
||||
#define SDRBASE_DSP_DEVICESAMPLESINK_H_
|
||||
|
||||
#include <QtGlobal>
|
||||
|
||||
#include "samplesourcefifo.h"
|
||||
#include "util/message.h"
|
||||
#include "util/messagequeue.h"
|
||||
#include "util/export.h"
|
||||
|
||||
class SDRANGEL_API DeviceSampleSink : public QObject {
|
||||
Q_OBJECT
|
||||
public:
|
||||
DeviceSampleSink();
|
||||
virtual ~DeviceSampleSink();
|
||||
|
||||
virtual bool start() = 0;
|
||||
virtual void stop() = 0;
|
||||
|
||||
virtual const QString& getDeviceDescription() const = 0;
|
||||
virtual int getSampleRate() const = 0; //!< Sample rate exposed by the sink
|
||||
virtual quint64 getCenterFrequency() const = 0; //!< Center frequency exposed by the sink
|
||||
|
||||
virtual bool handleMessage(const Message& message) = 0;
|
||||
|
||||
MessageQueue *getInputMessageQueue() { return &m_inputMessageQueue; }
|
||||
MessageQueue *getOutputMessageQueueToGUI() { return &m_outputMessageQueueToGUI; }
|
||||
SampleSourceFifo* getSampleFifo() { return &m_sampleSourceFifo; }
|
||||
|
||||
protected slots:
|
||||
void handleInputMessages();
|
||||
|
||||
protected:
|
||||
SampleSourceFifo m_sampleSourceFifo;
|
||||
MessageQueue m_inputMessageQueue; //!< Input queue to the sink
|
||||
MessageQueue m_outputMessageQueueToGUI; //!< Output queue specialized for the sink GUI
|
||||
};
|
||||
|
||||
#endif /* SDRBASE_DSP_DEVICESAMPLESINK_H_ */
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
// Copyright (C) 2016 F4EXB //
|
||||
// written by Edouard Griffiths //
|
||||
// //
|
||||
// This program is free software; you can redistribute it and/or modify //
|
||||
// it under the terms of the GNU General Public License as published by //
|
||||
// the Free Software Foundation as version 3 of the License, or //
|
||||
// //
|
||||
// This program is distributed in the hope that it will be useful, //
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of //
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
|
||||
// GNU General Public License V3 for more details. //
|
||||
// //
|
||||
// You should have received a copy of the GNU General Public License //
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>. //
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef SDRBASE_DSP_DEVICESAMPLESINK_H_
|
||||
#define SDRBASE_DSP_DEVICESAMPLESINK_H_
|
||||
|
||||
#include <QtGlobal>
|
||||
|
||||
#include "samplesourcefifo.h"
|
||||
#include "util/message.h"
|
||||
#include "util/messagequeue.h"
|
||||
#include "util/export.h"
|
||||
|
||||
class SDRANGEL_API DeviceSampleSink : public QObject {
|
||||
Q_OBJECT
|
||||
public:
|
||||
DeviceSampleSink();
|
||||
virtual ~DeviceSampleSink();
|
||||
virtual void destroy() = 0;
|
||||
|
||||
virtual bool start() = 0;
|
||||
virtual void stop() = 0;
|
||||
|
||||
virtual const QString& getDeviceDescription() const = 0;
|
||||
virtual int getSampleRate() const = 0; //!< Sample rate exposed by the sink
|
||||
virtual quint64 getCenterFrequency() const = 0; //!< Center frequency exposed by the sink
|
||||
|
||||
virtual bool handleMessage(const Message& message) = 0;
|
||||
|
||||
MessageQueue *getInputMessageQueue() { return &m_inputMessageQueue; }
|
||||
MessageQueue *getOutputMessageQueueToGUI() { return &m_outputMessageQueueToGUI; }
|
||||
SampleSourceFifo* getSampleFifo() { return &m_sampleSourceFifo; }
|
||||
|
||||
protected slots:
|
||||
void handleInputMessages();
|
||||
|
||||
protected:
|
||||
SampleSourceFifo m_sampleSourceFifo;
|
||||
MessageQueue m_inputMessageQueue; //!< Input queue to the sink
|
||||
MessageQueue m_outputMessageQueueToGUI; //!< Output queue specialized for the sink GUI
|
||||
};
|
||||
|
||||
#endif /* SDRBASE_DSP_DEVICESAMPLESINK_H_ */
|
||||
|
@ -64,6 +64,7 @@ public:
|
||||
void stopGeneration(); //!< Stop generation sequence
|
||||
|
||||
void setSink(DeviceSampleSink* sink); //!< Set the sample sink type
|
||||
DeviceSampleSink *getSink() { return m_deviceSampleSink; }
|
||||
void setSinkSequence(int sequence); //!< Set the sample sink sequence in type
|
||||
|
||||
void addSource(BasebandSampleSource* source); //!< Add a baseband sample source
|
||||
|
@ -276,12 +276,15 @@ void MainWindow::addSinkDevice()
|
||||
ui->tabInputsSelect->addTab(m_deviceUIs.back()->m_samplingDeviceControl, tabNameCStr);
|
||||
ui->tabInputsSelect->setTabToolTip(deviceTabIndex, QString(uidCStr));
|
||||
|
||||
// create a file sink by default
|
||||
m_pluginManager->selectSampleSinkBySerialOrSequence("sdrangel.samplesink.filesink", "0", 0, m_deviceUIs.back()->m_deviceSinkAPI);
|
||||
|
||||
DeviceSampleSink *sink = m_deviceUIs.back()->m_deviceSinkAPI->getPluginInterface()->createSampleSinkPluginInstanceOutput(
|
||||
m_deviceUIs.back()->m_deviceSinkAPI->getSampleSinkId(), m_deviceUIs.back()->m_deviceSinkAPI);
|
||||
m_deviceUIs.back()->m_deviceSinkAPI->setSampleSink(sink);
|
||||
QWidget *gui;
|
||||
PluginInstanceUI *pluginGUI = m_deviceUIs.back()->m_deviceSinkAPI->getSampleSinkPluginInterface()->createSampleSinkPluginInstanceGUI(
|
||||
PluginInstanceUI *pluginUI = m_deviceUIs.back()->m_deviceSinkAPI->getPluginInterface()->createSampleSinkPluginInstanceGUI(
|
||||
m_deviceUIs.back()->m_deviceSinkAPI->getSampleSinkId(), &gui, m_deviceUIs.back()->m_deviceSinkAPI);
|
||||
m_deviceUIs.back()->m_deviceSinkAPI->setSampleSinkPluginInstanceUI(pluginGUI);
|
||||
m_deviceUIs.back()->m_deviceSinkAPI->setSampleSinkPluginInstanceUI(pluginUI);
|
||||
setDeviceGUI(deviceTabIndex, gui, m_deviceUIs.back()->m_deviceSinkAPI->getSampleSinkDisplayName(), false);
|
||||
}
|
||||
|
||||
@ -333,8 +336,14 @@ void MainWindow::removeLastDevice()
|
||||
ui->tabSpectraGUI->removeTab(ui->tabSpectraGUI->count() - 1);
|
||||
ui->tabSpectra->removeTab(ui->tabSpectra->count() - 1);
|
||||
|
||||
m_deviceUIs.back()->m_deviceSinkAPI->freeAll();
|
||||
m_deviceUIs.back()->m_deviceSinkAPI->clearBuddiesLists(); // remove old API from buddies lists
|
||||
// deletes old UI and output object
|
||||
m_deviceUIs.back()->m_deviceSinkAPI->freeChannels();
|
||||
m_deviceUIs.back()->m_deviceSinkAPI->getPluginInterface()->deleteSampleSourcePluginInstanceGUI(
|
||||
m_deviceUIs.back()->m_deviceSinkAPI->getSampleSinkPluginInstanceGUI());
|
||||
m_deviceUIs.back()->m_deviceSinkAPI->resetSampleSinkId();
|
||||
m_deviceUIs.back()->m_deviceSinkAPI->clearBuddiesLists(); // clear old API buddies lists
|
||||
m_deviceUIs.back()->m_deviceSinkAPI->getPluginInterface()->deleteSampleSinkPluginInstanceOutput(
|
||||
m_deviceUIs.back()->m_deviceSinkAPI->getSampleSink());
|
||||
|
||||
ui->tabChannels->removeTab(ui->tabChannels->count() - 1);
|
||||
|
||||
@ -904,8 +913,13 @@ void MainWindow::on_sampleSink_confirmClicked(bool checked __attribute__((unused
|
||||
void *devicePtr = deviceUI->m_samplingDeviceControl->getDeviceSelector()->itemData(selectedComboIndex).value<void *>();
|
||||
deviceUI->m_deviceSinkAPI->stopGeneration();
|
||||
|
||||
deviceUI->m_deviceSinkAPI->setSampleSinkPluginInstanceUI(0); // deletes old GUI and input object
|
||||
deviceUI->m_deviceSinkAPI->clearBuddiesLists(); // remove old API from buddies lists
|
||||
// deletes old UI and output object
|
||||
deviceUI->m_deviceSinkAPI->getPluginInterface()->deleteSampleSourcePluginInstanceGUI(
|
||||
deviceUI->m_deviceSinkAPI->getSampleSinkPluginInstanceGUI());
|
||||
deviceUI->m_deviceSinkAPI->resetSampleSinkId();
|
||||
deviceUI->m_deviceSinkAPI->clearBuddiesLists(); // clear old API buddies lists
|
||||
deviceUI->m_deviceSinkAPI->getPluginInterface()->deleteSampleSinkPluginInstanceOutput(
|
||||
deviceUI->m_deviceSinkAPI->getSampleSink());
|
||||
|
||||
m_pluginManager->selectSampleSinkByDevice(devicePtr, deviceUI->m_deviceSinkAPI); // sets the new API
|
||||
|
||||
@ -944,8 +958,11 @@ void MainWindow::on_sampleSink_confirmClicked(bool checked __attribute__((unused
|
||||
}
|
||||
|
||||
// constructs new GUI and output object
|
||||
DeviceSampleSink *sink = deviceUI->m_deviceSinkAPI->getPluginInterface()->createSampleSinkPluginInstanceOutput(
|
||||
deviceUI->m_deviceSinkAPI->getSampleSinkId(), deviceUI->m_deviceSinkAPI);
|
||||
deviceUI->m_deviceSinkAPI->setSampleSink(sink);
|
||||
QWidget *gui;
|
||||
PluginInstanceUI *pluginUI = deviceUI->m_deviceSinkAPI->getSampleSinkPluginInterface()->createSampleSinkPluginInstanceGUI(
|
||||
PluginInstanceUI *pluginUI = deviceUI->m_deviceSinkAPI->getPluginInterface()->createSampleSinkPluginInstanceGUI(
|
||||
deviceUI->m_deviceSinkAPI->getSampleSinkId(), &gui, deviceUI->m_deviceSinkAPI);
|
||||
deviceUI->m_deviceSinkAPI->setSampleSinkPluginInstanceUI(pluginUI);
|
||||
setDeviceGUI(currentSinkTabIndex, gui, deviceUI->m_deviceSinkAPI->getSampleSinkDisplayName(), false);
|
||||
|
@ -1,4 +1,5 @@
|
||||
#include "dsp/devicesamplesource.h"
|
||||
#include "dsp/devicesamplesink.h"
|
||||
#include "plugin/plugininterface.h"
|
||||
#include "plugininstanceui.h"
|
||||
|
||||
@ -18,3 +19,7 @@ void PluginInterface::deleteSampleSinkPluginInstanceGUI(PluginInstanceUI *ui)
|
||||
ui->destroy();
|
||||
}
|
||||
|
||||
void PluginInterface::deleteSampleSinkPluginInstanceOutput(DeviceSampleSink *sink)
|
||||
{
|
||||
sink->destroy();
|
||||
}
|
||||
|
@ -69,6 +69,7 @@ public:
|
||||
virtual PluginInstanceUI* createSampleSinkPluginInstanceGUI(const QString& sinkId __attribute__((unused)), QWidget **widget __attribute__((unused)), DeviceSinkAPI *deviceAPI __attribute__((unused))) { return 0; }
|
||||
virtual DeviceSampleSink* createSampleSinkPluginInstanceOutput(const QString& sinkId __attribute__((unused)), DeviceSinkAPI *deviceAPI __attribute__((unused))) { return 0; } // creates the output "core"
|
||||
virtual void deleteSampleSinkPluginInstanceGUI(PluginInstanceUI *ui);
|
||||
virtual void deleteSampleSinkPluginInstanceOutput(DeviceSampleSink *sink);
|
||||
};
|
||||
|
||||
Q_DECLARE_INTERFACE(PluginInterface, "SDRangel.PluginInterface/0.1");
|
||||
|
Loading…
Reference in New Issue
Block a user