1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2024-11-26 09:48:45 -05:00

SSB demod: added FFT filter window control

This commit is contained in:
f4exb 2022-05-18 10:45:53 +02:00
parent 5447a8caef
commit 1af4e5e667
6 changed files with 104 additions and 19 deletions

View File

@ -236,6 +236,12 @@ void SSBDemodGUI::on_flipSidebands_clicked(bool checked)
ui->lowCut->setValue(-lcValue);
}
void SSBDemodGUI::on_fftWindow_currentIndexChanged(int index)
{
m_settings.m_fftWindow = (FFTWindow::Function) index;
applySettings();
}
void SSBDemodGUI::onMenuDialogCalled(const QPoint &p)
{
if (m_contextMenuType == ContextMenuChannelSettings)
@ -565,6 +571,7 @@ 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);
// Prevent uncontrolled triggering of applyBandwidths
ui->spanLog2->blockSignals(true);
@ -719,6 +726,7 @@ void SSBDemodGUI::makeUIConnections()
QObject::connect(ui->audioMute, &QToolButton::toggled, this, &SSBDemodGUI::on_audioMute_toggled);
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<int>::of(&QComboBox::currentIndexChanged), this, &SSBDemodGUI::on_fftWindow_currentIndexChanged);
}
void SSBDemodGUI::updateAbsoluteCenterFrequency()

View File

@ -107,6 +107,7 @@ private slots:
void on_audioMute_toggled(bool checked);
void on_spanLog2_valueChanged(int value);
void on_flipSidebands_clicked(bool checked);
void on_fftWindow_currentIndexChanged(int index);
void onWidgetRolled(QWidget* widget, bool rollDown);
void onMenuDialogCalled(const QPoint& p);
void handleInputMessages();

View File

@ -349,6 +349,74 @@
</property>
</widget>
</item>
<item>
<widget class="QComboBox" name="fftWindow">
<property name="sizePolicy">
<sizepolicy hsizetype="Maximum" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>70</width>
<height>0</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>60</width>
<height>16777215</height>
</size>
</property>
<property name="toolTip">
<string>FFT window function</string>
</property>
<property name="sizeAdjustPolicy">
<enum>QComboBox::AdjustToContents</enum>
</property>
<item>
<property name="text">
<string>Bart</string>
</property>
</item>
<item>
<property name="text">
<string>B-H</string>
</property>
</item>
<item>
<property name="text">
<string>FT</string>
</property>
</item>
<item>
<property name="text">
<string>Ham</string>
</property>
</item>
<item>
<property name="text">
<string>Han</string>
</property>
</item>
<item>
<property name="text">
<string>Rec</string>
</property>
</item>
<item>
<property name="text">
<string>Kai</string>
</property>
</item>
<item>
<property name="text">
<string>Black</string>
</property>
</item>
</widget>
</item>
</layout>
</item>
<item>
@ -988,27 +1056,15 @@
</widget>
</widget>
<customwidgets>
<customwidget>
<class>RollupContents</class>
<extends>QWidget</extends>
<header>gui/rollupcontents.h</header>
<container>1</container>
</customwidget>
<customwidget>
<class>ButtonSwitch</class>
<extends>QToolButton</extends>
<header>gui/buttonswitch.h</header>
</customwidget>
<customwidget>
<class>LevelMeterSignalDB</class>
<class>RollupContents</class>
<extends>QWidget</extends>
<header>gui/levelmeter.h</header>
<container>1</container>
</customwidget>
<customwidget>
<class>ValueDialZ</class>
<extends>QWidget</extends>
<header>gui/valuedialz.h</header>
<header>gui/rollupcontents.h</header>
<container>1</container>
</customwidget>
<customwidget>
@ -1023,6 +1079,18 @@
<header>gui/glspectrumgui.h</header>
<container>1</container>
</customwidget>
<customwidget>
<class>ValueDialZ</class>
<extends>QWidget</extends>
<header>gui/valuedialz.h</header>
<container>1</container>
</customwidget>
<customwidget>
<class>LevelMeterSignalDB</class>
<extends>QWidget</extends>
<header>gui/levelmeter.h</header>
<container>1</container>
</customwidget>
<customwidget>
<class>TickedSlider</class>
<extends>QSlider</extends>

View File

@ -65,6 +65,7 @@ void SSBDemodSettings::resetToDefaults()
m_reverseAPIChannelIndex = 0;
m_workspaceIndex = 0;
m_hidden = false;
m_fftWindow = FFTWindow::Blackman;
}
QByteArray SSBDemodSettings::serialize() const
@ -105,6 +106,7 @@ 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);
return s.final();
}
@ -177,6 +179,8 @@ 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);
return true;
}

View File

@ -20,6 +20,8 @@
#include <QByteArray>
#include "dsp/fftwindow.h"
class Serializable;
struct SSBDemodSettings
@ -50,6 +52,7 @@ struct SSBDemodSettings
int m_workspaceIndex;
QByteArray m_geometryBytes;
bool m_hidden;
FFTWindow::Function m_fftWindow;
Serializable *m_channelMarker;
Serializable *m_spectrumGUI;

View File

@ -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);
DSBFilter->create_dsb_filter((2.0f * m_Bandwidth) / (float) 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);
int agcNbSamples = (sampleRate / 1000) * (1<<m_settings.m_agcTimeLog2);
int agcThresholdGate = (sampleRate / 1000) * m_settings.m_agcThresholdGate; // ms
@ -359,7 +359,8 @@ void SSBDemodSink::applySettings(const SSBDemodSettings& settings, bool force)
<< " force: " << force;
if((m_settings.m_rfBandwidth != settings.m_rfBandwidth) ||
(m_settings.m_lowCutoff != settings.m_lowCutoff) || force)
(m_settings.m_lowCutoff != settings.m_lowCutoff) ||
(m_settings.m_fftWindow != settings.m_fftWindow) || force)
{
float band, lowCutoff;
@ -387,8 +388,8 @@ void SSBDemodSink::applySettings(const SSBDemodSettings& settings, bool force)
m_interpolator.create(16, m_channelSampleRate, interpolatorBandwidth, 2.0f);
m_interpolatorDistanceRemain = 0;
m_interpolatorDistance = (Real) m_channelSampleRate / (Real) m_audioSampleRate;
SSBFilter->create_filter(m_LowCutoff / (float) m_audioSampleRate, m_Bandwidth / (float) m_audioSampleRate);
DSBFilter->create_dsb_filter((2.0f * m_Bandwidth) / (float) m_audioSampleRate);
SSBFilter->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);
}
if ((m_settings.m_volume != settings.m_volume) || force)