1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2026-03-18 22:19:35 -04:00

Freq Scanner: in baseband process sample rate change only if necessary

This commit is contained in:
f4exb 2026-02-16 00:58:26 +01:00
parent 6752029e43
commit 7bcb92d200
2 changed files with 15 additions and 5 deletions

View File

@ -29,7 +29,8 @@ MESSAGE_CLASS_DEFINITION(FreqScannerBaseband::MsgConfigureFreqScannerBaseband, M
FreqScannerBaseband::FreqScannerBaseband(FreqScanner *freqScanner) :
m_freqScanner(freqScanner),
m_messageQueueToGUI(nullptr)
m_messageQueueToGUI(nullptr),
m_currentBasebandSampleRate(0)
{
qDebug("FreqScannerBaseband::FreqScannerBaseband");
@ -62,6 +63,7 @@ void FreqScannerBaseband::reset()
m_inputMessageQueue.clear();
m_sampleFifo.reset();
m_channelSampleRate = 0;
m_currentBasebandSampleRate = 0;
}
void FreqScannerBaseband::setChannel(ChannelAPI *channel)
@ -130,11 +132,18 @@ bool FreqScannerBaseband::handleMessage(const Message& cmd)
QMutexLocker mutexLocker(&m_mutex);
DSPSignalNotification& notif = (DSPSignalNotification&) cmd;
qDebug() << "FreqScannerBaseband::handleMessage: DSPSignalNotification: basebandSampleRate: " << notif.getSampleRate();
setBasebandSampleRate(notif.getSampleRate());
m_sampleFifo.setSize(SampleSinkFifo::getSizePolicy(notif.getSampleRate()));
if (m_channelSampleRate != m_channelizer->getChannelSampleRate()) {
m_channelSampleRate = m_channelizer->getChannelSampleRate();
int basebandSampleRate = notif.getSampleRate();
if (basebandSampleRate != m_currentBasebandSampleRate)
{
setBasebandSampleRate(notif.getSampleRate());
m_sampleFifo.setSize(SampleSinkFifo::getSizePolicy(notif.getSampleRate()));
if (m_channelSampleRate != m_channelizer->getChannelSampleRate()) {
m_channelSampleRate = m_channelizer->getChannelSampleRate();
}
m_currentBasebandSampleRate = basebandSampleRate;
}
m_sink.setCenterFrequency(notif.getCenterFrequency());
return true;

View File

@ -86,6 +86,7 @@ private:
MessageQueue *m_messageQueueToGUI;
FreqScannerSettings m_settings;
QRecursiveMutex m_mutex;
int m_currentBasebandSampleRate;
bool handleMessage(const Message& cmd);
void applySettings(const FreqScannerSettings& settings, const QStringList& settingsKeys, bool force = false);