1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2024-11-26 17:58:43 -05:00

SDRPlay plugin: move up set sample rate block

This commit is contained in:
f4exb 2016-11-19 03:12:28 +01:00
parent 3d541d72a5
commit 9b63cf2670

View File

@ -193,6 +193,29 @@ bool SDRPlayInput::applySettings(const SDRPlaySettings& settings, bool force)
bool forceGainSetting = false;
QMutexLocker mutexLocker(&m_mutex);
if ((m_settings.m_devSampleRateIndex != settings.m_devSampleRateIndex) || force)
{
forwardChange = true;
if(m_dev != 0)
{
int sampleRate = SDRPlaySampleRates::getRate(m_settings.m_devSampleRateIndex);
int r = mirisdr_set_sample_rate(m_dev, sampleRate);
if(r < 0)
{
qCritical("SDRPlayInput::applySettings: could not set sample rate: %d rc: %d", sampleRate, r);
}
else
{
qDebug("SDRPlayInput::applySettings: sample rate set to %d", sampleRate);
m_settings.m_devSampleRateIndex = settings.m_devSampleRateIndex;
m_sdrPlayThread->setSamplerate(sampleRate);
}
}
}
if ((m_settings.m_dcBlock != settings.m_dcBlock) || force)
{
m_settings.m_dcBlock = settings.m_dcBlock;
@ -310,29 +333,6 @@ bool SDRPlayInput::applySettings(const SDRPlaySettings& settings, bool force)
}
}
if ((m_settings.m_devSampleRateIndex != settings.m_devSampleRateIndex) || force)
{
forwardChange = true;
if(m_dev != 0)
{
int sampleRate = SDRPlaySampleRates::getRate(m_settings.m_devSampleRateIndex);
int r = mirisdr_set_sample_rate(m_dev, sampleRate);
if(r < 0)
{
qCritical("SDRPlayInput::applySettings: could not set sample rate: %d rc: %d", sampleRate, r);
}
else
{
qDebug("SDRPlayInput::applySettings: sample rate set to %d", sampleRate);
m_settings.m_devSampleRateIndex = settings.m_devSampleRateIndex;
m_sdrPlayThread->setSamplerate(sampleRate);
}
}
}
if ((m_settings.m_log2Decim != settings.m_log2Decim) || force)
{
m_settings.m_log2Decim = settings.m_log2Decim;