1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2024-11-25 09:18:54 -05:00

WDSP receiver: implemented RIT and fixed audio binaural

This commit is contained in:
f4exb 2024-07-13 03:23:08 +02:00
parent 531e96de00
commit fb08489f5a
6 changed files with 163 additions and 32 deletions

View File

@ -162,6 +162,7 @@ void WDSPRxGUI::on_audioBinaural_toggled(bool binaural)
{
m_audioBinaural = binaural;
m_settings.m_audioBinaural = binaural;
m_settings.m_profiles[m_settings.m_profileIndex].m_audioBinaural = m_settings.m_audioBinaural;
applySettings();
}
@ -169,6 +170,7 @@ void WDSPRxGUI::on_audioFlipChannels_toggled(bool flip)
{
m_audioFlipChannels = flip;
m_settings.m_audioFlipChannels = flip;
m_settings.m_profiles[m_settings.m_profileIndex].m_audioFlipChannels = m_settings.m_audioFlipChannels;
applySettings();
}
@ -265,6 +267,20 @@ void WDSPRxGUI::on_equalizer_toggled(bool checked)
applySettings();
}
void WDSPRxGUI::on_rit_toggled(bool checked)
{
m_settings.m_rit = checked;
m_settings.m_profiles[m_settings.m_profileIndex].m_rit = m_settings.m_rit;
applySettings();
}
void WDSPRxGUI::on_ritFrequency_valueChanged(int value)
{
m_settings.m_ritFrequency = value;
ui->ritFrequencyText->setText(tr("%1").arg(value));
applySettings();
}
void WDSPRxGUI::on_audioMute_toggled(bool checked)
{
m_audioMute = checked;
@ -312,6 +328,9 @@ void WDSPRxGUI::on_profileIndex_valueChanged(int value)
ui->lowCut->setMaximum(480);
ui->lowCut->setMinimum(-480);
m_settings.m_demod = m_settings.m_profiles[m_settings.m_profileIndex].m_demod;
m_settings.m_audioBinaural = m_settings.m_profiles[m_settings.m_profileIndex].m_audioBinaural;
m_settings.m_audioFlipChannels = m_settings.m_profiles[m_settings.m_profileIndex].m_audioFlipChannels;
m_settings.m_dsb = m_settings.m_profiles[m_settings.m_profileIndex].m_dsb;
// AGC setup
m_settings.m_agc = m_settings.m_profiles[m_settings.m_profileIndex].m_agc;
m_settings.m_agcGain = m_settings.m_profiles[m_settings.m_profileIndex].m_agcGain;
@ -358,6 +377,9 @@ void WDSPRxGUI::on_profileIndex_valueChanged(int value)
m_settings.m_equalizer = m_settings.m_profiles[m_settings.m_profileIndex].m_equalizer;
m_settings.m_eqF = m_settings.m_profiles[m_settings.m_profileIndex].m_eqF;
m_settings.m_eqG = m_settings.m_profiles[m_settings.m_profileIndex].m_eqG;
// RIT
m_settings.m_rit = m_settings.m_profiles[m_settings.m_profileIndex].m_rit;
m_settings.m_ritFrequency = m_settings.m_profiles[m_settings.m_profileIndex].m_ritFrequency;
displaySettings();
applyBandwidths(m_settings.m_profiles[m_settings.m_profileIndex].m_spanLog2, true); // does applySettings(true)
}
@ -709,6 +731,7 @@ void WDSPRxGUI::applyBandwidths(unsigned int spanLog2, bool force)
ui->channelPowerMeter->setRange(WDSPRxSettings::m_minPowerThresholdDB, 0);
m_settings.m_dsb = dsb;
m_settings.m_profiles[m_settings.m_profileIndex].m_dsb = dsb;
m_settings.m_profiles[m_settings.m_profileIndex].m_spanLog2 = spanLog2;
m_settings.m_profiles[m_settings.m_profileIndex].m_highCutoff = bw * 100;
m_settings.m_profiles[m_settings.m_profileIndex].m_lowCutoff = lw * 100;
@ -780,6 +803,9 @@ void WDSPRxGUI::displaySettings()
ui->squelchThreshold->setValue(m_settings.m_squelchThreshold);
ui->squelchThresholdText->setText(tr("%1").arg(m_settings.m_squelchThreshold));
ui->equalizer->setChecked(m_settings.m_equalizer);
ui->rit->setChecked(m_settings.m_rit);
ui->ritFrequency->setValue((int) m_settings.m_ritFrequency);
ui->ritFrequencyText->setText(tr("%1").arg((int) m_settings.m_ritFrequency));
ui->audioBinaural->setChecked(m_settings.m_audioBinaural);
ui->audioFlipChannels->setChecked(m_settings.m_audioFlipChannels);
ui->audioMute->setChecked(m_settings.m_audioMute);
@ -1326,6 +1352,8 @@ void WDSPRxGUI::makeUIConnections()
QObject::connect(ui->squelch, &ButtonSwitch::toggled, this, &WDSPRxGUI::on_squelch_toggled);
QObject::connect(ui->squelchThreshold, &QDial::valueChanged, this, &WDSPRxGUI::on_squelchThreshold_valueChanged);
QObject::connect(ui->equalizer, &ButtonSwitch::toggled, this, &WDSPRxGUI::on_equalizer_toggled);
QObject::connect(ui->rit, &ButtonSwitch::toggled, this, &WDSPRxGUI::on_rit_toggled);
QObject::connect(ui->ritFrequency, &QDial::valueChanged, this, &WDSPRxGUI::on_ritFrequency_valueChanged);
}
void WDSPRxGUI::updateAbsoluteCenterFrequency()

