mirror of
https://github.com/f4exb/sdrangel.git
synced 2026-06-05 07:24:44 -04:00
Audio inout: added DC block and IQ imbalance
This commit is contained in:
@@ -312,6 +312,14 @@ void AudioInput::applySettings(const AudioInputSettings& settings, QList<QString
|
||||
}
|
||||
}
|
||||
|
||||
if (settingsKeys.contains("dcBlock") || settingsKeys.contains("iqImbalance") || force)
|
||||
{
|
||||
m_deviceAPI->configureCorrections(settings.m_dcBlock, settings.m_iqImbalance);
|
||||
qDebug("AudioInput::applySettings: corrections: DC block: %s IQ imbalance: %s",
|
||||
settings.m_dcBlock ? "true" : "false",
|
||||
settings.m_iqImbalance ? "true" : "false");
|
||||
}
|
||||
|
||||
if (settingsKeys.contains("useReverseAPI"))
|
||||
{
|
||||
bool fullUpdate = (settingsKeys.contains("useReverseAPI") && settings.m_useReverseAPI) ||
|
||||
@@ -423,6 +431,12 @@ void AudioInput::webapiUpdateDeviceSettings(
|
||||
if (deviceSettingsKeys.contains("iqMapping")) {
|
||||
settings.m_iqMapping = (AudioInputSettings::IQMapping)response.getAudioInputSettings()->getIqMapping();
|
||||
}
|
||||
if (deviceSettingsKeys.contains("dcBlock")) {
|
||||
settings.m_dcBlock = response.getAudioInputSettings()->getDcBlock() != 0;
|
||||
}
|
||||
if (deviceSettingsKeys.contains("iqImbalance")) {
|
||||
settings.m_iqImbalance = response.getAudioInputSettings()->getIqImbalance() != 0;
|
||||
}
|
||||
if (deviceSettingsKeys.contains("useReverseAPI")) {
|
||||
settings.m_useReverseAPI = response.getAudioInputSettings()->getUseReverseApi() != 0;
|
||||
}
|
||||
@@ -444,6 +458,8 @@ void AudioInput::webapiFormatDeviceSettings(SWGSDRangel::SWGDeviceSettings& resp
|
||||
response.getAudioInputSettings()->setVolume(settings.m_volume);
|
||||
response.getAudioInputSettings()->setLog2Decim(settings.m_log2Decim);
|
||||
response.getAudioInputSettings()->setIqMapping((int)settings.m_iqMapping);
|
||||
response.getAudioInputSettings()->setDcBlock(settings.m_dcBlock ? 1 : 0);
|
||||
response.getAudioInputSettings()->setIqImbalance(settings.m_iqImbalance ? 1 : 0);
|
||||
|
||||
response.getAudioInputSettings()->setUseReverseApi(settings.m_useReverseAPI ? 1 : 0);
|
||||
|
||||
@@ -483,6 +499,12 @@ void AudioInput::webapiReverseSendSettings(const QList<QString>& deviceSettingsK
|
||||
if (deviceSettingsKeys.contains("iqMapping") || force) {
|
||||
swgAudioInputSettings->setIqMapping(settings.m_iqMapping);
|
||||
}
|
||||
if (deviceSettingsKeys.contains("dcBlock") || force) {
|
||||
swgAudioInputSettings->setDcBlock(settings.m_dcBlock ? 1 : 0);
|
||||
}
|
||||
if (deviceSettingsKeys.contains("iqImbalance") || force) {
|
||||
swgAudioInputSettings->setIqImbalance(settings.m_iqImbalance ? 1 : 0);
|
||||
}
|
||||
|
||||
QString deviceSettingsURL = QString("http://%1:%2/sdrangel/deviceset/%3/device/settings")
|
||||
.arg(settings.m_reverseAPIAddress)
|
||||
|
||||
@@ -242,6 +242,8 @@ void AudioInputGui::displaySettings()
|
||||
ui->volume->setValue((int)(m_settings.m_volume*10.0f));
|
||||
ui->volumeText->setText(QString("%1").arg(m_settings.m_volume, 3, 'f', 1));
|
||||
ui->channels->setCurrentIndex((int)m_settings.m_iqMapping);
|
||||
ui->dcOffset->setChecked(m_settings.m_dcBlock);
|
||||
ui->iqImbalance->setChecked(m_settings.m_iqImbalance);
|
||||
refreshSampleRates(ui->device->currentText());
|
||||
}
|
||||
|
||||
@@ -289,6 +291,20 @@ void AudioInputGui::on_channels_currentIndexChanged(int index)
|
||||
sendSettings();
|
||||
}
|
||||
|
||||
void AudioInputGui::on_dcOffset_toggled(bool checked)
|
||||
{
|
||||
m_settings.m_dcBlock = checked;
|
||||
m_settingsKeys.append("dcBlock");
|
||||
sendSettings();
|
||||
}
|
||||
|
||||
void AudioInputGui::on_iqImbalance_toggled(bool checked)
|
||||
{
|
||||
m_settings.m_iqImbalance = checked;
|
||||
m_settingsKeys.append("iqImbalance");
|
||||
sendSettings();
|
||||
}
|
||||
|
||||
void AudioInputGui::on_startStop_toggled(bool checked)
|
||||
{
|
||||
if (m_doApplySettings)
|
||||
@@ -376,5 +392,7 @@ void AudioInputGui::makeUIConnections()
|
||||
QObject::connect(ui->decim, QOverload<int>::of(&QComboBox::currentIndexChanged), this, &AudioInputGui::on_decim_currentIndexChanged);
|
||||
QObject::connect(ui->volume, &QDial::valueChanged, this, &AudioInputGui::on_volume_valueChanged);
|
||||
QObject::connect(ui->channels, QOverload<int>::of(&QComboBox::currentIndexChanged), this, &AudioInputGui::on_channels_currentIndexChanged);
|
||||
QObject::connect(ui->dcOffset, &ButtonSwitch::toggled, this, &AudioInputGui::on_dcOffset_toggled);
|
||||
QObject::connect(ui->iqImbalance, &ButtonSwitch::toggled, this, &AudioInputGui::on_iqImbalance_toggled);
|
||||
QObject::connect(ui->startStop, &ButtonSwitch::toggled, this, &AudioInputGui::on_startStop_toggled);
|
||||
}
|
||||
|
||||
@@ -77,6 +77,8 @@ private slots:
|
||||
void on_decim_currentIndexChanged(int index);
|
||||
void on_volume_valueChanged(int value);
|
||||
void on_channels_currentIndexChanged(int index);
|
||||
void on_dcOffset_toggled(bool checked);
|
||||
void on_iqImbalance_toggled(bool checked);
|
||||
void on_startStop_toggled(bool checked);
|
||||
void updateHardware();
|
||||
void openDeviceSettingsDialog(const QPoint& p);
|
||||
|
||||
@@ -114,6 +114,26 @@
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="ButtonSwitch" name="dcOffset">
|
||||
<property name="toolTip">
|
||||
<string>Automatic DC offset removal</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>DC</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="ButtonSwitch" name="iqImbalance">
|
||||
<property name="toolTip">
|
||||
<string>Automatic IQ imbalance correction</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>IQ</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="sizePolicy">
|
||||
|
||||
@@ -32,6 +32,8 @@ void AudioInputSettings::resetToDefaults()
|
||||
m_volume = 1.0f;
|
||||
m_log2Decim = 0;
|
||||
m_iqMapping = L;
|
||||
m_dcBlock = false;
|
||||
m_iqImbalance = false;
|
||||
m_useReverseAPI = false;
|
||||
m_reverseAPIAddress = "127.0.0.1";
|
||||
m_reverseAPIPort = 8888;
|
||||
@@ -47,6 +49,8 @@ QByteArray AudioInputSettings::serialize() const
|
||||
s.writeFloat(3, m_volume);
|
||||
s.writeU32(4, m_log2Decim);
|
||||
s.writeS32(5, (int)m_iqMapping);
|
||||
s.writeBool(6, m_dcBlock);
|
||||
s.writeBool(7, m_iqImbalance);
|
||||
|
||||
s.writeBool(24, m_useReverseAPI);
|
||||
s.writeString(25, m_reverseAPIAddress);
|
||||
@@ -75,6 +79,8 @@ bool AudioInputSettings::deserialize(const QByteArray& data)
|
||||
d.readFloat(3, &m_volume, 1.0f);
|
||||
d.readU32(4, &m_log2Decim, 0);
|
||||
d.readS32(5, (int *)&m_iqMapping, IQMapping::L);
|
||||
d.readBool(6, &m_dcBlock, false);
|
||||
d.readBool(7, &m_iqImbalance, false);
|
||||
|
||||
d.readBool(24, &m_useReverseAPI, false);
|
||||
d.readString(25, &m_reverseAPIAddress, "127.0.0.1");
|
||||
@@ -115,6 +121,12 @@ void AudioInputSettings::applySettings(const QStringList& settingsKeys, const Au
|
||||
if (settingsKeys.contains("iqMapping")) {
|
||||
m_iqMapping = settings.m_iqMapping;
|
||||
}
|
||||
if (settingsKeys.contains("dcBlock")) {
|
||||
m_dcBlock = settings.m_dcBlock;
|
||||
}
|
||||
if (settingsKeys.contains("iqImbalance")) {
|
||||
m_iqImbalance = settings.m_iqImbalance;
|
||||
}
|
||||
if (settingsKeys.contains("useReverseAPI")) {
|
||||
m_useReverseAPI = settings.m_useReverseAPI;
|
||||
}
|
||||
@@ -148,6 +160,12 @@ QString AudioInputSettings::getDebugString(const QStringList& settingsKeys, bool
|
||||
if (settingsKeys.contains("iqMapping") || force) {
|
||||
ostr << " m_iqMapping: " << m_iqMapping;
|
||||
}
|
||||
if (settingsKeys.contains("dcBlock") || force) {
|
||||
ostr << " m_dcBlock: " << m_dcBlock;
|
||||
}
|
||||
if (settingsKeys.contains("iqImbalance") || force) {
|
||||
ostr << " m_iqImbalance: " << m_iqImbalance;
|
||||
}
|
||||
if (settingsKeys.contains("useReverseAPI") || force) {
|
||||
ostr << " m_useReverseAPI: " << m_useReverseAPI;
|
||||
}
|
||||
|
||||
@@ -34,6 +34,8 @@ struct AudioInputSettings {
|
||||
LR,
|
||||
RL
|
||||
} m_iqMapping;
|
||||
bool m_dcBlock;
|
||||
bool m_iqImbalance;
|
||||
|
||||
bool m_useReverseAPI;
|
||||
QString m_reverseAPIAddress;
|
||||
|
||||
@@ -46,3 +46,11 @@ This controls how the left and right audio channels map on to the IQ channels.
|
||||
* Mono R - Same as above but takes the right audio channel for the real signal.
|
||||
* I=L, Q=R - The left audio channel is driven to the I channel. The right audio channel is driven to the Q channel for a complex (analytic signal)input.
|
||||
* I=R, Q=L - The right audio channel is driven to the I channel. The left audio channel is driven to the Q channel for a complex (analytic signal)input.
|
||||
|
||||
<h3>8: Auto remove DC component</h3>
|
||||
|
||||
Software DSP auto remove DC correction.
|
||||
|
||||
<h3>9: Auto make I/Q balance</h3>
|
||||
|
||||
Software DSP auto I/Q imbalance correction. The DC correction (8) must be enabled for this to be effective.
|
||||
|
||||
Reference in New Issue
Block a user