diff --git a/alsoftrc.sample b/alsoftrc.sample
index fcdd4027..e8a28479 100644
--- a/alsoftrc.sample
+++ b/alsoftrc.sample
@@ -181,6 +181,12 @@
# than the default has no effect.
#sends = 16
+## output-limiter:
+# Applies a gain limiter on the final mixed output. This reduces the volume
+# when the output samples would otherwise clamp, avoiding excessive clipping
+# noise.
+#output-limiter = true
+
## volume-adjust:
# A global volume adjustment for source output, expressed in decibels. The
# value is logarithmic, so +6 will be a scale of (approximately) 2x, +12 will
diff --git a/utils/alsoft-config/mainwindow.cpp b/utils/alsoft-config/mainwindow.cpp
index 26d05f8f..d46bb029 100644
--- a/utils/alsoft-config/mainwindow.cpp
+++ b/utils/alsoft-config/mainwindow.cpp
@@ -328,6 +328,7 @@ MainWindow::MainWindow(QWidget *parent) :
connect(ui->stereoEncodingComboBox, SIGNAL(currentIndexChanged(QString)), this, SLOT(enableApplyButton()));
connect(ui->ambiFormatComboBox, SIGNAL(currentIndexChanged(QString)), this, SLOT(enableApplyButton()));
+ connect(ui->outputLimiterCheckBox, SIGNAL(stateChanged(int)), this, SLOT(enableApplyButton()));
connect(ui->decoderHQModeCheckBox, SIGNAL(stateChanged(int)), this, SLOT(enableApplyButton()));
connect(ui->decoderDistCompCheckBox, SIGNAL(stateChanged(int)), this, SLOT(enableApplyButton()));
@@ -641,6 +642,13 @@ void MainWindow::loadConfig(const QString &fname)
updatePeriodCountSlider();
}
+ if(settings.value("output-limiter").isNull())
+ ui->outputLimiterCheckBox->setCheckState(Qt::PartiallyChecked);
+ else
+ ui->outputLimiterCheckBox->setCheckState(
+ settings.value("output-limiter").toBool() ? Qt::Checked : Qt::Unchecked
+ );
+
QString stereopan = settings.value("stereo-encoding").toString();
ui->stereoEncodingComboBox->setCurrentIndex(0);
if(stereopan.isEmpty() == false)
@@ -896,6 +904,14 @@ void MainWindow::saveConfig(const QString &fname) const
settings.setValue("stereo-encoding", getValueFromName(stereoEncList, ui->stereoEncodingComboBox->currentText()));
settings.setValue("ambi-format", getValueFromName(ambiFormatList, ui->ambiFormatComboBox->currentText()));
+ Qt::CheckState limiter = ui->outputLimiterCheckBox->checkState();
+ if(limiter == Qt::PartiallyChecked)
+ settings.setValue("output-limiter", QString());
+ else if(limiter == Qt::Checked)
+ settings.setValue("output-limiter", QString("true"));
+ else if(limiter == Qt::Unchecked)
+ settings.setValue("output-limiter", QString("false"));
+
settings.setValue("decoder/hq-mode",
ui->decoderHQModeCheckBox->isChecked() ? QString("true") : QString(/*"false"*/)
);
diff --git a/utils/alsoft-config/mainwindow.ui b/utils/alsoft-config/mainwindow.ui
index a527cfd5..153bcc04 100644
--- a/utils/alsoft-config/mainwindow.ui
+++ b/utils/alsoft-config/mainwindow.ui
@@ -129,7 +129,7 @@ to stereo output.
380
20
91
- 21
+ 29
@@ -236,9 +236,9 @@ otherwise be suitable for speakers.
-11
- 200
+ 180
551
- 181
+ 201
@@ -483,6 +483,27 @@ receiver.
+
+
+
+ 30
+ 160
+ 231
+ 20
+
+
+
+ Applies a gain limiter on the final mixed output. This reduces the
+volume when the output samples would otherwise be clamped,
+avoiding excessive clipping noise.
+
+
+ Enable Gain Limiter
+
+
+ true
+
+
@@ -2107,7 +2128,7 @@ added by the ALC_EXT_DEDICATED extension.
160
20
123
- 21
+ 29