diff --git a/plugins/channelrx/demodssb/ssbdemod.cpp b/plugins/channelrx/demodssb/ssbdemod.cpp index f22cc9447..780ef37e8 100644 --- a/plugins/channelrx/demodssb/ssbdemod.cpp +++ b/plugins/channelrx/demodssb/ssbdemod.cpp @@ -112,6 +112,15 @@ uint32_t SSBDemod::getNumberOfDeviceStreams() const return m_deviceAPI->getNbSourceStreams(); } +void SSBDemod::setMessageQueueToGUI(MessageQueue* queue) +{ + ChannelAPI::setMessageQueueToGUI(queue); + + if (m_basebandSink) { + m_basebandSink->setMessageQueueToGUI(queue); + } +} + void SSBDemod::feed(const SampleVector::const_iterator& begin, const SampleVector::const_iterator& end, bool positiveOnly) { (void) positiveOnly; diff --git a/plugins/channelrx/demodssb/ssbdemod.h b/plugins/channelrx/demodssb/ssbdemod.h index 9a68338c8..7c4750753 100644 --- a/plugins/channelrx/demodssb/ssbdemod.h +++ b/plugins/channelrx/demodssb/ssbdemod.h @@ -96,7 +96,7 @@ public: return m_settings.m_inputFrequencyOffset; } - void setMessageQueueToGUI(MessageQueue* queue) override { ChannelAPI::setMessageQueueToGUI(queue); } + void setMessageQueueToGUI(MessageQueue* queue) override; uint32_t getAudioSampleRate() const { return m_running ? m_basebandSink->getAudioSampleRate() : 0; } uint32_t getChannelSampleRate() const { return m_running ? m_basebandSink->getChannelSampleRate() : 0; } double getMagSq() const { return m_running ? m_basebandSink->getMagSq() : 0.0; } diff --git a/plugins/channelrx/demodssb/ssbdemodbaseband.cpp b/plugins/channelrx/demodssb/ssbdemodbaseband.cpp index 061be8454..9cfaf2de9 100644 --- a/plugins/channelrx/demodssb/ssbdemodbaseband.cpp +++ b/plugins/channelrx/demodssb/ssbdemodbaseband.cpp @@ -140,6 +140,35 @@ bool SSBDemodBaseband::handleMessage(const Message& cmd) return true; } + else if (DSPConfigureAudio::match(cmd)) + { + DSPConfigureAudio& cfg = (DSPConfigureAudio&) cmd; + unsigned int audioSampleRate = cfg.getSampleRate(); + + if (m_audioSampleRate != audioSampleRate) + { + qDebug("SSBDemodBaseband::handleMessage: DSPConfigureAudio: new sample rate %d",audioSampleRate); + m_sink.applyAudioSampleRate(audioSampleRate); + m_channelizer.setChannelization(audioSampleRate, m_settings.m_inputFrequencyOffset); + m_sink.applyChannelSettings(m_channelizer.getChannelSampleRate(), m_channelizer.getChannelFrequencyOffset()); + m_audioSampleRate = audioSampleRate; + + if (getMessageQueueToGUI()) + { + qDebug("SSBDemodBaseband::handleMessage: DSPConfigureAudio: forward to GUI"); + DSPConfigureAudio *msg = new DSPConfigureAudio((int) audioSampleRate, DSPConfigureAudio::AudioOutput); + getMessageQueueToGUI()->push(msg); + } + + if (m_spectrumVis) + { + DSPSignalNotification *msg = new DSPSignalNotification(m_audioSampleRate/(1<getInputMessageQueue()->push(msg); + } + } + + return true; + } else { return false; diff --git a/plugins/channelrx/demodssb/ssbdemodgui.cpp b/plugins/channelrx/demodssb/ssbdemodgui.cpp index 225757c32..4ecb959e9 100644 --- a/plugins/channelrx/demodssb/ssbdemodgui.cpp +++ b/plugins/channelrx/demodssb/ssbdemodgui.cpp @@ -95,6 +95,8 @@ bool SSBDemodGUI::handleMessage(const Message& message) const DSPSignalNotification& notif = (const DSPSignalNotification&) message; m_deviceCenterFrequency = notif.getCenterFrequency(); m_basebandSampleRate = notif.getSampleRate(); + qDebug("SSBDemodGUI::handleMessage: DSPSignalNotification: centerFrequency: %lld sampleRate: %d", + m_deviceCenterFrequency, m_basebandSampleRate); ui->deltaFrequency->setValueRange(false, 7, -m_basebandSampleRate/2, m_basebandSampleRate/2); ui->deltaFrequencyLabel->setToolTip(tr("Range %1 %L2 Hz").arg(QChar(0xB1)).arg(m_basebandSampleRate/2)); updateAbsoluteCenterFrequency();