mirror of
https://github.com/f4exb/sdrangel.git
synced 2024-12-23 01:55:48 -05:00
Demods with audio: systematically reapply audio sample rate in case of channel sample rate change
This commit is contained in:
parent
b747966c8e
commit
7917d595f5
@ -143,6 +143,7 @@ bool AMDemodBaseband::handleMessage(const Message& cmd)
|
||||
m_sampleFifo.setSize(SampleSinkFifo::getSizePolicy(notif.getSampleRate()));
|
||||
m_channelizer->setBasebandSampleRate(notif.getSampleRate());
|
||||
m_sink.applyChannelSettings(m_channelizer->getChannelSampleRate(), m_channelizer->getChannelFrequencyOffset());
|
||||
m_sink.applyAudioSampleRate(m_sink.getAudioSampleRate()); // reapply in case of channel sample rate change
|
||||
|
||||
return true;
|
||||
}
|
||||
@ -158,6 +159,7 @@ void AMDemodBaseband::applySettings(const AMDemodSettings& settings, bool force)
|
||||
{
|
||||
m_channelizer->setChannelization(m_sink.getAudioSampleRate(), settings.m_inputFrequencyOffset);
|
||||
m_sink.applyChannelSettings(m_channelizer->getChannelSampleRate(), m_channelizer->getChannelFrequencyOffset());
|
||||
m_sink.applyAudioSampleRate(m_sink.getAudioSampleRate()); // reapply in case of channel sample rate change
|
||||
}
|
||||
|
||||
if ((settings.m_audioDeviceName != m_settings.m_audioDeviceName) || force)
|
||||
|
@ -124,6 +124,7 @@ bool BFMDemodBaseband::handleMessage(const Message& cmd)
|
||||
m_sampleFifo.setSize(SampleSinkFifo::getSizePolicy(notif.getSampleRate()));
|
||||
m_channelizer->setBasebandSampleRate(notif.getSampleRate());
|
||||
m_sink.applyChannelSettings(m_channelizer->getChannelSampleRate(), m_channelizer->getChannelFrequencyOffset());
|
||||
m_sink.applyAudioSampleRate(m_sink.getAudioSampleRate()); // reapply in case of channel sample rate change
|
||||
|
||||
if (getMessageQueueToGUI())
|
||||
{
|
||||
@ -146,6 +147,7 @@ void BFMDemodBaseband::applySettings(const BFMDemodSettings& settings, bool forc
|
||||
{
|
||||
m_channelizer->setChannelization(BFMDemodSettings::requiredBW(settings.m_rfBandwidth), settings.m_inputFrequencyOffset);
|
||||
m_sink.applyChannelSettings(m_channelizer->getChannelSampleRate(), m_channelizer->getChannelFrequencyOffset());
|
||||
m_sink.applyAudioSampleRate(m_sink.getAudioSampleRate()); // reapply in case of channel sample rate change
|
||||
|
||||
if (getMessageQueueToGUI())
|
||||
{
|
||||
|
@ -125,6 +125,7 @@ bool DSDDemodBaseband::handleMessage(const Message& cmd)
|
||||
m_sampleFifo.setSize(SampleSinkFifo::getSizePolicy(notif.getSampleRate()));
|
||||
m_channelizer->setBasebandSampleRate(notif.getSampleRate());
|
||||
m_sink.applyChannelSettings(m_channelizer->getChannelSampleRate(), m_channelizer->getChannelFrequencyOffset());
|
||||
m_sink.applyAudioSampleRate(m_sink.getAudioSampleRate()); // reapply in case of channel sample rate change
|
||||
|
||||
return true;
|
||||
}
|
||||
@ -140,6 +141,7 @@ void DSDDemodBaseband::applySettings(const DSDDemodSettings& settings, bool forc
|
||||
{
|
||||
m_channelizer->setChannelization(m_sink.getAudioSampleRate(), settings.m_inputFrequencyOffset);
|
||||
m_sink.applyChannelSettings(m_channelizer->getChannelSampleRate(), m_channelizer->getChannelFrequencyOffset());
|
||||
m_sink.applyAudioSampleRate(m_sink.getAudioSampleRate()); // reapply in case of channel sample rate change
|
||||
}
|
||||
|
||||
if ((settings.m_audioDeviceName != m_settings.m_audioDeviceName) || force)
|
||||
|
@ -122,6 +122,7 @@ bool NFMDemodBaseband::handleMessage(const Message& cmd)
|
||||
m_sampleFifo.setSize(SampleSinkFifo::getSizePolicy(notif.getSampleRate()));
|
||||
m_channelizer->setBasebandSampleRate(notif.getSampleRate());
|
||||
m_sink.applyChannelSettings(m_channelizer->getChannelSampleRate(), m_channelizer->getChannelFrequencyOffset());
|
||||
m_sink.applyAudioSampleRate(m_sink.getAudioSampleRate()); // reapply in case of channel sample rate change
|
||||
|
||||
return true;
|
||||
}
|
||||
@ -137,6 +138,7 @@ void NFMDemodBaseband::applySettings(const NFMDemodSettings& settings, bool forc
|
||||
{
|
||||
m_channelizer->setChannelization(m_sink.getAudioSampleRate(), settings.m_inputFrequencyOffset);
|
||||
m_sink.applyChannelSettings(m_channelizer->getChannelSampleRate(), m_channelizer->getChannelFrequencyOffset());
|
||||
m_sink.applyAudioSampleRate(m_sink.getAudioSampleRate()); // reapply in case of channel sample rate change
|
||||
}
|
||||
|
||||
if ((settings.m_audioDeviceName != m_settings.m_audioDeviceName) || force)
|
||||
|
@ -125,6 +125,7 @@ bool SSBDemodBaseband::handleMessage(const Message& cmd)
|
||||
m_sampleFifo.setSize(SampleSinkFifo::getSizePolicy(notif.getSampleRate()));
|
||||
m_channelizer->setBasebandSampleRate(notif.getSampleRate());
|
||||
m_sink.applyChannelSettings(m_channelizer->getChannelSampleRate(), m_channelizer->getChannelFrequencyOffset());
|
||||
m_sink.applyAudioSampleRate(m_audioSampleRate); // reapply in case of channel sample rate change
|
||||
|
||||
return true;
|
||||
}
|
||||
@ -140,6 +141,7 @@ void SSBDemodBaseband::applySettings(const SSBDemodSettings& settings, bool forc
|
||||
{
|
||||
m_channelizer->setChannelization(m_audioSampleRate, settings.m_inputFrequencyOffset);
|
||||
m_sink.applyChannelSettings(m_channelizer->getChannelSampleRate(), m_channelizer->getChannelFrequencyOffset());
|
||||
m_sink.applyAudioSampleRate(m_audioSampleRate); // reapply in case of channel sample rate change
|
||||
}
|
||||
|
||||
if ((settings.m_audioDeviceName != m_settings.m_audioDeviceName) || force)
|
||||
|
@ -300,7 +300,8 @@ SSBDemodGUI::SSBDemodGUI(PluginAPI* pluginAPI, DeviceUISet *deviceUISet, Baseban
|
||||
m_audioBinaural(false),
|
||||
m_audioFlipChannels(false),
|
||||
m_audioMute(false),
|
||||
m_squelchOpen(false)
|
||||
m_squelchOpen(false),
|
||||
m_audioSampleRate(-1)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
setAttribute(Qt::WA_DeleteOnClose, true);
|
||||
@ -661,17 +662,21 @@ void SSBDemodGUI::tick()
|
||||
ui->channelPower->setText(tr("%1 dB").arg(powDbAvg, 0, 'f', 1));
|
||||
}
|
||||
|
||||
int audioSampleRate = m_ssbDemod->getAudioSampleRate();
|
||||
bool squelchOpen = m_ssbDemod->getAudioActive();
|
||||
|
||||
if (squelchOpen != m_squelchOpen)
|
||||
if ((audioSampleRate != m_audioSampleRate) || (squelchOpen != m_squelchOpen))
|
||||
{
|
||||
if (squelchOpen) {
|
||||
if (audioSampleRate < 0) {
|
||||
ui->audioMute->setStyleSheet("QToolButton { background-color : red; }");
|
||||
} else if (squelchOpen) {
|
||||
ui->audioMute->setStyleSheet("QToolButton { background-color : green; }");
|
||||
} else {
|
||||
ui->audioMute->setStyleSheet("QToolButton { background:rgb(79,79,79); }");
|
||||
}
|
||||
|
||||
m_squelchOpen = squelchOpen;
|
||||
m_audioSampleRate = audioSampleRate;
|
||||
m_squelchOpen = squelchOpen;
|
||||
}
|
||||
|
||||
m_tickCount++;
|
||||
|
@ -56,6 +56,7 @@ private:
|
||||
bool m_audioFlipChannels;
|
||||
bool m_audioMute;
|
||||
bool m_squelchOpen;
|
||||
int m_audioSampleRate;
|
||||
uint32_t m_tickCount;
|
||||
|
||||
SSBDemod* m_ssbDemod;
|
||||
|
@ -122,6 +122,7 @@ bool WFMDemodBaseband::handleMessage(const Message& cmd)
|
||||
m_sampleFifo.setSize(SampleSinkFifo::getSizePolicy(notif.getSampleRate()));
|
||||
m_channelizer->setBasebandSampleRate(notif.getSampleRate());
|
||||
m_sink.applyChannelSettings(m_channelizer->getChannelSampleRate(), m_channelizer->getChannelFrequencyOffset());
|
||||
m_sink.applyAudioSampleRate(m_sink.getAudioSampleRate()); // reapply in case of channel sample rate change
|
||||
|
||||
return true;
|
||||
}
|
||||
@ -138,6 +139,7 @@ void WFMDemodBaseband::applySettings(const WFMDemodSettings& settings, bool forc
|
||||
{
|
||||
m_channelizer->setChannelization(WFMDemodSettings::requiredBW(settings.m_rfBandwidth), settings.m_inputFrequencyOffset);
|
||||
m_sink.applyChannelSettings(m_channelizer->getChannelSampleRate(), m_channelizer->getChannelFrequencyOffset());
|
||||
m_sink.applyAudioSampleRate(m_sink.getAudioSampleRate()); // reapply in case of channel sample rate change
|
||||
}
|
||||
|
||||
if ((settings.m_audioDeviceName != m_settings.m_audioDeviceName) || force)
|
||||
|
Loading…
Reference in New Issue
Block a user