mirror of
https://github.com/f4exb/sdrangel.git
synced 2024-11-26 17:58:43 -05:00
Multi device support: add a unique ID to DSPDeviceEngine
This commit is contained in:
parent
66daf9fa4e
commit
6ef4653d35
@ -25,7 +25,8 @@
|
|||||||
#include "dsp/dspcommands.h"
|
#include "dsp/dspcommands.h"
|
||||||
#include "dsp/samplesource.h"
|
#include "dsp/samplesource.h"
|
||||||
|
|
||||||
DSPDeviceEngine::DSPDeviceEngine(QObject* parent) :
|
DSPDeviceEngine::DSPDeviceEngine(uint uid, QObject* parent) :
|
||||||
|
m_uid(uid),
|
||||||
QThread(parent),
|
QThread(parent),
|
||||||
m_state(StNotStarted),
|
m_state(StNotStarted),
|
||||||
m_sampleSource(0),
|
m_sampleSource(0),
|
||||||
|
@ -45,9 +45,11 @@ public:
|
|||||||
StError //!< engine is in error
|
StError //!< engine is in error
|
||||||
};
|
};
|
||||||
|
|
||||||
DSPDeviceEngine(QObject* parent = NULL);
|
DSPDeviceEngine(uint uid, QObject* parent = NULL);
|
||||||
~DSPDeviceEngine();
|
~DSPDeviceEngine();
|
||||||
|
|
||||||
|
uint getUID() const { return m_uid; }
|
||||||
|
|
||||||
MessageQueue* getInputMessageQueue() { return &m_inputMessageQueue; }
|
MessageQueue* getInputMessageQueue() { return &m_inputMessageQueue; }
|
||||||
MessageQueue* getOutputMessageQueue() { return &m_outputMessageQueue; }
|
MessageQueue* getOutputMessageQueue() { return &m_outputMessageQueue; }
|
||||||
|
|
||||||
@ -75,6 +77,8 @@ public:
|
|||||||
QString sourceDeviceDescription(); //!< Return the source device description
|
QString sourceDeviceDescription(); //!< Return the source device description
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
uint m_uid; //!< unique ID
|
||||||
|
|
||||||
MessageQueue m_inputMessageQueue; //<! Input message queue. Post here.
|
MessageQueue m_inputMessageQueue; //<! Input message queue. Post here.
|
||||||
MessageQueue m_outputMessageQueue; //<! Output message queue. Listen here.
|
MessageQueue m_outputMessageQueue; //<! Output message queue. Listen here.
|
||||||
SyncMessenger m_syncMessenger; //!< Used to process messages synchronously with the thread
|
SyncMessenger m_syncMessenger; //!< Used to process messages synchronously with the thread
|
||||||
|
@ -22,7 +22,7 @@
|
|||||||
DSPEngine::DSPEngine() :
|
DSPEngine::DSPEngine() :
|
||||||
m_audioSampleRate(48000) // Use default output device at 48 kHz
|
m_audioSampleRate(48000) // Use default output device at 48 kHz
|
||||||
{
|
{
|
||||||
m_deviceEngines.push_back(new DSPDeviceEngine());
|
m_deviceEngines.push_back(new DSPDeviceEngine(0)); // TODO: multi device support
|
||||||
m_dvSerialSupport = false;
|
m_dvSerialSupport = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -157,6 +157,23 @@ QString DSPEngine::errorMessage(uint deviceIndex)
|
|||||||
return m_deviceEngines[deviceIndex]->errorMessage();
|
return m_deviceEngines[deviceIndex]->errorMessage();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
DSPDeviceEngine *DSPEngine::getDeviceEngineByUID(uint uid)
|
||||||
|
{
|
||||||
|
std::vector<DSPDeviceEngine*>::iterator it = m_deviceEngines.begin();
|
||||||
|
|
||||||
|
while (it != m_deviceEngines.end())
|
||||||
|
{
|
||||||
|
if ((*it)->getUID() == uid)
|
||||||
|
{
|
||||||
|
return *it;
|
||||||
|
}
|
||||||
|
|
||||||
|
++it;
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
QString DSPEngine::sourceDeviceDescription(uint deviceIndex)
|
QString DSPEngine::sourceDeviceDescription(uint deviceIndex)
|
||||||
{
|
{
|
||||||
return m_deviceEngines[deviceIndex]->sourceDeviceDescription();
|
return m_deviceEngines[deviceIndex]->sourceDeviceDescription();
|
||||||
|
@ -65,7 +65,8 @@ public:
|
|||||||
QString errorMessage(uint deviceIndex = 0); //!< Return the current error message
|
QString errorMessage(uint deviceIndex = 0); //!< Return the current error message
|
||||||
QString sourceDeviceDescription(uint deviceIndex = 0); //!< Return the source device description
|
QString sourceDeviceDescription(uint deviceIndex = 0); //!< Return the source device description
|
||||||
|
|
||||||
DSPDeviceEngine *getDeviceEngine(uint deviceIndex) { return m_deviceEngines[deviceIndex]; }
|
DSPDeviceEngine *getDeviceEngineByIndex(uint deviceIndex) { return m_deviceEngines[deviceIndex]; }
|
||||||
|
DSPDeviceEngine *getDeviceEngineByUID(uint uid);
|
||||||
|
|
||||||
void addAudioSink(AudioFifo* audioFifo); //!< Add the audio sink
|
void addAudioSink(AudioFifo* audioFifo); //!< Add the audio sink
|
||||||
void removeAudioSink(AudioFifo* audioFifo); //!< Remove the audio sink
|
void removeAudioSink(AudioFifo* audioFifo); //!< Remove the audio sink
|
||||||
|
@ -104,7 +104,7 @@ MainWindow::MainWindow(QWidget* parent) :
|
|||||||
|
|
||||||
qDebug() << "MainWindow::MainWindow: m_pluginManager->loadPlugins ...";
|
qDebug() << "MainWindow::MainWindow: m_pluginManager->loadPlugins ...";
|
||||||
|
|
||||||
m_pluginManager = new PluginManager(this, m_dspEngine->getDeviceEngine(0));
|
m_pluginManager = new PluginManager(this, m_dspEngine->getDeviceEngineByIndex(0));
|
||||||
m_pluginManager->loadPlugins();
|
m_pluginManager->loadPlugins();
|
||||||
|
|
||||||
//bool sampleSourceSignalsBlocked = ui->sampleSource->blockSignals(true);
|
//bool sampleSourceSignalsBlocked = ui->sampleSource->blockSignals(true);
|
||||||
|
@ -133,6 +133,8 @@ private:
|
|||||||
QTreeWidgetItem* addPresetToTree(const Preset* preset);
|
QTreeWidgetItem* addPresetToTree(const Preset* preset);
|
||||||
void applySettings();
|
void applySettings();
|
||||||
|
|
||||||
|
void createDevice();
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void handleDSPMessages();
|
void handleDSPMessages();
|
||||||
void handleMessages();
|
void handleMessages();
|
||||||
|
Loading…
Reference in New Issue
Block a user