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

Perseus: fixed unwanted thread stop at sample rate change

This commit is contained in:
f4exb 2018-02-09 00:53:46 +01:00
parent f4bf4d0b99
commit 6cfc99d7d2

View File

@ -301,7 +301,7 @@ bool PerseusInput::applySettings(const PerseusSettings& settings, bool force)
if (m_perseusDescriptor != 0)
{
int rate = m_sampleRates[m_settings.m_devSampleRateIndex < m_sampleRates.size() ? m_settings.m_devSampleRateIndex: 0];
int rate = m_sampleRates[settings.m_devSampleRateIndex < m_sampleRates.size() ? settings.m_devSampleRateIndex: 0];
int rc = perseus_set_sampling_rate(m_perseusDescriptor, rate);
if (rc < 0) {
@ -379,6 +379,15 @@ bool PerseusInput::applySettings(const PerseusSettings& settings, bool force)
m_deviceAPI->getDeviceEngineInputMessageQueue()->push(notif);
}
if ((m_settings.m_devSampleRateIndex != settings.m_devSampleRateIndex) || force)
{
if (m_perseusThread && m_perseusThread->isRunning())
{
m_perseusThread->stopWork();
m_perseusThread->startWork();
}
}
m_settings = settings;
m_settings.m_devSampleRateIndex = sampleRateIndex;
return true;