1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2024-11-16 05:11:49 -05:00

Device source plugins: implemented an init method for initializations to be done when all collaborating objects are created and possibly connected

This commit is contained in:
f4exb 2017-12-25 09:10:19 +01:00
parent c732fe3862
commit 49d1439981
30 changed files with 112 additions and 69 deletions

View File

@ -147,6 +147,11 @@ bool AirspyInput::openDevice()
return true; return true;
} }
void AirspyInput::init()
{
applySettings(m_settings, true);
}
bool AirspyInput::start() bool AirspyInput::start()
{ {
QMutexLocker mutexLocker(&m_mutex); QMutexLocker mutexLocker(&m_mutex);

View File

@ -94,6 +94,7 @@ public:
virtual ~AirspyInput(); virtual ~AirspyInput();
virtual void destroy(); virtual void destroy();
virtual void init();
virtual bool start(); virtual bool start();
virtual void stop(); virtual void stop();

View File

@ -131,6 +131,11 @@ bool BladerfInput::openDevice()
return true; return true;
} }
void BladerfInput::init()
{
applySettings(m_settings, true);
}
bool BladerfInput::start() bool BladerfInput::start()
{ {
// QMutexLocker mutexLocker(&m_mutex); // QMutexLocker mutexLocker(&m_mutex);

View File

@ -97,6 +97,7 @@ public:
virtual ~BladerfInput(); virtual ~BladerfInput();
virtual void destroy(); virtual void destroy();
virtual void init();
virtual bool start(); virtual bool start();
virtual void stop(); virtual void stop();

View File

@ -91,6 +91,11 @@ bool FCDProInput::openDevice()
return true; return true;
} }
void FCDProInput::init()
{
applySettings(m_settings, true);
}
bool FCDProInput::start() bool FCDProInput::start()
{ {
qDebug() << "FCDProInput::start"; qDebug() << "FCDProInput::start";

View File

@ -101,6 +101,7 @@ public:
virtual ~FCDProInput(); virtual ~FCDProInput();
virtual void destroy(); virtual void destroy();
virtual void init();
virtual bool start(); virtual bool start();
virtual void stop(); virtual void stop();

View File

@ -84,6 +84,11 @@ bool FCDProPlusInput::openDevice()
return true; return true;
} }
void FCDProPlusInput::init()
{
applySettings(m_settings, true);
}
bool FCDProPlusInput::start() bool FCDProPlusInput::start()
{ {

View File

@ -100,6 +100,7 @@ public:
virtual ~FCDProPlusInput(); virtual ~FCDProPlusInput();
virtual void destroy(); virtual void destroy();
virtual void init();
virtual bool start(); virtual bool start();
virtual void stop(); virtual void stop();

View File

@ -121,6 +121,12 @@ void FileSourceInput::seekFileStream(int seekPercentage)
} }
} }
void FileSourceInput::init()
{
DSPSignalNotification *notif = new DSPSignalNotification(m_settings.m_sampleRate, m_settings.m_centerFrequency);
m_deviceAPI->getDeviceEngineInputMessageQueue()->push(notif);
}
bool FileSourceInput::start() bool FileSourceInput::start()
{ {
QMutexLocker mutexLocker(&m_mutex); QMutexLocker mutexLocker(&m_mutex);

View File

@ -226,6 +226,7 @@ public:
virtual ~FileSourceInput(); virtual ~FileSourceInput();
virtual void destroy(); virtual void destroy();
virtual void init();
virtual bool start(); virtual bool start();
virtual void stop(); virtual void stop();

View File

@ -119,6 +119,11 @@ bool HackRFInput::openDevice()
return true; return true;
} }
void HackRFInput::init()
{
applySettings(m_settings, true);
}
bool HackRFInput::start() bool HackRFInput::start()
{ {
// QMutexLocker mutexLocker(&m_mutex); // QMutexLocker mutexLocker(&m_mutex);

View File

@ -114,6 +114,7 @@ public:
virtual ~HackRFInput(); virtual ~HackRFInput();
virtual void destroy(); virtual void destroy();
virtual void init();
virtual bool start(); virtual bool start();
virtual void stop(); virtual void stop();

View File

@ -364,6 +364,11 @@ void LimeSDRInput::releaseChannel()
m_channelAcquired = false; m_channelAcquired = false;
} }
void LimeSDRInput::init()
{
applySettings(m_settings, true, false);
}
bool LimeSDRInput::start() bool LimeSDRInput::start()
{ {
if (!m_deviceShared.m_deviceParams->getDevice()) { if (!m_deviceShared.m_deviceParams->getDevice()) {

View File

@ -208,6 +208,7 @@ public:
virtual ~LimeSDRInput(); virtual ~LimeSDRInput();
virtual void destroy(); virtual void destroy();
virtual void init();
virtual bool start(); virtual bool start();
virtual void stop(); virtual void stop();

View File

@ -68,6 +68,11 @@ void PlutoSDRInput::destroy()
delete this; delete this;
} }
void PlutoSDRInput::init()
{
applySettings(m_settings, true);
}
bool PlutoSDRInput::start() bool PlutoSDRInput::start()
{ {
if (!m_deviceShared.m_deviceParams->getBox()) { if (!m_deviceShared.m_deviceParams->getBox()) {

View File

@ -96,6 +96,7 @@ public:
~PlutoSDRInput(); ~PlutoSDRInput();
virtual void destroy(); virtual void destroy();
virtual void init();
virtual bool start(); virtual bool start();
virtual void stop(); virtual void stop();

View File

@ -173,6 +173,11 @@ bool RTLSDRInput::openDevice()
return true; return true;
} }
void RTLSDRInput::init()
{
applySettings(m_settings, true);
}
bool RTLSDRInput::start() bool RTLSDRInput::start()
{ {
QMutexLocker mutexLocker(&m_mutex); QMutexLocker mutexLocker(&m_mutex);

View File

@ -95,6 +95,7 @@ public:
virtual ~RTLSDRInput(); virtual ~RTLSDRInput();
virtual void destroy(); virtual void destroy();
virtual void init();
virtual bool start(); virtual bool start();
virtual void stop(); virtual void stop();

View File

@ -77,6 +77,12 @@ void SDRdaemonSourceInput::destroy()
delete this; delete this;
} }
void SDRdaemonSourceInput::init()
{
DSPSignalNotification *notif = new DSPSignalNotification(m_settings.m_sampleRate/(1<<m_settings.m_log2Decim), m_settings.m_centerFrequency);
m_deviceAPI->getDeviceEngineInputMessageQueue()->push(notif);
}
bool SDRdaemonSourceInput::start() bool SDRdaemonSourceInput::start()
{ {
qDebug() << "SDRdaemonInput::start"; qDebug() << "SDRdaemonInput::start";

View File

@ -326,6 +326,7 @@ public:
virtual ~SDRdaemonSourceInput(); virtual ~SDRdaemonSourceInput();
virtual void destroy(); virtual void destroy();
virtual void init();
virtual bool start(); virtual bool start();
virtual void stop(); virtual void stop();

View File

@ -26,7 +26,7 @@ void SDRdaemonSourceSettings::resetToDefaults()
{ {
m_centerFrequency = 435000*1000; m_centerFrequency = 435000*1000;
m_sampleRate = 256000; m_sampleRate = 256000;
m_log2Decim = 4; m_log2Decim = 1;
m_txDelay = 0.5; m_txDelay = 0.5;
m_nbFECBlocks = 0; m_nbFECBlocks = 0;
m_address = "127.0.0.1"; m_address = "127.0.0.1";

View File

@ -34,6 +34,7 @@ SDRdaemonSourceUDPHandler::SDRdaemonSourceUDPHandler(SampleSinkFifo *sampleFifo,
m_remoteAddress(QHostAddress::LocalHost), m_remoteAddress(QHostAddress::LocalHost),
m_dataPort(9090), m_dataPort(9090),
m_dataConnected(false), m_dataConnected(false),
m_startInit(true),
m_udpBuf(0), m_udpBuf(0),
m_udpReadBytes(0), m_udpReadBytes(0),
m_sampleFifo(sampleFifo), m_sampleFifo(sampleFifo),
@ -92,8 +93,8 @@ void SDRdaemonSourceUDPHandler::start()
} }
} }
// Need to notify the DSP engine to actually start // Need to notify the DSP engine to actually start FIXME: may cause transient confusion because at this point sample rate and frequency are unknown
DSPSignalNotification *notif = new DSPSignalNotification(m_samplerate, m_centerFrequency * 1000); // Frequency in Hz for the DSP engine DSPSignalNotification *notif = new DSPSignalNotification(128000, 435000 * 1000); // Frequency in Hz for the DSP engine
m_deviceAPI->getDeviceEngineInputMessageQueue()->push(notif); m_deviceAPI->getDeviceEngineInputMessageQueue()->push(notif);
m_elapsedTimer.start(); m_elapsedTimer.start();
} }
@ -113,6 +114,8 @@ void SDRdaemonSourceUDPHandler::stop()
delete m_dataSocket; delete m_dataSocket;
m_dataSocket = 0; m_dataSocket = 0;
} }
m_startInit = true;
} }
void SDRdaemonSourceUDPHandler::configureUDPLink(const QString& address, quint16 port) void SDRdaemonSourceUDPHandler::configureUDPLink(const QString& address, quint16 port)
@ -170,17 +173,23 @@ void SDRdaemonSourceUDPHandler::processData()
change = true; change = true;
} }
if (change) if (change || m_startInit)
{ {
DSPSignalNotification *notif = new DSPSignalNotification(m_samplerate, m_centerFrequency * 1000); // Frequency in Hz for the DSP engine qDebug("SDRdaemonSourceUDPHandler::processData: m_samplerate: %u m_centerFrequency: %u kHz", m_samplerate, m_centerFrequency);
m_deviceAPI->getDeviceEngineInputMessageQueue()->push(notif);
SDRdaemonSourceInput::MsgReportSDRdaemonSourceStreamData *report = SDRdaemonSourceInput::MsgReportSDRdaemonSourceStreamData::create(
m_samplerate,
m_centerFrequency * 1000, // Frequency in Hz for the GUI
m_tv_sec,
m_tv_usec);
m_outputMessageQueueToGUI->push(report); if (m_samplerate != 0)
{
DSPSignalNotification *notif = new DSPSignalNotification(m_samplerate, m_centerFrequency * 1000); // Frequency in Hz for the DSP engine
m_deviceAPI->getDeviceEngineInputMessageQueue()->push(notif);
SDRdaemonSourceInput::MsgReportSDRdaemonSourceStreamData *report = SDRdaemonSourceInput::MsgReportSDRdaemonSourceStreamData::create(
m_samplerate,
m_centerFrequency * 1000, // Frequency in Hz for the GUI
m_tv_sec,
m_tv_usec);
m_outputMessageQueueToGUI->push(report);
m_startInit = false;
}
} }
} }

