mirror of
https://github.com/f4exb/sdrangel.git
synced 2024-11-16 05:11:49 -05:00
Perseus: workaround to fix sample rate setting and removal of useless passing to thread
This commit is contained in:
parent
34081dd50b
commit
64044e521e
@ -300,16 +300,22 @@ bool PerseusInput::applySettings(const PerseusSettings& settings, bool force)
|
|||||||
if (m_perseusDescriptor != 0)
|
if (m_perseusDescriptor != 0)
|
||||||
{
|
{
|
||||||
int rate = m_sampleRates[settings.m_devSampleRateIndex < m_sampleRates.size() ? 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);
|
int rc;
|
||||||
|
|
||||||
|
for (int i = 0; i < 2; i++) // it turns out that it has to be done twice
|
||||||
|
{
|
||||||
|
rc = perseus_set_sampling_rate(m_perseusDescriptor, rate);
|
||||||
|
|
||||||
if (rc < 0) {
|
if (rc < 0) {
|
||||||
qCritical("PerseusInput::applySettings: could not set sample rate index %u (%d S/s): %s",
|
qCritical("PerseusInput::applySettings: could not set sample rate index %u (%d S/s): %s",
|
||||||
settings.m_devSampleRateIndex, rate, perseus_errorstr());
|
settings.m_devSampleRateIndex, rate, perseus_errorstr());
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
else if (m_perseusThread != 0)
|
else
|
||||||
{
|
{
|
||||||
qDebug("PerseusInput::applySettings: sample rate set to index: %u (%d S/s)", settings.m_devSampleRateIndex, rate);
|
qDebug("PerseusInput::applySettings: sample rate set to index #%d: %u (%d S/s)",
|
||||||
m_perseusThread->setSamplerate(rate);
|
i, settings.m_devSampleRateIndex, rate);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -329,7 +335,8 @@ bool PerseusInput::applySettings(const PerseusSettings& settings, bool force)
|
|||||||
|| (m_settings.m_LOppmTenths != settings.m_LOppmTenths)
|
|| (m_settings.m_LOppmTenths != settings.m_LOppmTenths)
|
||||||
|| (m_settings.m_wideBand != settings.m_wideBand)
|
|| (m_settings.m_wideBand != settings.m_wideBand)
|
||||||
|| (m_settings.m_transverterMode != settings.m_transverterMode)
|
|| (m_settings.m_transverterMode != settings.m_transverterMode)
|
||||||
|| (m_settings.m_transverterDeltaFrequency != settings.m_transverterDeltaFrequency))
|
|| (m_settings.m_transverterDeltaFrequency != settings.m_transverterDeltaFrequency)
|
||||||
|
|| (m_settings.m_devSampleRateIndex != settings.m_devSampleRateIndex))
|
||||||
{
|
{
|
||||||
qint64 deviceCenterFrequency = settings.m_centerFrequency;
|
qint64 deviceCenterFrequency = settings.m_centerFrequency;
|
||||||
deviceCenterFrequency -= settings.m_transverterMode ? settings.m_transverterDeltaFrequency : 0;
|
deviceCenterFrequency -= settings.m_transverterMode ? settings.m_transverterDeltaFrequency : 0;
|
||||||
@ -377,17 +384,20 @@ bool PerseusInput::applySettings(const PerseusSettings& settings, bool force)
|
|||||||
m_deviceAPI->getDeviceEngineInputMessageQueue()->push(notif);
|
m_deviceAPI->getDeviceEngineInputMessageQueue()->push(notif);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((m_settings.m_devSampleRateIndex != settings.m_devSampleRateIndex) || force)
|
|
||||||
{
|
|
||||||
if (m_perseusThread && m_perseusThread->isRunning())
|
|
||||||
{
|
|
||||||
stop();
|
|
||||||
start();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
m_settings = settings;
|
m_settings = settings;
|
||||||
m_settings.m_devSampleRateIndex = sampleRateIndex;
|
m_settings.m_devSampleRateIndex = sampleRateIndex;
|
||||||
|
|
||||||
|
qDebug() << "PerseusInput::applySettings: "
|
||||||
|
<< " m_LOppmTenths: " << m_settings.m_LOppmTenths
|
||||||
|
<< " m_devSampleRateIndex: " << m_settings.m_devSampleRateIndex
|
||||||
|
<< " m_log2Decim: " << m_settings.m_log2Decim
|
||||||
|
<< " m_transverterMode: " << m_settings.m_transverterMode
|
||||||
|
<< " m_transverterDeltaFrequency: " << m_settings.m_transverterDeltaFrequency
|
||||||
|
<< " m_adcDither: " << m_settings.m_adcDither
|
||||||
|
<< " m_adcPreamp: " << m_settings.m_adcPreamp
|
||||||
|
<< " m_wideBand: " << m_settings.m_wideBand
|
||||||
|
<< " m_attenuator: " << m_settings.m_attenuator;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -25,7 +25,6 @@ PerseusThread::PerseusThread(perseus_descr* dev, SampleSinkFifo* sampleFifo, QOb
|
|||||||
m_dev(dev),
|
m_dev(dev),
|
||||||
m_convertBuffer(PERSEUS_NBSAMPLES),
|
m_convertBuffer(PERSEUS_NBSAMPLES),
|
||||||
m_sampleFifo(sampleFifo),
|
m_sampleFifo(sampleFifo),
|
||||||
m_samplerate(10),
|
|
||||||
m_log2Decim(0)
|
m_log2Decim(0)
|
||||||
{
|
{
|
||||||
m_this = this;
|
m_this = this;
|
||||||
@ -54,11 +53,6 @@ void PerseusThread::stopWork()
|
|||||||
wait();
|
wait();
|
||||||
}
|
}
|
||||||
|
|
||||||
void PerseusThread::setSamplerate(uint32_t samplerate)
|
|
||||||
{
|
|
||||||
m_samplerate = samplerate;
|
|
||||||
}
|
|
||||||
|
|
||||||
void PerseusThread::setLog2Decimation(unsigned int log2_decim)
|
void PerseusThread::setLog2Decimation(unsigned int log2_decim)
|
||||||
{
|
{
|
||||||
m_log2Decim = log2_decim;
|
m_log2Decim = log2_decim;
|
||||||
|
@ -37,7 +37,6 @@ public:
|
|||||||
|
|
||||||
void startWork();
|
void startWork();
|
||||||
void stopWork();
|
void stopWork();
|
||||||
void setSamplerate(uint32_t samplerate);
|
|
||||||
void setLog2Decimation(unsigned int log2_decim);
|
void setLog2Decimation(unsigned int log2_decim);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
@ -50,7 +49,6 @@ private:
|
|||||||
SampleVector m_convertBuffer;
|
SampleVector m_convertBuffer;
|
||||||
SampleSinkFifo* m_sampleFifo;
|
SampleSinkFifo* m_sampleFifo;
|
||||||
|
|
||||||
int m_samplerate;
|
|
||||||
unsigned int m_log2Decim;
|
unsigned int m_log2Decim;
|
||||||
static PerseusThread *m_this;
|
static PerseusThread *m_this;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user