Add narrowband FM preemphasis settings

pull/647/head
Jon Beniston 2020-09-23 20:16:00 +01:00 zatwierdzone przez f4exb
rodzic af43c37cf3
commit d1f9c57f66
4 zmienionych plików z 84 dodań i 11 usunięć

Wyświetl plik

@ -52,8 +52,8 @@ void PacketModSettings::resetToDefaults()
m_ax25Control = 3;
m_ax25PID = 0xf0;
m_preEmphasis = false;
m_preEmphasisTau = 50e-6f;
m_preEmphasisHighFreq = 12000.0f;
m_preEmphasisTau = 531e-6f; // Narrowband FM
m_preEmphasisHighFreq = 3000.0f;
m_lpfTaps = 301;
m_bbNoise = false;
m_rfNoise = false;
@ -222,8 +222,8 @@ bool PacketModSettings::deserialize(const QByteArray& data)
d.readS32(18, &m_ax25Control, 3);
d.readS32(19, &m_ax25PID, 0xf0);
d.readBool(20, &m_preEmphasis, false);
d.readReal(21, &m_preEmphasisTau, 50e-6f);
d.readReal(22, &m_preEmphasisHighFreq, 12000.0f);
d.readReal(21, &m_preEmphasisTau, 531e-6f);
d.readReal(22, &m_preEmphasisHighFreq, 3000.0f);
d.readS32(23, &m_lpfTaps, 301);
d.readBool(24, &m_bbNoise, false);
d.readBool(25, &m_rfNoise, false);

Wyświetl plik

@ -51,6 +51,7 @@ void FMPreemphasisDialog::on_tau_valueChanged(double value)
// Set corresponding low frequency
ui->lowFreq->blockSignals(true);
ui->lowFreq->setValue(1.0/(2.0*M_PI*(value/TAU_SCALE)));
updateCombo();
ui->lowFreq->blockSignals(false);
}
@ -59,5 +60,41 @@ void FMPreemphasisDialog::on_lowFreq_valueChanged(double value)
// Set corresponding tau
ui->tau->blockSignals(true);
ui->tau->setValue(TAU_SCALE*1.0/(2.0*M_PI*value));
updateCombo();
ui->tau->blockSignals(false);
}
void FMPreemphasisDialog::updateCombo()
{
double value = ui->tau->value();
if (value == 531.0)
ui->preset->setCurrentIndex(0);
else if (value == 75.0)
ui->preset->setCurrentIndex(1);
else if (value == 50.0)
ui->preset->setCurrentIndex(2);
else
ui->preset->setCurrentIndex(3);
}
void FMPreemphasisDialog::on_preset_currentIndexChanged(int value)
{
if (value == 0)
{
// Narrowband FM
ui->lowFreq->setValue(300.0);
ui->highFreq->setValue(3000.0);
}
else if (value == 1)
{
// Broadcast FM (US)
ui->tau->setValue(75.0);
ui->highFreq->setValue(12000.0);
}
else if (value == 2)
{
// Broadcast FM (EU)
ui->tau->setValue(50.0);
ui->highFreq->setValue(12000.0);
}
}

Wyświetl plik

@ -32,6 +32,7 @@ class SDRGUI_API FMPreemphasisDialog : public QDialog {
public:
explicit FMPreemphasisDialog(float tau, float highFreq, QWidget* parent = 0);
~FMPreemphasisDialog();
void updateCombo();
float m_tau;
float m_highFreq;
@ -40,6 +41,7 @@ private slots:
void accept();
void on_tau_valueChanged(double value);
void on_lowFreq_valueChanged(double value);
void on_preset_currentIndexChanged(int value);
private:
Ui::FMPreemphasisDialog* ui;

Wyświetl plik

@ -7,7 +7,7 @@
<x>0</x>
<y>0</y>
<width>351</width>
<height>142</height>
<height>169</height>
</rect>
</property>
<property name="font">
@ -23,21 +23,21 @@
<item>
<widget class="QGroupBox" name="groupBox">
<layout class="QFormLayout" name="formLayout">
<item row="0" column="0">
<item row="1" column="0">
<widget class="QLabel" name="tauLabel">
<property name="text">
<string>Time constant (Tau) (us)</string>
</property>
</widget>
</item>
<item row="1" column="0">
<item row="2" column="0">
<widget class="QLabel" name="lowFreqLabel">
<property name="text">
<string>Low frequency corner (Hz)</string>
</property>
</widget>
</item>
<item row="1" column="1">
<item row="2" column="1">
<widget class="QDoubleSpinBox" name="lowFreq">
<property name="toolTip">
<string>Low frequency corner. Automatically calculated based on tau.</string>
@ -50,14 +50,14 @@
</property>
</widget>
</item>
<item row="2" column="0">
<item row="3" column="0">
<widget class="QLabel" name="highFreqLabel">
<property name="text">
<string>High frequency corner (Hz)</string>
</property>
</widget>
</item>
<item row="2" column="1">
<item row="3" column="1">
<widget class="QDoubleSpinBox" name="highFreq">
<property name="toolTip">
<string>High frequency corner.</string>
@ -70,7 +70,7 @@
</property>
</widget>
</item>
<item row="0" column="1">
<item row="1" column="1">
<widget class="QDoubleSpinBox" name="tau">
<property name="toolTip">
<string>Time constant in us. 50 for EU. 75 for USA.</string>
@ -86,6 +86,40 @@
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QComboBox" name="preset">
<property name="toolTip">
<string>Preset preemphasis values.</string>
</property>
<item>
<property name="text">
<string>Narrowband FM</string>
</property>
</item>
<item>
<property name="text">
<string>Broadcast FM (US)</string>
</property>
</item>
<item>
<property name="text">
<string>Broadcast FM (EU, Asia)</string>
</property>
</item>
<item>
<property name="text">
<string>User-defined</string>
</property>
</item>
</widget>
</item>
<item row="0" column="0">
<widget class="QLabel" name="presetLabel">
<property name="text">
<string>Preset</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>