mirror of
https://github.com/f4exb/sdrangel.git
synced 2024-12-17 23:28:50 -05:00
Multi device support: Main window: created a method to add a new device and associated objects
This commit is contained in:
parent
7053d3775c
commit
df661cc366
@ -20,10 +20,11 @@
|
||||
#include "dsp/dspengine.h"
|
||||
|
||||
DSPEngine::DSPEngine() :
|
||||
m_deviceEnginesUIDSequence(0),
|
||||
m_audioSampleRate(48000), // Use default output device at 48 kHz
|
||||
m_audioUsageCount(0)
|
||||
{
|
||||
m_deviceEngines.push_back(new DSPDeviceEngine(0)); // TODO: multi device support
|
||||
//m_deviceEngines.push_back(new DSPDeviceEngine(0)); // TODO: multi device support
|
||||
m_dvSerialSupport = false;
|
||||
}
|
||||
|
||||
@ -44,6 +45,23 @@ DSPEngine *DSPEngine::instance()
|
||||
return dspEngine;
|
||||
}
|
||||
|
||||
DSPDeviceEngine *DSPEngine::addDeviceEngine()
|
||||
{
|
||||
m_deviceEngines.push_back(new DSPDeviceEngine(m_deviceEnginesUIDSequence));
|
||||
m_deviceEnginesUIDSequence++;
|
||||
return m_deviceEngines.back();
|
||||
}
|
||||
|
||||
void DSPEngine::removeLastDeviceEngine()
|
||||
{
|
||||
if (m_deviceEngines.size() > 0)
|
||||
{
|
||||
DSPDeviceEngine *lastDeviceEngine = m_deviceEngines.back();
|
||||
delete lastDeviceEngine;
|
||||
m_deviceEngines.pop_back();
|
||||
}
|
||||
}
|
||||
|
||||
void DSPEngine::stopAllAcquisitions()
|
||||
{
|
||||
std::vector<DSPDeviceEngine*>::iterator it = m_deviceEngines.begin();
|
||||
|
@ -40,6 +40,8 @@ public:
|
||||
|
||||
uint getAudioSampleRate() const { return m_audioSampleRate; }
|
||||
|
||||
DSPDeviceEngine *addDeviceEngine();
|
||||
void removeLastDeviceEngine();
|
||||
void stopAllAcquisitions();
|
||||
void stopAllDeviceEngines();
|
||||
|
||||
@ -81,6 +83,7 @@ public:
|
||||
|
||||
private:
|
||||
std::vector<DSPDeviceEngine*> m_deviceEngines;
|
||||
uint m_deviceEnginesUIDSequence;
|
||||
AudioOutput m_audioOutput;
|
||||
uint m_audioSampleRate;
|
||||
bool m_dvSerialSupport;
|
||||
|
@ -102,25 +102,25 @@ MainWindow::MainWindow(QWidget* parent) :
|
||||
|
||||
qDebug() << "MainWindow::MainWindow: m_pluginManager->loadPlugins ...";
|
||||
|
||||
// TODO: This will go in a create new device and device tab method:
|
||||
addDevice(); // add the first device
|
||||
|
||||
DSPDeviceEngine *dspDeviceEngine = m_dspEngine->getDeviceEngineByIndex(0);
|
||||
dspDeviceEngine->start();
|
||||
|
||||
m_deviceUIs.push_back(new DeviceUISet(m_masterTimer));
|
||||
|
||||
m_pluginManager = new PluginManager(this, dspDeviceEngine, m_deviceUIs.back()->m_spectrum);
|
||||
m_pluginManager->loadPlugins();
|
||||
|
||||
ui->tabSpectra->addTab(m_deviceUIs.back()->m_spectrum, "X0");
|
||||
ui->tabSpectraGUI->addTab(m_deviceUIs.back()->m_spectrumGUI, "X0");
|
||||
dspDeviceEngine->addSink(m_deviceUIs.back()->m_spectrumVis);
|
||||
ui->tabChannels->addTab(m_deviceUIs.back()->m_channelWindow, "X0");
|
||||
bool sampleSourceSignalsBlocked = m_deviceUIs.back()->m_sampleSource->blockSignals(true);
|
||||
m_pluginManager->fillSampleSourceSelector(m_deviceUIs.back()->m_sampleSource);
|
||||
connect(m_deviceUIs.back()->m_sampleSource, SIGNAL(currentIndexChanged(int)), this, SLOT(on_sampleSource_currentIndexChanged(int)));
|
||||
m_deviceUIs.back()->m_sampleSource->blockSignals(sampleSourceSignalsBlocked);
|
||||
ui->tabInputs->addTab(m_deviceUIs.back()->m_sampleSource, "X0");
|
||||
// DSPDeviceEngine *dspDeviceEngine = m_dspEngine->addDeviceEngine();
|
||||
// dspDeviceEngine->start();
|
||||
//
|
||||
// m_deviceUIs.push_back(new DeviceUISet(m_masterTimer));
|
||||
//
|
||||
// m_pluginManager = new PluginManager(this, dspDeviceEngine, m_deviceUIs.back()->m_spectrum);
|
||||
// m_pluginManager->loadPlugins();
|
||||
//
|
||||
// ui->tabSpectra->addTab(m_deviceUIs.back()->m_spectrum, "X0");
|
||||
// ui->tabSpectraGUI->addTab(m_deviceUIs.back()->m_spectrumGUI, "X0");
|
||||
// dspDeviceEngine->addSink(m_deviceUIs.back()->m_spectrumVis);
|
||||
// ui->tabChannels->addTab(m_deviceUIs.back()->m_channelWindow, "X0");
|
||||
// bool sampleSourceSignalsBlocked = m_deviceUIs.back()->m_sampleSource->blockSignals(true);
|
||||
// m_pluginManager->fillSampleSourceSelector(m_deviceUIs.back()->m_sampleSource);
|
||||
// connect(m_deviceUIs.back()->m_sampleSource, SIGNAL(currentIndexChanged(int)), this, SLOT(on_sampleSource_currentIndexChanged(int)));
|
||||
// m_deviceUIs.back()->m_sampleSource->blockSignals(sampleSourceSignalsBlocked);
|
||||
// ui->tabInputs->addTab(m_deviceUIs.back()->m_sampleSource, "X0");
|
||||
|
||||
qDebug() << "MainWindow::MainWindow: loadSettings...";
|
||||
|
||||
@ -180,6 +180,30 @@ MainWindow::~MainWindow()
|
||||
delete ui;
|
||||
}
|
||||
|
||||
void MainWindow::addDevice()
|
||||
{
|
||||
DSPDeviceEngine *dspDeviceEngine = m_dspEngine->addDeviceEngine();
|
||||
dspDeviceEngine->start();
|
||||
|
||||
char tabNameCStr[16];
|
||||
sprintf(tabNameCStr, "R%d", dspDeviceEngine->getUID());
|
||||
|
||||
m_deviceUIs.push_back(new DeviceUISet(m_masterTimer));
|
||||
|
||||
m_pluginManager = new PluginManager(this, dspDeviceEngine, m_deviceUIs.back()->m_spectrum);
|
||||
m_pluginManager->loadPlugins();
|
||||
|
||||
ui->tabSpectra->addTab(m_deviceUIs.back()->m_spectrum, tabNameCStr);
|
||||
ui->tabSpectraGUI->addTab(m_deviceUIs.back()->m_spectrumGUI, tabNameCStr);
|
||||
dspDeviceEngine->addSink(m_deviceUIs.back()->m_spectrumVis);
|
||||
ui->tabChannels->addTab(m_deviceUIs.back()->m_channelWindow, tabNameCStr);
|
||||
bool sampleSourceSignalsBlocked = m_deviceUIs.back()->m_sampleSource->blockSignals(true);
|
||||
m_pluginManager->fillSampleSourceSelector(m_deviceUIs.back()->m_sampleSource);
|
||||
connect(m_deviceUIs.back()->m_sampleSource, SIGNAL(currentIndexChanged(int)), this, SLOT(on_sampleSource_currentIndexChanged(int)));
|
||||
m_deviceUIs.back()->m_sampleSource->blockSignals(sampleSourceSignalsBlocked);
|
||||
ui->tabInputs->addTab(m_deviceUIs.back()->m_sampleSource, tabNameCStr);
|
||||
}
|
||||
|
||||
void MainWindow::addChannelCreateAction(QAction* action)
|
||||
{
|
||||
ui->menu_Channels->addAction(action);
|
||||
|
@ -126,7 +126,8 @@ private:
|
||||
QTreeWidgetItem* addPresetToTree(const Preset* preset);
|
||||
void applySettings();
|
||||
|
||||
void createDevice();
|
||||
void addDevice();
|
||||
void removeLastDevice();
|
||||
|
||||
private slots:
|
||||
void handleMessages();
|
||||
|
Loading…
Reference in New Issue
Block a user