diff --git a/plugins/channelrx/localsink/localsink.cpp b/plugins/channelrx/localsink/localsink.cpp index 829ecd903..b1f62c4fe 100644 --- a/plugins/channelrx/localsink/localsink.cpp +++ b/plugins/channelrx/localsink/localsink.cpp @@ -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 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); if (getMessageQueueToGUI()) diff --git a/plugins/channelrx/localsink/localsinkbaseband.cpp b/plugins/channelrx/localsink/localsinkbaseband.cpp index 441c965b8..e05ef74fa 100644 --- a/plugins/channelrx/localsink/localsinkbaseband.cpp +++ b/plugins/channelrx/localsink/localsinkbaseband.cpp @@ -25,7 +25,6 @@ MESSAGE_CLASS_DEFINITION(LocalSinkBaseband::MsgConfigureLocalSinkBaseband, Message) MESSAGE_CLASS_DEFINITION(LocalSinkBaseband::MsgConfigureLocalSinkWork, Message) -MESSAGE_CLASS_DEFINITION(LocalSinkBaseband::MsgBasebandSampleRateNotification, Message) MESSAGE_CLASS_DEFINITION(LocalSinkBaseband::MsgConfigureLocalDeviceSampleSource, Message) LocalSinkBaseband::LocalSinkBaseband() : @@ -114,13 +113,14 @@ bool LocalSinkBaseband::handleMessage(const Message& cmd) return true; } - else if (MsgBasebandSampleRateNotification::match(cmd)) + else if (DSPSignalNotification::match(cmd)) { QMutexLocker mutexLocker(&m_mutex); - MsgBasebandSampleRateNotification& notif = (MsgBasebandSampleRateNotification&) cmd; - qDebug() << "LocalSinkBaseband::handleMessage: MsgBasebandSampleRateNotification: basebandSampleRate: " << notif.getBasebandSampleRate(); - m_sampleFifo.setSize(SampleSinkFifo::getSizePolicy(notif.getBasebandSampleRate())); - m_channelizer->setBasebandSampleRate(notif.getBasebandSampleRate()); + DSPSignalNotification& notif = (DSPSignalNotification&) cmd; + qDebug() << "LocalSinkBaseband::handleMessage: DSPSignalNotification: basebandSampleRate: " << notif.getSampleRate(); + m_sampleFifo.setSize(SampleSinkFifo::getSizePolicy(notif.getSampleRate())); + m_channelizer->setBasebandSampleRate(notif.getSampleRate(), true); // apply decimation + m_sink.setSampleRate(getChannelSampleRate()); return true; } @@ -169,6 +169,7 @@ void LocalSinkBaseband::applySettings(const LocalSinkSettings& settings, bool fo || (settings.m_filterChainHash != m_settings.m_filterChainHash) || force) { m_channelizer->setDecimation(settings.m_log2Decim, settings.m_filterChainHash); + m_sink.setSampleRate(getChannelSampleRate()); } //m_source.applySettings(settings, force); diff --git a/plugins/channelrx/localsink/localsinkbaseband.h b/plugins/channelrx/localsink/localsinkbaseband.h index fc9548f7c..c053a6b7d 100644 --- a/plugins/channelrx/localsink/localsinkbaseband.h +++ b/plugins/channelrx/localsink/localsinkbaseband.h @@ -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 { MESSAGE_CLASS_DECLARATION diff --git a/plugins/channelrx/localsink/localsinksink.cpp b/plugins/channelrx/localsink/localsinksink.cpp index 3b8fc1db2..a911c764b 100644 --- a/plugins/channelrx/localsink/localsinksink.cpp +++ b/plugins/channelrx/localsink/localsinksink.cpp @@ -103,3 +103,8 @@ void LocalSinkSink::applySettings(const LocalSinkSettings& settings, bool force) m_settings = settings; } + +void LocalSinkSink::setSampleRate(int sampleRate) +{ + m_sampleFifo.setSize(SampleSinkFifo::getSizePolicy(sampleRate)); +} diff --git a/plugins/channelrx/localsink/localsinksink.h b/plugins/channelrx/localsink/localsinksink.h index 6f04e05bf..f4c98561f 100644 --- a/plugins/channelrx/localsink/localsinksink.h +++ b/plugins/channelrx/localsink/localsinksink.h @@ -39,6 +39,7 @@ public: void start(DeviceSampleSource *deviceSource); void stop(); bool isRunning() const { return m_running; } + void setSampleRate(int sampleRate); private: SampleSinkFifo m_sampleFifo;