View File

@ -147,6 +147,8 @@ private slots:
void on_squelch_toggled(bool checked);
void on_squelchThreshold_valueChanged(int value);
void on_equalizer_toggled(bool checked);
void on_rit_toggled(bool checked);
void on_ritFrequency_valueChanged(int value);
void onWidgetRolled(QWidget* widget, bool rollDown);
void onMenuDialogCalled(const QPoint& p);
void handleInputMessages();

View File

@ -6,7 +6,7 @@
<rect>
<x>0</x>
<y>0</y>
<width>514</width>
<width>542</width>
<height>179</height>
</rect>
</property>
@ -18,7 +18,7 @@
</property>
<property name="minimumSize">
<size>
<width>452</width>
<width>542</width>
<height>0</height>
</size>
</property>
@ -36,13 +36,13 @@
<rect>
<x>0</x>
<y>0</y>
<width>501</width>
<width>540</width>
<height>181</height>
</rect>
</property>
<property name="minimumSize">
<size>
<width>450</width>
<width>540</width>
<height>0</height>
</size>
</property>
@ -277,6 +277,53 @@
</property>
</widget>
</item>
<item>
<widget class="QDial" name="filterIndex">
<property name="maximumSize">
<size>
<width>24</width>
<height>24</height>
</size>
</property>
<property name="toolTip">
<string>Select profile in profile bank</string>
</property>
<property name="minimum">
<number>0</number>
</property>
<property name="maximum">
<number>9</number>
</property>
<property name="pageStep">
<number>1</number>
</property>
<property name="value">
<number>0</number>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="filterIndexText">
<property name="minimumSize">
<size>
<width>10</width>
<height>0</height>
</size>
</property>
<property name="acceptDrops">
<bool>false</bool>
</property>
<property name="toolTip">
<string>Filter index in filter bank</string>
</property>
<property name="text">
<string>0</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
</layout>
</item>
</layout>
@ -392,16 +439,10 @@
</property>
<property name="minimumSize">
<size>
<width>70</width>
<width>50</width>
<height>0</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>60</width>
<height>16777215</height>
</size>
</property>
<property name="toolTip">
<string>FFT filter window function</string>
</property>
@ -421,7 +462,20 @@
</widget>
</item>
<item>
<widget class="QDial" name="filterIndex">
<widget class="ButtonSwitch" name="rit">
<property name="toolTip">
<string>Toggle RIT</string>
</property>
<property name="text">
<string>RIT</string>
</property>
<property name="checkable">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QDial" name="ritFrequency">
<property name="maximumSize">
<size>
<width>24</width>
@ -429,13 +483,13 @@
</size>
</property>
<property name="toolTip">
<string>Select profile in profile bank</string>
<string>RIT frequency (Hz)</string>
</property>
<property name="minimum">
<number>0</number>
<number>-1000</number>
</property>
<property name="maximum">
<number>9</number>
<number>1000</number>
</property>
<property name="pageStep">
<number>1</number>
@ -446,21 +500,18 @@
</widget>
</item>
<item>
<widget class="QLabel" name="filterIndexText">
<widget class="QLabel" name="ritFrequencyText">
<property name="minimumSize">
<size>
<width>10</width>
<width>32</width>
<height>0</height>
</size>
</property>
<property name="acceptDrops">
<bool>false</bool>
</property>
<property name="toolTip">
<string>Filter index in filter bank</string>
<string>RIT frequency (Hz)</string>
</property>
<property name="text">
<string>0</string>
<string>-0000</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
@ -486,7 +537,7 @@
</size>
</property>
<property name="text">
<string>Low cut</string>
<string>Near cut</string>
</property>
</widget>
</item>
@ -568,7 +619,7 @@
</size>
</property>
<property name="text">
<string>Hi cut</string>
<string>Far cut</string>
</property>
</widget>
</item>
@ -822,11 +873,17 @@
</item>
<item>
<widget class="QLabel" name="volumeText">
<property name="minimumSize">
<size>
<width>20</width>
<height>0</height>
</size>
</property>
<property name="toolTip">
<string>Audio volume in dB</string>
</property>
<property name="text">
<string>10</string>
<string>-10</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>

