1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2024-11-22 08:04:49 -05:00

SSB demod: handle DSPConfigureAudio message correctly

This commit is contained in:
f4exb 2023-07-07 04:58:34 +02:00
parent 5df7f73da7
commit 040ca0c2d0
4 changed files with 41 additions and 1 deletions

View File

@ -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;

View File

@ -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; }

View File

@ -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<<m_settings.m_filterBank[m_settings.m_filterIndex].m_spanLog2), 0);
m_spectrumVis->getInputMessageQueue()->push(msg);
}
}
return true;
}
else
{
return false;

View File

@ -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();