diff --git a/plugins/channelrx/demodssb/ssbdemod.cpp b/plugins/channelrx/demodssb/ssbdemod.cpp index 67ccc1741..b9c2bce2b 100644 --- a/plugins/channelrx/demodssb/ssbdemod.cpp +++ b/plugins/channelrx/demodssb/ssbdemod.cpp @@ -195,10 +195,12 @@ void SSBDemod::applySettings(const SSBDemodSettings& settings, bool force) { qDebug() << "SSBDemod::applySettings:" << " m_inputFrequencyOffset: " << settings.m_inputFrequencyOffset - << " m_rfBandwidth: " << settings.m_rfBandwidth - << " m_lowCutoff: " << settings.m_lowCutoff + << " m_filterIndex: " << settings.m_filterIndex + << " [m_spanLog2: " << settings.m_filterBank[settings.m_filterIndex].m_spanLog2 + << " m_rfBandwidth: " << settings.m_filterBank[settings.m_filterIndex].m_rfBandwidth + << " m_lowCutoff: " << settings.m_filterBank[settings.m_filterIndex].m_lowCutoff + << " m_fftWindow: " << settings.m_filterBank[settings.m_filterIndex].m_fftWindow << "]" << " m_volume: " << settings.m_volume - << " m_spanLog2: " << settings.m_spanLog2 << " m_audioBinaual: " << settings.m_audioBinaural << " m_audioFlipChannels: " << settings.m_audioFlipChannels << " m_dsb: " << settings.m_dsb @@ -222,10 +224,10 @@ void SSBDemod::applySettings(const SSBDemodSettings& settings, bool force) if((m_settings.m_inputFrequencyOffset != settings.m_inputFrequencyOffset) || force) { reverseAPIKeys.append("inputFrequencyOffset"); } - if((m_settings.m_rfBandwidth != settings.m_rfBandwidth) || force) { + if((m_settings.m_filterBank[m_settings.m_filterIndex].m_rfBandwidth != settings.m_filterBank[settings.m_filterIndex].m_rfBandwidth) || force) { reverseAPIKeys.append("rfBandwidth"); } - if((m_settings.m_lowCutoff != settings.m_lowCutoff) || force) { + if((m_settings.m_filterBank[m_settings.m_filterIndex].m_lowCutoff != settings.m_filterBank[settings.m_filterIndex].m_lowCutoff) || force) { reverseAPIKeys.append("lowCutoff"); } if ((m_settings.m_volume != settings.m_volume) || force) { @@ -246,7 +248,7 @@ void SSBDemod::applySettings(const SSBDemodSettings& settings, bool force) if ((settings.m_audioDeviceName != m_settings.m_audioDeviceName) || force) { reverseAPIKeys.append("audioDeviceName"); } - if ((m_settings.m_spanLog2 != settings.m_spanLog2) || force) { + if ((m_settings.m_filterBank[m_settings.m_filterIndex].m_spanLog2 != settings.m_filterBank[settings.m_filterIndex].m_spanLog2) || force) { reverseAPIKeys.append("spanLog2"); } if ((m_settings.m_audioBinaural != settings.m_audioBinaural) || force) { @@ -279,12 +281,12 @@ void SSBDemod::applySettings(const SSBDemodSettings& settings, bool force) } if ((settings.m_dsb != m_settings.m_dsb) - || (settings.m_rfBandwidth != m_settings.m_rfBandwidth) - || (settings.m_lowCutoff != m_settings.m_lowCutoff) || force) + || (settings.m_filterBank[settings.m_filterIndex].m_rfBandwidth != m_settings.m_filterBank[m_settings.m_filterIndex].m_rfBandwidth) + || (settings.m_filterBank[settings.m_filterIndex].m_lowCutoff != m_settings.m_filterBank[m_settings.m_filterIndex].m_lowCutoff) || force) { SpectrumSettings spectrumSettings = m_spectrumVis.getSettings(); spectrumSettings.m_ssb = !settings.m_dsb; - spectrumSettings.m_usb = (settings.m_lowCutoff < settings.m_rfBandwidth); + spectrumSettings.m_usb = (settings.m_filterBank[settings.m_filterIndex].m_lowCutoff < settings.m_filterBank[settings.m_filterIndex].m_rfBandwidth); SpectrumVis::MsgConfigureSpectrumVis *msg = SpectrumVis::MsgConfigureSpectrumVis::create(spectrumSettings, false); m_spectrumVis.getInputMessageQueue()->push(msg); } @@ -411,16 +413,16 @@ void SSBDemod::webapiUpdateChannelSettings( settings.m_inputFrequencyOffset = response.getSsbDemodSettings()->getInputFrequencyOffset(); } if (channelSettingsKeys.contains("rfBandwidth")) { - settings.m_rfBandwidth = response.getSsbDemodSettings()->getRfBandwidth(); + settings.m_filterBank[settings.m_filterIndex].m_rfBandwidth = response.getSsbDemodSettings()->getRfBandwidth(); } if (channelSettingsKeys.contains("lowCutoff")) { - settings.m_lowCutoff = response.getSsbDemodSettings()->getLowCutoff(); + settings.m_filterBank[settings.m_filterIndex].m_lowCutoff = response.getSsbDemodSettings()->getLowCutoff(); } if (channelSettingsKeys.contains("volume")) { settings.m_volume = response.getSsbDemodSettings()->getVolume(); } if (channelSettingsKeys.contains("spanLog2")) { - settings.m_spanLog2 = response.getSsbDemodSettings()->getSpanLog2(); + settings.m_filterBank[settings.m_filterIndex].m_spanLog2 = response.getSsbDemodSettings()->getSpanLog2(); } if (channelSettingsKeys.contains("audioBinaural")) { settings.m_audioBinaural = response.getSsbDemodSettings()->getAudioBinaural() != 0; @@ -502,10 +504,10 @@ void SSBDemod::webapiFormatChannelSettings(SWGSDRangel::SWGChannelSettings& resp { response.getSsbDemodSettings()->setAudioMute(settings.m_audioMute ? 1 : 0); response.getSsbDemodSettings()->setInputFrequencyOffset(settings.m_inputFrequencyOffset); - response.getSsbDemodSettings()->setRfBandwidth(settings.m_rfBandwidth); - response.getSsbDemodSettings()->setLowCutoff(settings.m_lowCutoff); + response.getSsbDemodSettings()->setRfBandwidth(settings.m_filterBank[settings.m_filterIndex].m_rfBandwidth); + response.getSsbDemodSettings()->setLowCutoff(settings.m_filterBank[settings.m_filterIndex].m_lowCutoff); response.getSsbDemodSettings()->setVolume(settings.m_volume); - response.getSsbDemodSettings()->setSpanLog2(settings.m_spanLog2); + response.getSsbDemodSettings()->setSpanLog2(settings.m_filterBank[settings.m_filterIndex].m_spanLog2); response.getSsbDemodSettings()->setAudioBinaural(settings.m_audioBinaural ? 1 : 0); response.getSsbDemodSettings()->setAudioFlipChannels(settings.m_audioFlipChannels ? 1 : 0); response.getSsbDemodSettings()->setDsb(settings.m_dsb ? 1 : 0); @@ -669,16 +671,16 @@ void SSBDemod::webapiFormatChannelSettings( swgSSBDemodSettings->setInputFrequencyOffset(settings.m_inputFrequencyOffset); } if (channelSettingsKeys.contains("rfBandwidth") || force) { - swgSSBDemodSettings->setRfBandwidth(settings.m_rfBandwidth); + swgSSBDemodSettings->setRfBandwidth(settings.m_filterBank[settings.m_filterIndex].m_rfBandwidth); } if (channelSettingsKeys.contains("lowCutoff") || force) { - swgSSBDemodSettings->setLowCutoff(settings.m_lowCutoff); + swgSSBDemodSettings->setLowCutoff(settings.m_filterBank[settings.m_filterIndex].m_lowCutoff); } if (channelSettingsKeys.contains("volume") || force) { swgSSBDemodSettings->setVolume(settings.m_volume); } if (channelSettingsKeys.contains("spanLog2") || force) { - swgSSBDemodSettings->setSpanLog2(settings.m_spanLog2); + swgSSBDemodSettings->setSpanLog2(settings.m_filterBank[settings.m_filterIndex].m_spanLog2); } if (channelSettingsKeys.contains("audioBinaural") || force) { swgSSBDemodSettings->setAudioBinaural(settings.m_audioBinaural ? 1 : 0); diff --git a/plugins/channelrx/demodssb/ssbdemodbaseband.cpp b/plugins/channelrx/demodssb/ssbdemodbaseband.cpp index 8f8c1a8fc..682b0f82e 100644 --- a/plugins/channelrx/demodssb/ssbdemodbaseband.cpp +++ b/plugins/channelrx/demodssb/ssbdemodbaseband.cpp @@ -163,11 +163,11 @@ void SSBDemodBaseband::applySettings(const SSBDemodSettings& settings, bool forc } } - if ((settings.m_spanLog2 != m_settings.m_spanLog2) || force) + if ((settings.m_filterBank[settings.m_filterIndex].m_spanLog2 != m_settings.m_filterBank[settings.m_filterIndex].m_spanLog2) || force) { if (m_spectrumVis) { - DSPSignalNotification *msg = new DSPSignalNotification(m_audioSampleRate/(1<getInputMessageQueue()->push(msg); } } @@ -194,7 +194,7 @@ void SSBDemodBaseband::applySettings(const SSBDemodSettings& settings, bool forc if (m_spectrumVis) { - DSPSignalNotification *msg = new DSPSignalNotification(m_audioSampleRate/(1<getInputMessageQueue()->push(msg); } } diff --git a/plugins/channelrx/demodssb/ssbdemodgui.cpp b/plugins/channelrx/demodssb/ssbdemodgui.cpp index f7985a950..30a5f8ba0 100644 --- a/plugins/channelrx/demodssb/ssbdemodgui.cpp +++ b/plugins/channelrx/demodssb/ssbdemodgui.cpp @@ -47,7 +47,7 @@ bool SSBDemodGUI::deserialize(const QByteArray& data) ui->BW->setMaximum(480); ui->lowCut->setMaximum(480); displaySettings(); - applyBandwidths(m_settings.m_spanLog2, true); // does applySettings(true) + applyBandwidths(m_settings.m_filterBank[m_settings.m_filterIndex].m_spanLog2, true); // does applySettings(true) return true; } else @@ -56,7 +56,7 @@ bool SSBDemodGUI::deserialize(const QByteArray& data) ui->BW->setMaximum(480); ui->lowCut->setMaximum(480); displaySettings(); - applyBandwidths(m_settings.m_spanLog2, true); // does applySettings(true) + applyBandwidths(m_settings.m_filterBank[m_settings.m_filterIndex].m_spanLog2, true); // does applySettings(true) return false; } } @@ -238,10 +238,24 @@ void SSBDemodGUI::on_flipSidebands_clicked(bool checked) void SSBDemodGUI::on_fftWindow_currentIndexChanged(int index) { - m_settings.m_fftWindow = (FFTWindow::Function) index; + m_settings.m_filterBank[m_settings.m_filterIndex].m_fftWindow = (FFTWindow::Function) index; applySettings(); } +void SSBDemodGUI::on_filterIndex_valueChanged(int value) +{ + if ((value < 0) || (value >= 10)) { + return; + } + + ui->filterIndexText->setText(tr("%1").arg(value)); + m_settings.m_filterIndex = value; + ui->BW->setMaximum(480); + ui->lowCut->setMaximum(480); + displaySettings(); + applyBandwidths(m_settings.m_filterBank[m_settings.m_filterIndex].m_spanLog2, true); // does applySettings(true) +} + void SSBDemodGUI::onMenuDialogCalled(const QPoint &p) { if (m_contextMenuType == ContextMenuChannelSettings) @@ -391,7 +405,7 @@ SSBDemodGUI::SSBDemodGUI(PluginAPI* pluginAPI, DeviceUISet *deviceUISet, Baseban displaySettings(); makeUIConnections(); - applyBandwidths(m_settings.m_spanLog2, true); // does applySettings(true) + applyBandwidths(m_settings.m_filterBank[m_settings.m_filterIndex].m_spanLog2, true); // does applySettings(true) } SSBDemodGUI::~SSBDemodGUI() @@ -518,9 +532,9 @@ void SSBDemodGUI::applyBandwidths(unsigned int spanLog2, bool force) ui->channelPowerMeter->setRange(SSBDemodSettings::m_minPowerThresholdDB, 0); m_settings.m_dsb = dsb; - m_settings.m_spanLog2 = spanLog2; - m_settings.m_rfBandwidth = bw * 100; - m_settings.m_lowCutoff = lw * 100; + m_settings.m_filterBank[m_settings.m_filterIndex].m_spanLog2 = spanLog2; + m_settings.m_filterBank[m_settings.m_filterIndex].m_rfBandwidth = bw * 100; + m_settings.m_filterBank[m_settings.m_filterIndex].m_lowCutoff = lw * 100; applySettings(force); @@ -536,19 +550,25 @@ void SSBDemodGUI::displaySettings() { m_channelMarker.blockSignals(true); m_channelMarker.setCenterFrequency(m_settings.m_inputFrequencyOffset); - m_channelMarker.setBandwidth(m_settings.m_rfBandwidth * 2); + m_channelMarker.setBandwidth(m_settings.m_filterBank[m_settings.m_filterIndex].m_rfBandwidth * 2); m_channelMarker.setTitle(m_settings.m_title); - m_channelMarker.setLowCutoff(m_settings.m_lowCutoff); + m_channelMarker.setLowCutoff(m_settings.m_filterBank[m_settings.m_filterIndex].m_lowCutoff); ui->flipSidebands->setEnabled(!m_settings.m_dsb); - if (m_settings.m_dsb) { + if (m_settings.m_dsb) + { m_channelMarker.setSidebands(ChannelMarker::dsb); - } else { - if (m_settings.m_rfBandwidth < 0) { + } + else + { + if (m_settings.m_filterBank[m_settings.m_filterIndex].m_rfBandwidth < 0) + { m_channelMarker.setSidebands(ChannelMarker::lsb); ui->dsb->setIcon(m_iconDSBLSB); - } else { + } + else + { m_channelMarker.setSidebands(ChannelMarker::usb); ui->dsb->setIcon(m_iconDSBUSB); } @@ -571,36 +591,38 @@ void SSBDemodGUI::displaySettings() ui->audioFlipChannels->setChecked(m_settings.m_audioFlipChannels); ui->audioMute->setChecked(m_settings.m_audioMute); ui->deltaFrequency->setValue(m_channelMarker.getCenterFrequency()); - ui->fftWindow->setCurrentIndex((int) m_settings.m_fftWindow); + ui->fftWindow->setCurrentIndex((int) m_settings.m_filterBank[m_settings.m_filterIndex].m_fftWindow); // Prevent uncontrolled triggering of applyBandwidths ui->spanLog2->blockSignals(true); ui->dsb->blockSignals(true); ui->BW->blockSignals(true); + ui->filterIndex->blockSignals(true); + + ui->filterIndex->setValue(m_settings.m_filterIndex); + ui->filterIndexText->setText(tr("%1").arg(m_settings.m_filterIndex)); ui->dsb->setChecked(m_settings.m_dsb); - ui->spanLog2->setValue(1 + ui->spanLog2->maximum() - m_settings.m_spanLog2); + ui->spanLog2->setValue(1 + ui->spanLog2->maximum() - m_settings.m_filterBank[m_settings.m_filterIndex].m_spanLog2); - ui->BW->setValue(m_settings.m_rfBandwidth / 100.0); - QString s = QString::number(m_settings.m_rfBandwidth/1000.0, 'f', 1); + ui->BW->setValue(m_settings.m_filterBank[m_settings.m_filterIndex].m_rfBandwidth / 100.0); + QString s = QString::number(m_settings.m_filterBank[m_settings.m_filterIndex].m_rfBandwidth/1000.0, 'f', 1); - if (m_settings.m_dsb) - { + if (m_settings.m_dsb) { ui->BWText->setText(tr("%1%2k").arg(QChar(0xB1, 0x00)).arg(s)); - } - else - { + } else { ui->BWText->setText(tr("%1k").arg(s)); } ui->spanLog2->blockSignals(false); ui->dsb->blockSignals(false); ui->BW->blockSignals(false); + ui->filterIndex->blockSignals(false); // The only one of the four signals triggering applyBandwidths will trigger it once only with all other values // set correctly and therefore validate the settings and apply them to dependent widgets - ui->lowCut->setValue(m_settings.m_lowCutoff / 100.0); - ui->lowCutText->setText(tr("%1k").arg(m_settings.m_lowCutoff / 1000.0)); + ui->lowCut->setValue(m_settings.m_filterBank[m_settings.m_filterIndex].m_lowCutoff / 100.0); + ui->lowCutText->setText(tr("%1k").arg(m_settings.m_filterBank[m_settings.m_filterIndex].m_lowCutoff / 1000.0)); int volume = CalcDb::dbPower(m_settings.m_volume); ui->volume->setValue(volume); @@ -727,6 +749,7 @@ void SSBDemodGUI::makeUIConnections() QObject::connect(ui->spanLog2, &QSlider::valueChanged, this, &SSBDemodGUI::on_spanLog2_valueChanged); QObject::connect(ui->flipSidebands, &QPushButton::clicked, this, &SSBDemodGUI::on_flipSidebands_clicked); QObject::connect(ui->fftWindow, QOverload::of(&QComboBox::currentIndexChanged), this, &SSBDemodGUI::on_fftWindow_currentIndexChanged); + QObject::connect(ui->filterIndex, &QDial::valueChanged, this, &SSBDemodGUI::on_filterIndex_valueChanged); } void SSBDemodGUI::updateAbsoluteCenterFrequency() diff --git a/plugins/channelrx/demodssb/ssbdemodgui.h b/plugins/channelrx/demodssb/ssbdemodgui.h index c9943ac9f..7a1519a97 100644 --- a/plugins/channelrx/demodssb/ssbdemodgui.h +++ b/plugins/channelrx/demodssb/ssbdemodgui.h @@ -108,6 +108,7 @@ private slots: void on_spanLog2_valueChanged(int value); void on_flipSidebands_clicked(bool checked); void on_fftWindow_currentIndexChanged(int index); + void on_filterIndex_valueChanged(int value); void onWidgetRolled(QWidget* widget, bool rollDown); void onMenuDialogCalled(const QPoint& p); void handleInputMessages(); diff --git a/plugins/channelrx/demodssb/ssbdemodgui.ui b/plugins/channelrx/demodssb/ssbdemodgui.ui index 391c7aa3d..b82c8f2d6 100644 --- a/plugins/channelrx/demodssb/ssbdemodgui.ui +++ b/plugins/channelrx/demodssb/ssbdemodgui.ui @@ -370,7 +370,7 @@ - FFT window function + FFT filter window function QComboBox::AdjustToContents @@ -417,6 +417,53 @@ + + + + + 24 + 24 + + + + Select filter in filter bank + + + 0 + + + 9 + + + 1 + + + 0 + + + + + + + + 10 + 0 + + + + false + + + Filter index in filter bank + + + 0 + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + diff --git a/plugins/channelrx/demodssb/ssbdemodsettings.cpp b/plugins/channelrx/demodssb/ssbdemodsettings.cpp index 08d6faf8c..ebe321025 100644 --- a/plugins/channelrx/demodssb/ssbdemodsettings.cpp +++ b/plugins/channelrx/demodssb/ssbdemodsettings.cpp @@ -35,6 +35,7 @@ SSBDemodSettings::SSBDemodSettings() : m_spectrumGUI(nullptr), m_rollupState(nullptr) { + m_filterBank.resize(10); resetToDefaults(); } @@ -49,10 +50,7 @@ void SSBDemodSettings::resetToDefaults() m_agcPowerThreshold = -100; m_agcThresholdGate = 4; m_agcTimeLog2 = 7; - m_rfBandwidth = 3000; - m_lowCutoff = 300; m_volume = 1.0; - m_spanLog2 = 3; m_inputFrequencyOffset = 0; m_rgbColor = QColor(0, 255, 0).rgb(); m_title = "SSB Demodulator"; @@ -65,14 +63,13 @@ void SSBDemodSettings::resetToDefaults() m_reverseAPIChannelIndex = 0; m_workspaceIndex = 0; m_hidden = false; - m_fftWindow = FFTWindow::Blackman; + m_filterIndex = 0; } QByteArray SSBDemodSettings::serialize() const { SimpleSerializer s(1); s.writeS32(1, m_inputFrequencyOffset); - s.writeS32(2, m_rfBandwidth / 100.0); s.writeS32(3, m_volume * 10.0); if (m_spectrumGUI) { @@ -80,8 +77,6 @@ QByteArray SSBDemodSettings::serialize() const } s.writeU32(5, m_rgbColor); - s.writeS32(6, m_lowCutoff / 100.0); - s.writeS32(7, m_spanLog2); s.writeBool(8, m_audioBinaural); s.writeBool(9, m_audioFlipChannels); s.writeBool(10, m_dsb); @@ -106,7 +101,15 @@ QByteArray SSBDemodSettings::serialize() const s.writeS32(25, m_workspaceIndex); s.writeBlob(26, m_geometryBytes); s.writeBool(27, m_hidden); - s.writeS32(28, (int) m_fftWindow); + s.writeU32(29, m_filterIndex); + + for (unsigned int i = 0; i < 10; i++) + { + s.writeS32(100 + 10*i, m_filterBank[i].m_spanLog2); + s.writeS32(101 + 10*i, m_filterBank[i].m_rfBandwidth / 100.0); + s.writeS32(102 + 10*i, m_filterBank[i].m_lowCutoff / 100.0); + s.writeS32(103 + 10*i, (int) m_filterBank[i].m_fftWindow); + } return s.final(); } @@ -129,8 +132,6 @@ bool SSBDemodSettings::deserialize(const QByteArray& data) QString strtmp; d.readS32(1, &m_inputFrequencyOffset, 0); - d.readS32(2, &tmp, 30); - m_rfBandwidth = tmp * 100.0; d.readS32(3, &tmp, 30); m_volume = tmp / 10.0; @@ -141,9 +142,6 @@ bool SSBDemodSettings::deserialize(const QByteArray& data) } d.readU32(5, &m_rgbColor); - d.readS32(6, &tmp, 30); - m_lowCutoff = tmp * 100.0; - d.readS32(7, &m_spanLog2, 3); d.readBool(8, &m_audioBinaural, false); d.readBool(9, &m_audioFlipChannels, false); d.readBool(10, &m_dsb, false); @@ -179,8 +177,19 @@ bool SSBDemodSettings::deserialize(const QByteArray& data) d.readS32(25, &m_workspaceIndex, 0); d.readBlob(26, &m_geometryBytes); d.readBool(27, &m_hidden, false); - d.readS32(28, &tmp, (int) FFTWindow::Blackman); - m_fftWindow = (FFTWindow::Function) (tmp < 0 ? 0 : tmp > (int) FFTWindow::Blackman ? (int) FFTWindow::Blackman : tmp); + d.readU32(29, &utmp, 0); + m_filterIndex = utmp < 10 ? utmp : 0; + + for (unsigned int i = 0; (i < 10); i++) + { + d.readS32(100 + 10*i, &m_filterBank[i].m_spanLog2, 3); + d.readS32(101 + 10*i, &tmp, 30); + m_filterBank[i].m_rfBandwidth = tmp * 100.0; + d.readS32(102+ 10*i, &tmp, 3); + m_filterBank[i].m_lowCutoff = tmp * 100.0; + d.readS32(103 + 10*i, &tmp, (int) FFTWindow::Blackman); + m_filterBank[i].m_fftWindow = (FFTWindow::Function) (tmp < 0 ? 0 : tmp > (int) FFTWindow::Blackman ? (int) FFTWindow::Blackman : tmp); + } return true; } diff --git a/plugins/channelrx/demodssb/ssbdemodsettings.h b/plugins/channelrx/demodssb/ssbdemodsettings.h index a9029c3c5..5ca298dbd 100644 --- a/plugins/channelrx/demodssb/ssbdemodsettings.h +++ b/plugins/channelrx/demodssb/ssbdemodsettings.h @@ -24,13 +24,28 @@ class Serializable; +struct SSBDemodFilterSettings +{ + int m_spanLog2; + Real m_rfBandwidth; + Real m_lowCutoff; + FFTWindow::Function m_fftWindow; + + SSBDemodFilterSettings() : + m_spanLog2(3), + m_rfBandwidth(3000), + m_lowCutoff(300), + m_fftWindow(FFTWindow::Blackman) + {} +}; + struct SSBDemodSettings { qint32 m_inputFrequencyOffset; - Real m_rfBandwidth; - Real m_lowCutoff; + // Real m_rfBandwidth; + // Real m_lowCutoff; Real m_volume; - int m_spanLog2; + // int m_spanLog2; bool m_audioBinaural; bool m_audioFlipChannels; bool m_dsb; @@ -52,7 +67,9 @@ struct SSBDemodSettings int m_workspaceIndex; QByteArray m_geometryBytes; bool m_hidden; - FFTWindow::Function m_fftWindow; + // FFTWindow::Function m_fftWindow; + std::vector m_filterBank; + unsigned int m_filterIndex; Serializable *m_channelMarker; Serializable *m_spectrumGUI; diff --git a/plugins/channelrx/demodssb/ssbdemodsink.cpp b/plugins/channelrx/demodssb/ssbdemodsink.cpp index 45c060ea1..a25a37988 100644 --- a/plugins/channelrx/demodssb/ssbdemodsink.cpp +++ b/plugins/channelrx/demodssb/ssbdemodsink.cpp @@ -291,8 +291,8 @@ void SSBDemodSink::applyAudioSampleRate(int sampleRate) m_interpolatorDistanceRemain = 0; m_interpolatorDistance = (Real) m_channelSampleRate / (Real) sampleRate; - SSBFilter->create_filter(m_LowCutoff / (float) sampleRate, m_Bandwidth / (float) sampleRate, m_settings.m_fftWindow); - DSBFilter->create_dsb_filter((2.0f * m_Bandwidth) / (float) sampleRate, m_settings.m_fftWindow); + SSBFilter->create_filter(m_LowCutoff / (float) sampleRate, m_Bandwidth / (float) sampleRate, m_settings.m_filterBank[m_settings.m_filterIndex].m_fftWindow); + DSBFilter->create_dsb_filter((2.0f * m_Bandwidth) / (float) sampleRate, m_settings.m_filterBank[m_settings.m_filterIndex].m_fftWindow); int agcNbSamples = (sampleRate / 1000) * (1<create_filter(m_LowCutoff / (float) m_audioSampleRate, m_Bandwidth / (float) m_audioSampleRate, settings.m_fftWindow); - DSBFilter->create_dsb_filter((2.0f * m_Bandwidth) / (float) m_audioSampleRate, settings.m_fftWindow); + SSBFilter->create_filter(m_LowCutoff / (float) m_audioSampleRate, m_Bandwidth / (float) m_audioSampleRate, settings.m_filterBank[settings.m_filterIndex].m_fftWindow); + DSBFilter->create_dsb_filter((2.0f * m_Bandwidth) / (float) m_audioSampleRate, settings.m_filterBank[settings.m_filterIndex].m_fftWindow); } if ((m_settings.m_volume != settings.m_volume) || force) @@ -441,7 +443,7 @@ void SSBDemodSink::applySettings(const SSBDemodSettings& settings, bool force) << " agcClamping: " << agcClamping; } - m_spanLog2 = settings.m_spanLog2; + m_spanLog2 = settings.m_filterBank[settings.m_filterIndex].m_spanLog2; m_audioBinaual = settings.m_audioBinaural; m_audioFlipChannels = settings.m_audioFlipChannels; m_dsb = settings.m_dsb;