View File

@ -94,6 +94,9 @@ void WDSPRxSettings::resetToDefaults()
m_equalizer = false;
m_eqF = {0.0, 32.0, 63.0, 125.0, 250.0, 500.0, 1000.0, 2000.0, 4000.0, 8000.0, 16000.0};
m_eqG = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
// RIT
m_rit = false;
m_ritFrequency = 0.0;
//
m_volume = 1.0;
m_inputFrequencyOffset = 0;
@ -212,10 +215,15 @@ QByteArray WDSPRxSettings::serialize() const
s.writeBlob( 80, m_geometryBytes);
s.writeBool( 81, m_hidden);
s.writeU32( 82, m_profileIndex);
s.writeBool( 83, m_rit);
s.writeDouble(84, m_ritFrequency);
for (unsigned int i = 0; i < 10; i++)
{
s.writeS32 (104 + 100*i, (int) m_profiles[i].m_demod);
s.writeBool (105 + 100*i, (int) m_profiles[i].m_audioBinaural);
s.writeBool (106 + 100*i, (int) m_profiles[i].m_audioFlipChannels);
s.writeBool (107 + 100*i, (int) m_profiles[i].m_dsb);
// Filter
s.writeS32 (100 + 100*i, m_profiles[i].m_spanLog2);
s.writeS32 (101 + 100*i, m_profiles[i].m_highCutoff / 100.0);
@ -409,6 +417,8 @@ bool WDSPRxSettings::deserialize(const QByteArray& data)
d.readBool( 81, &m_hidden, false);
d.readU32( 82, &utmp, 0);
m_profileIndex = utmp < 10 ? utmp : 0;
d.readBool( 83, &m_rit, false);
d.readDouble( 84, &m_ritFrequency, 0);
d.readBool( 90, &m_equalizer, false);
d.readFloat(4000, &m_eqF[0], 0.0);
@ -438,6 +448,9 @@ bool WDSPRxSettings::deserialize(const QByteArray& data)
{
d.readS32 (104 + 100*i, &tmp, 9);
m_profiles[i].m_demod = (WDSPRxProfile::WDSPRxDemod) tmp;
d.readBool( 105 + 100*i, &m_profiles[i].m_audioBinaural, false);
d.readBool( 106 + 100*i, &m_profiles[i].m_audioFlipChannels, false);
d.readBool( 107 + 100*i, &m_profiles[i].m_dsb, false);
// Filter
d.readS32 (100 + 100*i, &m_profiles[i].m_spanLog2, 3);
d.readS32 (101 + 100*i, &tmp, 30);
@ -497,6 +510,9 @@ bool WDSPRxSettings::deserialize(const QByteArray& data)
d.readDouble(163 + 100*i, &m_profiles[i].m_ssqlTauMute, 0.1);
d.readDouble(164 + 100*i, &m_profiles[i].m_ssqlTauUnmute, 0.1);
d.readDouble(165 + 100*i, &m_profiles[i].m_amsqMaxTail, 1.5);
// RIT
d.readBool( 183 + 100*i, &m_profiles[i].m_rit, false);
d.readDouble(184 + 100*i, &m_profiles[i].m_ritFrequency, 0.0);
// Equalizer
d.readBool( 190 + 100*i, &m_profiles[i].m_equalizer, false);
d.readFloat(4100 + 100*i, &m_profiles[i].m_eqF[0], 0.0);

View File

@ -86,6 +86,9 @@ struct WDSPRxProfile
};
WDSPRxDemod m_demod;
bool m_audioBinaural;
bool m_audioFlipChannels;
bool m_dsb;
// Filter
int m_spanLog2;
Real m_highCutoff;
@ -139,9 +142,15 @@ struct WDSPRxProfile
bool m_equalizer;
std::array<float, 11> m_eqF; //!< Frequencies vector. Index 0 is always 0 as this is the preamp position
std::array<float, 11> m_eqG; //!< Gains vector (dB). Index 0 is the preamp (common) gain
// RIT
bool m_rit;
double m_ritFrequency;
WDSPRxProfile() :
m_demod(DemodSSB),
m_audioBinaural(false),
m_audioFlipChannels(false),
m_dsb(false),
m_spanLog2(3),
m_highCutoff(3000),
m_lowCutoff(300),
@ -187,7 +196,9 @@ struct WDSPRxProfile
m_amsqMaxTail(1.5),
m_equalizer(false),
m_eqF{0.0, 32.0, 63.0, 125.0, 250.0, 500.0, 1000.0, 2000.0, 4000.0, 8000.0, 16000.0},
m_eqG{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}
m_eqG{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
m_rit(false),
m_ritFrequency(0)
{}
};
@ -251,6 +262,9 @@ struct WDSPRxSettings
bool m_equalizer;
std::array<float, 11> m_eqF = {0.0, 32.0, 63.0, 125.0, 250.0, 500.0, 1000.0, 2000.0, 4000.0, 8000.0, 16000.0}; //!< Frequencies vector. Index 0 is always 0 as this is the preamp position
std::array<float, 11> m_eqG = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}; //!< Gains vector (dB). Index 0 is the preamp (common) gain
// RIT
bool m_rit;
double m_ritFrequency;
quint32 m_rgbColor;
QString m_title;

