1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2024-11-24 00:48:41 -05:00

Main server: wait for set sample source/sink/MIMO to complete before loading the device settings. For #2294

This commit is contained in:
f4exb 2024-11-01 10:32:39 +01:00
parent 618e234d6c
commit bd67d553ea

View File

@ -495,11 +495,20 @@ void MainServer::changeSampleSource(int deviceSetIndex, int selectedDeviceIndex)
DeviceSampleSource *source = deviceSet->m_deviceAPI->getPluginInterface()->createSampleSourcePluginInstance(
deviceSet->m_deviceAPI->getSamplingDeviceId(), deviceSet->m_deviceAPI);
deviceSet->m_deviceAPI->setSampleSource(source);
// wait for sample source to be set, before loading settings
auto connection = new QMetaObject::Connection();
*connection = connect(
deviceSet->m_deviceSourceEngine,
&DSPDeviceSourceEngine::sampleSet,
this,
[=]() {
deviceSet->m_deviceAPI->loadSamplingDeviceSettings(m_mainCore->m_settings.getWorkingPreset()); // load new API settings
// Notify
emit m_mainCore->deviceChanged(deviceSetIndex);
QObject::disconnect(*connection);
delete connection;
}
);
}
}
@ -566,8 +575,20 @@ void MainServer::changeSampleSink(int deviceSetIndex, int selectedDeviceIndex)
DeviceSampleSink *sink = deviceSet->m_deviceAPI->getPluginInterface()->createSampleSinkPluginInstance(
deviceSet->m_deviceAPI->getSamplingDeviceId(), deviceSet->m_deviceAPI);
deviceSet->m_deviceAPI->setSampleSink(sink);
// wait for sample source to be set, before loading settings
auto connection = new QMetaObject::Connection();
*connection = connect(
deviceSet->m_deviceSourceEngine,
&DSPDeviceSourceEngine::sampleSet,
this,
[=]() {
deviceSet->m_deviceAPI->loadSamplingDeviceSettings(m_mainCore->m_settings.getWorkingPreset()); // load new API settings
// Notify
emit m_mainCore->deviceChanged(deviceSetIndex);
QObject::disconnect(*connection);
delete connection;
}
);
}
}
@ -620,8 +641,20 @@ void MainServer::changeSampleMIMO(int deviceSetIndex, int selectedDeviceIndex)
DeviceSampleMIMO *mimo = deviceSet->m_deviceAPI->getPluginInterface()->createSampleMIMOPluginInstance(
deviceSet->m_deviceAPI->getSamplingDeviceId(), deviceSet->m_deviceAPI);
deviceSet->m_deviceAPI->setSampleMIMO(mimo);
// wait for sample source to be set, before loading settings
auto connection = new QMetaObject::Connection();
*connection = connect(
deviceSet->m_deviceSourceEngine,
&DSPDeviceSourceEngine::sampleSet,
this,
[=]() {
deviceSet->m_deviceAPI->loadSamplingDeviceSettings(m_mainCore->m_settings.getWorkingPreset()); // load new API settings
// Notify
emit m_mainCore->deviceChanged(deviceSetIndex);
QObject::disconnect(*connection);
delete connection;
}
);
}
}