View File

@ -56,6 +56,7 @@ private:
QHostAddress m_remoteAddress; QHostAddress m_remoteAddress;
quint16 m_dataPort; quint16 m_dataPort;
bool m_dataConnected; bool m_dataConnected;
bool m_startInit;
char *m_udpBuf; char *m_udpBuf;
qint64 m_udpReadBytes; qint64 m_udpReadBytes;
SampleSinkFifo *m_sampleFifo; SampleSinkFifo *m_sampleFifo;

View File

@ -198,6 +198,11 @@ void SDRPlayInput::closeDevice()
m_deviceDescription.clear(); m_deviceDescription.clear();
} }
void SDRPlayInput::init()
{
applySettings(m_settings, true, true);
}
void SDRPlayInput::stop() void SDRPlayInput::stop()
{ {
// QMutexLocker mutexLocker(&m_mutex); // QMutexLocker mutexLocker(&m_mutex);

View File

@ -132,6 +132,7 @@ public:
virtual ~SDRPlayInput(); virtual ~SDRPlayInput();
virtual void destroy(); virtual void destroy();
virtual void init();
virtual bool start(); virtual bool start();
virtual void stop(); virtual void stop();

View File

@ -38,6 +38,7 @@ public:
virtual ~DeviceSampleSource(); virtual ~DeviceSampleSource();
virtual void destroy() = 0; virtual void destroy() = 0;
virtual void init() = 0; //!< initializations to be done when all collaborating objects are created and possibly connected
virtual bool start() = 0; virtual bool start() = 0;
virtual void stop() = 0; virtual void stop() = 0;

View File

@ -365,8 +365,6 @@ DSPDeviceSinkEngine::State DSPDeviceSinkEngine::gotoIdle()
DSPDeviceSinkEngine::State DSPDeviceSinkEngine::gotoInit() DSPDeviceSinkEngine::State DSPDeviceSinkEngine::gotoInit()
{ {
qDebug() << "DSPDeviceSinkEngine::gotoInit";
switch(m_state) { switch(m_state) {
case StNotStarted: case StNotStarted:
return StNotStarted; return StNotStarted;
@ -393,7 +391,8 @@ DSPDeviceSinkEngine::State DSPDeviceSinkEngine::gotoInit()
m_centerFrequency = m_deviceSampleSink->getCenterFrequency(); m_centerFrequency = m_deviceSampleSink->getCenterFrequency();
m_sampleRate = m_deviceSampleSink->getSampleRate(); m_sampleRate = m_deviceSampleSink->getSampleRate();
qDebug() << "DSPDeviceSinkEngine::gotoInit: " << m_deviceDescription.toStdString().c_str() << ": " qDebug() << "DSPDeviceSinkEngine::gotoInit: "
<< " m_deviceDescription: " << m_deviceDescription.toStdString().c_str()
<< " sampleRate: " << m_sampleRate << " sampleRate: " << m_sampleRate
<< " centerFrequency: " << m_centerFrequency; << " centerFrequency: " << m_centerFrequency;

View File

@ -365,8 +365,6 @@ DSPDeviceSourceEngine::State DSPDeviceSourceEngine::gotoIdle()
DSPDeviceSourceEngine::State DSPDeviceSourceEngine::gotoInit() DSPDeviceSourceEngine::State DSPDeviceSourceEngine::gotoInit()
{ {
qDebug() << "DSPDeviceSourceEngine::gotoInit";
switch(m_state) { switch(m_state) {
case StNotStarted: case StNotStarted:
return StNotStarted; return StNotStarted;
@ -398,7 +396,8 @@ DSPDeviceSourceEngine::State DSPDeviceSourceEngine::gotoInit()
m_centerFrequency = m_deviceSampleSource->getCenterFrequency(); m_centerFrequency = m_deviceSampleSource->getCenterFrequency();
m_sampleRate = m_deviceSampleSource->getSampleRate(); m_sampleRate = m_deviceSampleSource->getSampleRate();
qDebug() << "DSPDeviceSourceEngine::gotoInit: " << m_deviceDescription.toStdString().c_str() << ": " qDebug() << "DSPDeviceSourceEngine::gotoInit: "
<< " m_deviceDescription: " << m_deviceDescription.toStdString().c_str()
<< " sampleRate: " << m_sampleRate << " sampleRate: " << m_sampleRate
<< " centerFrequency: " << m_centerFrequency; << " centerFrequency: " << m_centerFrequency;
@ -651,6 +650,7 @@ void DSPDeviceSourceEngine::handleInputMessages()
// forward changes to source GUI input queue // forward changes to source GUI input queue
MessageQueue *guiMessageQueue = m_deviceSampleSource->getMessageQueueToGUI(); MessageQueue *guiMessageQueue = m_deviceSampleSource->getMessageQueueToGUI();
qDebug("DSPDeviceSourceEngine::handleInputMessages: DSPSignalNotification: guiMessageQueue: %p", guiMessageQueue);
if (guiMessageQueue) { if (guiMessageQueue) {
DSPSignalNotification* rep = new DSPSignalNotification(*notif); // make a copy for the source GUI DSPSignalNotification* rep = new DSPSignalNotification(*notif); // make a copy for the source GUI

View File

@ -144,54 +144,14 @@ MainWindow::MainWindow(qtwebapp::LoggerWithFile *logger, const MainParser& parse
m_masterTimer.start(50); m_masterTimer.start(50);
qDebug() << "MainWindow::MainWindow: add the first device...";
addSourceDevice(); // add the first device
qDebug() << "MainWindow::MainWindow: load settings..."; qDebug() << "MainWindow::MainWindow: load settings...";
loadSettings(); loadSettings();
qDebug() << "MainWindow::MainWindow: select SampleSource from settings..."; qDebug() << "MainWindow::MainWindow: select SampleSource from settings or default (file source) ...";
int deviceIndex = DeviceEnumerator::instance()->getRxSamplingDeviceIndex(m_settings.getSourceDeviceId(), m_settings.getSourceIndex()); int deviceIndex = DeviceEnumerator::instance()->getRxSamplingDeviceIndex(m_settings.getSourceDeviceId(), m_settings.getSourceIndex());
addSourceDevice(deviceIndex); // add the first device set with file source device as default if device in settings is not enumerated
if (deviceIndex >= 0)
{
// delete previous plugin GUI
m_deviceUIs.back()->m_deviceSourceAPI->getPluginInterface()->deleteSampleSourcePluginInstanceGUI(
m_deviceUIs.back()->m_deviceSourceAPI->getSampleSourcePluginInstanceGUI());
m_deviceUIs.back()->m_deviceSourceAPI->resetSampleSourceId();
m_deviceUIs.back()->m_deviceSourceAPI->getSampleSource()->setMessageQueueToGUI(0); // have source stop sending messages to the GUI
m_deviceUIs.back()->m_deviceSourceAPI->getPluginInterface()->deleteSampleSourcePluginInstanceInput(
m_deviceUIs.back()->m_deviceSourceAPI->getSampleSource());
m_deviceUIs.back()->m_deviceSourceAPI->clearBuddiesLists(); // clear old API buddies lists
m_deviceUIs.back()->m_samplingDeviceControl->setSelectedDeviceIndex(deviceIndex);
PluginInterface::SamplingDevice samplingDevice = DeviceEnumerator::instance()->getRxSamplingDevice(deviceIndex);
m_deviceUIs.back()->m_deviceSourceAPI->setSampleSourceSequence(samplingDevice.sequence);
m_deviceUIs.back()->m_deviceSourceAPI->setNbItems(samplingDevice.deviceItemIndex);
m_deviceUIs.back()->m_deviceSourceAPI->setItemIndex(samplingDevice.deviceItemIndex);
m_deviceUIs.back()->m_deviceSourceAPI->setHardwareId(samplingDevice.hardwareId);
m_deviceUIs.back()->m_deviceSourceAPI->setSampleSourceId(samplingDevice.id);
m_deviceUIs.back()->m_deviceSourceAPI->setSampleSourceSerial(samplingDevice.serial);
m_deviceUIs.back()->m_deviceSourceAPI->setSampleSourceDisplayName(samplingDevice.displayedName);
m_deviceUIs.back()->m_deviceSourceAPI->setSampleSourcePluginInterface(DeviceEnumerator::instance()->getRxPluginInterface(deviceIndex));
DeviceSampleSource *source = m_deviceUIs.back()->m_deviceSourceAPI->getPluginInterface()->createSampleSourcePluginInstanceInput(
m_deviceUIs.back()->m_deviceSourceAPI->getSampleSourceId(), m_deviceUIs.back()->m_deviceSourceAPI);
m_deviceUIs.back()->m_deviceSourceAPI->setSampleSource(source);
QWidget *gui;
PluginInstanceGUI *pluginGUI = m_deviceUIs.back()->m_deviceSourceAPI->getPluginInterface()->createSampleSourcePluginInstanceGUI(
m_deviceUIs.back()->m_deviceSourceAPI->getSampleSourceId(),
&gui,
m_deviceUIs.back());
m_deviceUIs.back()->m_deviceSourceAPI->getSampleSource()->setMessageQueueToGUI(pluginGUI->getInputMessageQueue());
m_deviceUIs.back()->m_deviceSourceAPI->setSampleSourcePluginInstanceGUI(pluginGUI);
setDeviceGUI(0, gui, m_deviceUIs.back()->m_deviceSourceAPI->getSampleSourceDisplayName());
}
m_deviceUIs.back()->m_deviceSourceAPI->setBuddyLeader(true); // the first device is always the leader m_deviceUIs.back()->m_deviceSourceAPI->setBuddyLeader(true); // the first device is always the leader
qDebug() << "MainWindow::MainWindow: load current preset settings..."; qDebug() << "MainWindow::MainWindow: load current preset settings...";
@ -234,7 +194,7 @@ MainWindow::~MainWindow()
delete m_logger; delete m_logger;
} }
void MainWindow::addSourceDevice() void MainWindow::addSourceDevice(int deviceIndex)
{ {
DSPDeviceSourceEngine *dspDeviceSourceEngine = m_dspEngine->addDeviceSourceEngine(); DSPDeviceSourceEngine *dspDeviceSourceEngine = m_dspEngine->addDeviceSourceEngine();
dspDeviceSourceEngine->start(); dspDeviceSourceEngine->start();
@ -271,9 +231,12 @@ void MainWindow::addSourceDevice()
ui->tabInputsSelect->addTab(m_deviceUIs.back()->m_samplingDeviceControl, tabNameCStr); ui->tabInputsSelect->addTab(m_deviceUIs.back()->m_samplingDeviceControl, tabNameCStr);
ui->tabInputsSelect->setTabToolTip(deviceTabIndex, QString(uidCStr)); ui->tabInputsSelect->setTabToolTip(deviceTabIndex, QString(uidCStr));
// Create a file source instance by default // Create a file source instance by default if requested device was not enumerated (index = -1)
int fileSourceDeviceIndex = DeviceEnumerator::instance()->getFileSourceDeviceIndex(); if (deviceIndex < 0) {
PluginInterface::SamplingDevice samplingDevice = DeviceEnumerator::instance()->getRxSamplingDevice(fileSourceDeviceIndex); deviceIndex = DeviceEnumerator::instance()->getFileSourceDeviceIndex();
}
PluginInterface::SamplingDevice samplingDevice = DeviceEnumerator::instance()->getRxSamplingDevice(deviceIndex);
m_deviceUIs.back()->m_deviceSourceAPI->setSampleSourceSequence(samplingDevice.sequence); m_deviceUIs.back()->m_deviceSourceAPI->setSampleSourceSequence(samplingDevice.sequence);
m_deviceUIs.back()->m_deviceSourceAPI->setNbItems(samplingDevice.deviceNbItems); m_deviceUIs.back()->m_deviceSourceAPI->setNbItems(samplingDevice.deviceNbItems);
m_deviceUIs.back()->m_deviceSourceAPI->setItemIndex(samplingDevice.deviceItemIndex); m_deviceUIs.back()->m_deviceSourceAPI->setItemIndex(samplingDevice.deviceItemIndex);
@ -281,9 +244,9 @@ void MainWindow::addSourceDevice()
m_deviceUIs.back()->m_deviceSourceAPI->setSampleSourceId(samplingDevice.id); m_deviceUIs.back()->m_deviceSourceAPI->setSampleSourceId(samplingDevice.id);
m_deviceUIs.back()->m_deviceSourceAPI->setSampleSourceSerial(samplingDevice.serial); m_deviceUIs.back()->m_deviceSourceAPI->setSampleSourceSerial(samplingDevice.serial);
m_deviceUIs.back()->m_deviceSourceAPI->setSampleSourceDisplayName(samplingDevice.displayedName); m_deviceUIs.back()->m_deviceSourceAPI->setSampleSourceDisplayName(samplingDevice.displayedName);
m_deviceUIs.back()->m_deviceSourceAPI->setSampleSourcePluginInterface(DeviceEnumerator::instance()->getRxPluginInterface(fileSourceDeviceIndex)); m_deviceUIs.back()->m_deviceSourceAPI->setSampleSourcePluginInterface(DeviceEnumerator::instance()->getRxPluginInterface(deviceIndex));
m_deviceUIs.back()->m_samplingDeviceControl->setSelectedDeviceIndex(fileSourceDeviceIndex); m_deviceUIs.back()->m_samplingDeviceControl->setSelectedDeviceIndex(deviceIndex);
// delete previous plugin GUI // delete previous plugin GUI
m_deviceUIs.back()->m_deviceSourceAPI->getPluginInterface()->deleteSampleSourcePluginInstanceGUI( m_deviceUIs.back()->m_deviceSourceAPI->getPluginInterface()->deleteSampleSourcePluginInstanceGUI(
@ -300,6 +263,7 @@ void MainWindow::addSourceDevice()
m_deviceUIs.back()); m_deviceUIs.back());
m_deviceUIs.back()->m_deviceSourceAPI->getSampleSource()->setMessageQueueToGUI(pluginGUI->getInputMessageQueue()); m_deviceUIs.back()->m_deviceSourceAPI->getSampleSource()->setMessageQueueToGUI(pluginGUI->getInputMessageQueue());
m_deviceUIs.back()->m_deviceSourceAPI->setSampleSourcePluginInstanceGUI(pluginGUI); m_deviceUIs.back()->m_deviceSourceAPI->setSampleSourcePluginInstanceGUI(pluginGUI);
m_deviceUIs.back()->m_deviceSourceAPI->getSampleSource()->init();
setDeviceGUI(deviceTabIndex, gui, m_deviceUIs.back()->m_deviceSourceAPI->getSampleSourceDisplayName()); setDeviceGUI(deviceTabIndex, gui, m_deviceUIs.back()->m_deviceSourceAPI->getSampleSourceDisplayName());
} }
@ -735,7 +699,7 @@ bool MainWindow::handleMessage(const Message& cmd)
if (notif.isTx()) { if (notif.isTx()) {
addSinkDevice(); addSinkDevice();
} else { } else {
addSourceDevice(); addSourceDevice(-1); // create with file source device by default
} }
return true; return true;
@ -1130,6 +1094,7 @@ void MainWindow::on_sampleSource_changed()
deviceUI->m_deviceSourceAPI->getSampleSource()->setMessageQueueToGUI(pluginUI->getInputMessageQueue()); deviceUI->m_deviceSourceAPI->getSampleSource()->setMessageQueueToGUI(pluginUI->getInputMessageQueue());
deviceUI->m_deviceSourceAPI->setSampleSourcePluginInstanceGUI(pluginUI); deviceUI->m_deviceSourceAPI->setSampleSourcePluginInstanceGUI(pluginUI);
setDeviceGUI(currentSourceTabIndex, gui, deviceUI->m_deviceSourceAPI->getSampleSourceDisplayName()); setDeviceGUI(currentSourceTabIndex, gui, deviceUI->m_deviceSourceAPI->getSampleSourceDisplayName());
deviceUI->m_deviceSourceAPI->getSampleSource()->init();
deviceUI->m_deviceSourceAPI->loadSourceSettings(m_settings.getWorkingPreset()); // load new API settings deviceUI->m_deviceSourceAPI->loadSourceSettings(m_settings.getWorkingPreset()); // load new API settings
@ -1257,7 +1222,7 @@ void MainWindow::on_action_About_triggered()
void MainWindow::on_action_addSourceDevice_triggered() void MainWindow::on_action_addSourceDevice_triggered()
{ {
addSourceDevice(); addSourceDevice(-1); // create with file source device by default
} }
void MainWindow::on_action_addSinkDevice_triggered() void MainWindow::on_action_addSinkDevice_triggered()

View File

@ -319,7 +319,7 @@ private:
QTreeWidgetItem* addPresetToTree(const Preset* preset); QTreeWidgetItem* addPresetToTree(const Preset* preset);
void applySettings(); void applySettings();
void addSourceDevice(); void addSourceDevice(int deviceIndex);
void addSinkDevice(); void addSinkDevice();
void removeLastDevice(); void removeLastDevice();
void deleteChannel(int deviceSetIndex, int channelIndex); void deleteChannel(int deviceSetIndex, int channelIndex);