View File

@ -43,6 +43,7 @@
#include "amsq.hpp"
#include "fmsq.hpp"
#include "eq.hpp"
#include "shift.hpp"
#include "wdsprxsink.h"
@ -357,6 +358,8 @@ void WDSPRxSink::applySettings(const WDSPRxSettings& settings, bool force)
<< " m_nr2Gain: " << settings.m_nr2Gain
<< " m_nr2NPE: " << settings.m_nr2NPE
<< " m_nr2ArtifactReduction: " << settings.m_nr2ArtifactReduction
<< " m_rit: " << settings.m_rit
<< " m_ritFrequency: " << settings.m_ritFrequency
<< " m_streamIndex: " << settings.m_streamIndex
<< " m_useReverseAPI: " << settings.m_useReverseAPI
<< " m_reverseAPIAddress: " << settings.m_reverseAPIAddress
@ -365,6 +368,15 @@ void WDSPRxSink::applySettings(const WDSPRxSettings& settings, bool force)
<< " m_reverseAPIChannelIndex: " << settings.m_reverseAPIChannelIndex
<< " force: " << force;
// RIT
if ((m_settings.m_rit != settings.m_rit) || (m_settings.m_ritFrequency != settings.m_ritFrequency) || force)
{
WDSP::SHIFT::SetShiftFreq(*m_rxa, settings.m_ritFrequency);
WDSP::SHIFT::SetShiftRun(*m_rxa, settings.m_rit ? 1 : 0);
}
// Filter and mode
if((m_settings.m_profiles[m_settings.m_profileIndex].m_highCutoff != settings.m_profiles[settings.m_profileIndex].m_highCutoff) ||
@ -735,12 +747,14 @@ void WDSPRxSink::applySettings(const WDSPRxSettings& settings, bool force)
WDSP::PANEL::SetPanelGain1(*m_rxa, settings.m_volume);
}
if ((m_settings.m_audioBinaural != settings.m_audioBinaural) || force) {
WDSP::PANEL::SetPanelBinaural(*m_rxa, settings.m_audioBinaural ? 1 : 0);
}
if ((m_settings.m_audioFlipChannels != settings.m_audioFlipChannels) || force) {
WDSP::PANEL::SetPanelCopy(*m_rxa, settings.m_audioFlipChannels ? 3 : 0);
if ((m_settings.m_audioBinaural != settings.m_audioBinaural)
|| (m_settings.m_audioFlipChannels != settings.m_audioFlipChannels) || force)
{
if (settings.m_audioBinaural) {
WDSP::PANEL::SetPanelCopy(*m_rxa, settings.m_audioFlipChannels ? 3 : 0);
} else {
WDSP::PANEL::SetPanelCopy(*m_rxa, settings.m_audioFlipChannels ? 2 : 1);
}
}
// AGC