Multi device support: use DSPDeviceEngine instead of DSPEngine in PluginManager

This commit is contained in:
f4exb 2016-05-11 17:03:02 +02:00
parent e3d39c7d3f
commit 33e5e781c0
4 changed files with 24 additions and 22 deletions

View File

@ -59,16 +59,17 @@ public:
void addThreadedSink(ThreadedSampleSink* sink, uint deviceIndex = 0); //!< Add a sample sink that will run on its own thread
void removeThreadedSink(ThreadedSampleSink* sink, uint deviceIndex = 0); //!< Remove a sample sink that runs on its own thread
void configureCorrections(bool dcOffsetCorrection, bool iqImbalanceCorrection, uint deviceIndex = 0); //!< Configure DSP corrections
DSPDeviceEngine::State state(uint deviceIndex = 0) const;
QString errorMessage(uint deviceIndex = 0); //!< Return the current error message
QString sourceDeviceDescription(uint deviceIndex = 0); //!< Return the source device description
DSPDeviceEngine *getDeviceEngine(uint deviceIndex) { return m_deviceEngines[deviceIndex]; }
void addAudioSink(AudioFifo* audioFifo); //!< Add the audio sink
void removeAudioSink(AudioFifo* audioFifo); //!< Remove the audio sink
void configureCorrections(bool dcOffsetCorrection, bool iqImbalanceCorrection, uint deviceIndex = 0); //!< Configure DSP corrections
DSPDeviceEngine::State state(uint deviceIndex = 0) const;
QString errorMessage(uint deviceIndex = 0); //!< Return the current error message
QString sourceDeviceDescription(uint deviceIndex = 0); //!< Return the source device description
// Serial DV methods:
bool hasDVSerialSupport()

View File

@ -104,7 +104,7 @@ MainWindow::MainWindow(QWidget* parent) :
qDebug() << "MainWindow::MainWindow: m_pluginManager->loadPlugins ...";
m_pluginManager = new PluginManager(this, m_dspEngine);
m_pluginManager = new PluginManager(this, m_dspEngine->getDeviceEngine(0));
m_pluginManager->loadPlugins();
//bool sampleSourceSignalsBlocked = ui->sampleSource->blockSignals(true);

View File

@ -5,16 +5,16 @@
#include "plugin/plugingui.h"
#include "settings/preset.h"
#include "mainwindow.h"
#include "dsp/dspengine.h"
#include "dsp/dspdeviceengine.h"
#include "dsp/samplesource.h"
#include <QDebug>
PluginManager::PluginManager(MainWindow* mainWindow, DSPEngine* dspEngine, QObject* parent) :
PluginManager::PluginManager(MainWindow* mainWindow, DSPDeviceEngine* dspDeviceEngine, QObject* parent) :
QObject(parent),
m_pluginAPI(this, mainWindow),
m_mainWindow(mainWindow),
m_dspEngine(dspEngine),
m_dspDeviceEngine(dspDeviceEngine),
m_sampleSourceId(),
m_sampleSourceSerial(),
m_sampleSourceSequence(0),
@ -207,7 +207,7 @@ void PluginManager::saveSourceSettings(Preset* preset)
void PluginManager::freeAll()
{
m_dspEngine->stopAcquistion();
m_dspDeviceEngine->stopAcquistion();
while(!m_channelInstanceRegistrations.isEmpty()) {
ChannelInstanceRegistration reg(m_channelInstanceRegistrations.takeLast());
@ -215,7 +215,7 @@ void PluginManager::freeAll()
}
if(m_sampleSourcePluginGUI != NULL) {
m_dspEngine->setSource(NULL);
m_dspDeviceEngine->setSource(NULL);
m_sampleSourcePluginGUI->destroy();
m_sampleSourcePluginGUI = NULL;
m_sampleSourceId.clear();
@ -282,11 +282,11 @@ int PluginManager::selectSampleSourceByIndex(int index)
{
qDebug("PluginManager::selectSampleSourceByIndex: index: %d", index);
m_dspEngine->stopAcquistion();
m_dspDeviceEngine->stopAcquistion();
if(m_sampleSourcePluginGUI != NULL) {
m_dspEngine->stopAcquistion();
m_dspEngine->setSource(NULL);
m_dspDeviceEngine->stopAcquistion();
m_dspDeviceEngine->setSource(NULL);
m_sampleSourcePluginGUI->destroy();
m_sampleSourcePluginGUI = NULL;
m_sampleSourceId.clear();
@ -317,7 +317,7 @@ int PluginManager::selectSampleSourceByIndex(int index)
<< " seq: " << m_sampleSourceSequence;
m_sampleSourcePluginGUI = m_sampleSourceDevices[index].m_plugin->createSampleSourcePluginGUI(m_sampleSourceId);
m_dspEngine->setSourceSequence(m_sampleSourceSequence);
m_dspDeviceEngine->setSourceSequence(m_sampleSourceSequence);
return index;
}
@ -328,11 +328,11 @@ int PluginManager::selectFirstSampleSource(const QString& sourceId)
int index = -1;
m_dspEngine->stopAcquistion();
m_dspDeviceEngine->stopAcquistion();
if(m_sampleSourcePluginGUI != NULL) {
m_dspEngine->stopAcquistion();
m_dspEngine->setSource(NULL);
m_dspDeviceEngine->stopAcquistion();
m_dspDeviceEngine->setSource(NULL);
m_sampleSourcePluginGUI->destroy();
m_sampleSourcePluginGUI = NULL;
m_sampleSourceId.clear();

View File

@ -14,6 +14,7 @@ class Preset;
class MainWindow;
class SampleSource;
class Message;
class DSPDeviceEngine;
class SDRANGEL_API PluginManager : public QObject {
Q_OBJECT
@ -34,7 +35,7 @@ public:
typedef QList<Plugin> Plugins;
explicit PluginManager(MainWindow* mainWindow, DSPEngine* dspEngine, QObject* parent = NULL);
explicit PluginManager(MainWindow* mainWindow, DSPDeviceEngine* dspDeviceEngine, QObject* parent = NULL);
~PluginManager();
void loadPlugins();
@ -121,7 +122,7 @@ private:
PluginAPI m_pluginAPI;
MainWindow* m_mainWindow;
DSPEngine* m_dspEngine;
DSPDeviceEngine* m_dspDeviceEngine;
Plugins m_plugins;
ChannelRegistrations m_channelRegistrations;