1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2025-06-24 21:15:24 -04:00

LocalSink: fixed DSPSignalNotification& message passing to baseband and size sink FIFO depending on channel sample rate

This commit is contained in:
f4exb 2020-06-27 04:59:40 +02:00
parent 83e78deb9f
commit eee7640cdd
5 changed files with 14 additions and 27 deletions

View File

@ -116,7 +116,7 @@ bool LocalSink::handleMessage(const Message& cmd)
calculateFrequencyOffset(m_settings.m_log2Decim, m_settings.m_filterChainHash); // This is when device sample rate changes calculateFrequencyOffset(m_settings.m_log2Decim, m_settings.m_filterChainHash); // This is when device sample rate changes
propagateSampleRateAndFrequency(m_settings.m_localDeviceIndex, m_settings.m_log2Decim); propagateSampleRateAndFrequency(m_settings.m_localDeviceIndex, m_settings.m_log2Decim);
MsgBasebandSampleRateNotification *msg = MsgBasebandSampleRateNotification::create(notif.getSampleRate()); DSPSignalNotification *msg = new DSPSignalNotification(notif.getSampleRate(), notif.getCenterFrequency());
m_basebandSink->getInputMessageQueue()->push(msg); m_basebandSink->getInputMessageQueue()->push(msg);
if (getMessageQueueToGUI()) if (getMessageQueueToGUI())

View File

@ -25,7 +25,6 @@
MESSAGE_CLASS_DEFINITION(LocalSinkBaseband::MsgConfigureLocalSinkBaseband, Message) MESSAGE_CLASS_DEFINITION(LocalSinkBaseband::MsgConfigureLocalSinkBaseband, Message)
MESSAGE_CLASS_DEFINITION(LocalSinkBaseband::MsgConfigureLocalSinkWork, Message) MESSAGE_CLASS_DEFINITION(LocalSinkBaseband::MsgConfigureLocalSinkWork, Message)
MESSAGE_CLASS_DEFINITION(LocalSinkBaseband::MsgBasebandSampleRateNotification, Message)
MESSAGE_CLASS_DEFINITION(LocalSinkBaseband::MsgConfigureLocalDeviceSampleSource, Message) MESSAGE_CLASS_DEFINITION(LocalSinkBaseband::MsgConfigureLocalDeviceSampleSource, Message)
LocalSinkBaseband::LocalSinkBaseband() : LocalSinkBaseband::LocalSinkBaseband() :
@ -114,13 +113,14 @@ bool LocalSinkBaseband::handleMessage(const Message& cmd)
return true; return true;
} }
else if (MsgBasebandSampleRateNotification::match(cmd)) else if (DSPSignalNotification::match(cmd))
{ {
QMutexLocker mutexLocker(&m_mutex); QMutexLocker mutexLocker(&m_mutex);
MsgBasebandSampleRateNotification& notif = (MsgBasebandSampleRateNotification&) cmd; DSPSignalNotification& notif = (DSPSignalNotification&) cmd;
qDebug() << "LocalSinkBaseband::handleMessage: MsgBasebandSampleRateNotification: basebandSampleRate: " << notif.getBasebandSampleRate(); qDebug() << "LocalSinkBaseband::handleMessage: DSPSignalNotification: basebandSampleRate: " << notif.getSampleRate();
m_sampleFifo.setSize(SampleSinkFifo::getSizePolicy(notif.getBasebandSampleRate())); m_sampleFifo.setSize(SampleSinkFifo::getSizePolicy(notif.getSampleRate()));
m_channelizer->setBasebandSampleRate(notif.getBasebandSampleRate()); m_channelizer->setBasebandSampleRate(notif.getSampleRate(), true); // apply decimation
m_sink.setSampleRate(getChannelSampleRate());
return true; return true;
} }
@ -169,6 +169,7 @@ void LocalSinkBaseband::applySettings(const LocalSinkSettings& settings, bool fo
|| (settings.m_filterChainHash != m_settings.m_filterChainHash) || force) || (settings.m_filterChainHash != m_settings.m_filterChainHash) || force)
{ {
m_channelizer->setDecimation(settings.m_log2Decim, settings.m_filterChainHash); m_channelizer->setDecimation(settings.m_log2Decim, settings.m_filterChainHash);
m_sink.setSampleRate(getChannelSampleRate());
} }
//m_source.applySettings(settings, force); //m_source.applySettings(settings, force);

View File

@ -77,26 +77,6 @@ public:
{ } { }
}; };
class MsgBasebandSampleRateNotification : public Message {
MESSAGE_CLASS_DECLARATION
public:
static MsgBasebandSampleRateNotification* create(int sampleRate) {
return new MsgBasebandSampleRateNotification(sampleRate);
}
int getBasebandSampleRate() const { return m_sampleRate; }
private:
MsgBasebandSampleRateNotification(int sampleRate) :
Message(),
m_sampleRate(sampleRate)
{ }
int m_sampleRate;
};
class MsgConfigureLocalDeviceSampleSource : public Message { class MsgConfigureLocalDeviceSampleSource : public Message {
MESSAGE_CLASS_DECLARATION MESSAGE_CLASS_DECLARATION

View File

@ -103,3 +103,8 @@ void LocalSinkSink::applySettings(const LocalSinkSettings& settings, bool force)
m_settings = settings; m_settings = settings;
} }
void LocalSinkSink::setSampleRate(int sampleRate)
{
m_sampleFifo.setSize(SampleSinkFifo::getSizePolicy(sampleRate));
}

View File

@ -39,6 +39,7 @@ public:
void start(DeviceSampleSource *deviceSource); void start(DeviceSampleSource *deviceSource);
void stop(); void stop();
bool isRunning() const { return m_running; } bool isRunning() const { return m_running; }
void setSampleRate(int sampleRate);
private: private:
SampleSinkFifo m_sampleFifo; SampleSinkFifo m_sampleFifo;