diff --git a/UI/data/locale/en-US.ini b/UI/data/locale/en-US.ini
index 118328daec2b206b90e7346408654908142b0506..9ed218448e9d3f585e45c2f01279e18372c51d81 100644
--- a/UI/data/locale/en-US.ini
+++ b/UI/data/locale/en-US.ini
@@ -700,6 +700,10 @@ Basic.Settings.Video.DownscaleFilter.Lanczos="Lanczos (Sharpened scaling, 32 sam
Basic.Settings.Audio="Audio"
Basic.Settings.Audio.SampleRate="Sample Rate"
Basic.Settings.Audio.Channels="Channels"
+Basic.Settings.Audio.MeterDecayRate="Audio Meter Decay Rate"
+Basic.Settings.Audio.MeterDecayRate.Fast="Fast"
+Basic.Settings.Audio.MeterDecayRate.Medium="Medium (Type I PPM)"
+Basic.Settings.Audio.MeterDecayRate.Slow="Slow (Type II PPM)"
Basic.Settings.Audio.MultiChannelWarning.Enabled="WARNING: Surround sound audio is enabled."
Basic.Settings.Audio.MultichannelWarning="If streaming, check to see if your streaming service supports both surround sound ingest and surround sound playback. Twitch, Facebook 360 Live, Mixer RTMP, Smashcast are examples where surround sound is fully supported. Although Facebook Live and YouTube Live both accept surround ingest, Facebook Live downmixes to stereo, and YouTube Live plays only two channels.\n\nOBS audio filters are compatible with surround sound, though VST plugin support isn't guaranteed."
Basic.Settings.Audio.MultichannelWarning.Title="Enable surround sound audio?"
diff --git a/UI/data/themes/Dark.qss b/UI/data/themes/Dark.qss
index 4b08da93a61fae63447276da2c1a4646ee8a33fc..4a9326c6acc6cf8c953a39459a732844894f878f 100644
--- a/UI/data/themes/Dark.qss
+++ b/UI/data/themes/Dark.qss
@@ -518,7 +518,6 @@ VolumeMeter {
qproperty-magnitudeColor: rgb(0, 0, 0);
qproperty-majorTickColor: rgb(225,224,225); /* veryLight */
qproperty-minorTickColor: rgb(122,121,122); /* light */
- qproperty-peakDecayRate: 23.4; /* Override of the standard PPM Type I rate. */
}
diff --git a/UI/data/themes/Default.qss b/UI/data/themes/Default.qss
index 772f8af05a747ce54231367696caf55e0390ac3e..0b88dd451ba9573b7961deda55b49e068cc389ba 100644
--- a/UI/data/themes/Default.qss
+++ b/UI/data/themes/Default.qss
@@ -68,7 +68,6 @@ VolumeMeter {
qproperty-magnitudeColor: rgb(0, 0, 0);
qproperty-majorTickColor: rgb(0, 0, 0);
qproperty-minorTickColor: rgb(50, 50, 50);
- qproperty-peakDecayRate: 23.4; /* Override of the standard PPM Type I rate. */
}
diff --git a/UI/data/themes/Rachni.qss b/UI/data/themes/Rachni.qss
index 7110ddabc0f64a1259ad3cebd2a6ad86baeca499..5c7887cdbaf57c667c021d0e95df9a11a89eba73 100644
--- a/UI/data/themes/Rachni.qss
+++ b/UI/data/themes/Rachni.qss
@@ -729,7 +729,6 @@ VolumeMeter {
qproperty-magnitudeColor: rgb(49, 54, 59); /* Blue-gray */
qproperty-majorTickColor: rgb(239, 240, 241); /* White */
qproperty-minorTickColor: rgb(118, 121, 124); /* Light Gray */
- qproperty-peakDecayRate: 23.4; /* Override of the standard PPM Type I rate. */
}
/*******************/
diff --git a/UI/forms/OBSBasicSettings.ui b/UI/forms/OBSBasicSettings.ui
index 8430b10a3507a0adac9c5d85650208657cdd9f5a..c89cc1e693b0dc44bcaddb8bd12ef8883cdf4339 100644
--- a/UI/forms/OBSBasicSettings.ui
+++ b/UI/forms/OBSBasicSettings.ui
@@ -146,7 +146,7 @@
0
0
801
- 1044
+ 741
@@ -733,8 +733,8 @@
0
0
- 601
- 640
+ 818
+ 697
@@ -3362,7 +3362,7 @@
- -
+
-
true
@@ -3372,14 +3372,14 @@
0
0
- 63
- 16
+ 800
+ 69
- -
+
-
color: rgb(255, 0, 4);
@@ -3392,7 +3392,7 @@
- -
+
-
@@ -3405,6 +3405,41 @@
+ -
+
+
+ Basic.Settings.Audio.MeterDecayRate
+
+
+ meterDecayRate
+
+
+
+ -
+
+
+ Basic.Settings.Audio.MeterDecayRate.Fast
+
+
+ 0
+
+
-
+
+ Basic.Settings.Audio.MeterDecayRate.Fast
+
+
+ -
+
+ Basic.Settings.Audio.MeterDecayRate.Medium
+
+
+ -
+
+ Basic.Settings.Audio.MeterDecayRate.Slow
+
+
+
+
@@ -3756,7 +3791,7 @@
0
0
- 803
+ 593
761
diff --git a/UI/volume-control.cpp b/UI/volume-control.cpp
index 02dec0a6cc42dc68ffcebf2d4a8c72b3ab5f9a87..47019cc4a883f0612df72066b6100a5e4ed61403 100644
--- a/UI/volume-control.cpp
+++ b/UI/volume-control.cpp
@@ -56,7 +56,7 @@ void VolControl::VolumeChanged()
slider->blockSignals(true);
slider->setValue((int) (obs_fader_get_deflection(obs_fader) * 100.0f));
slider->blockSignals(false);
-
+
updateText();
}
@@ -109,6 +109,11 @@ void VolControl::EmitConfigClicked()
emit ConfigClicked();
}
+void VolControl::SetMeterDecayRate(qreal q)
+{
+ volMeter->setPeakDecayRate(q);
+}
+
VolControl::VolControl(OBSSource source_, bool showConfig)
: source (source_),
levelTotal (0.0f),
@@ -430,7 +435,7 @@ VolumeMeter::VolumeMeter(QWidget *parent, obs_volmeter_t *obs_volmeter)
errorLevel = -9.0; // -9 dB
clipLevel = -0.5; // -0.5 dB
minimumInputLevel = -50.0; // -50 dB
- peakDecayRate = 11.7; // 20 dB / 1.7 sec
+ peakDecayRate = 11.76; // 20 dB / 1.7 sec
magnitudeIntegrationTime = 0.3; // 99% in 300 ms
peakHoldDuration = 20.0; // 20 seconds
inputPeakHoldDuration = 1.0; // 1 second
@@ -524,7 +529,9 @@ inline void VolumeMeter::calculateBallisticsForChannel(int channelNr,
// Attack of peak is immediate.
displayPeak[channelNr] = currentPeak[channelNr];
} else {
- // Decay of peak is 20 dB / 1.7 seconds.
+ // Decay of peak is 40 dB / 1.7 seconds for Fast Profile
+ // 20 dB / 1.7 seconds for Medium Profile (Type I PPM)
+ // 24 dB / 2.8 seconds for Slow Profile (Type II PPM)
qreal decay = peakDecayRate * timeSinceLastRedraw;
displayPeak[channelNr] = CLAMP(displayPeak[channelNr] - decay,
currentPeak[channelNr], 0);
diff --git a/UI/volume-control.hpp b/UI/volume-control.hpp
index aaffe4f1a1706fd1481b8ec5e3baffe4cb3ee2fc..390e684dcc032f3fb589ae763438a5c3a7adea5c 100644
--- a/UI/volume-control.hpp
+++ b/UI/volume-control.hpp
@@ -253,4 +253,6 @@ public:
QString GetName() const;
void SetName(const QString &newName);
+
+ void SetMeterDecayRate(qreal q);
};
diff --git a/UI/window-basic-main.cpp b/UI/window-basic-main.cpp
index e05fa3725abcf896a3c5811d43b84f46ce1bae60..72bf82d554a8f2043462a586ba25694d515ee666 100644
--- a/UI/window-basic-main.cpp
+++ b/UI/window-basic-main.cpp
@@ -400,6 +400,16 @@ void OBSBasic::copyActionsDynamicProperties()
}
}
+void OBSBasic::UpdateVolumeControlsDecayRate()
+{
+ double meterDecayRate = config_get_double(basicConfig, "Audio",
+ "MeterDecayRate");
+
+ for (size_t i = 0; i < volumes.size(); i++) {
+ volumes[i]->SetMeterDecayRate(meterDecayRate);
+ }
+}
+
void OBSBasic::ClearVolumeControls()
{
VolControl *control;
@@ -1235,6 +1245,8 @@ bool OBSBasic::InitBasicConfigDefaults()
config_set_default_uint (basicConfig, "Audio", "SampleRate", 44100);
config_set_default_string(basicConfig, "Audio", "ChannelSetup",
"Stereo");
+ config_set_default_double(basicConfig, "Audio", "MeterDecayRate",
+ VOLUME_METER_DECAY_FAST);
return true;
}
@@ -2549,6 +2561,9 @@ void OBSBasic::ActivateAudioSource(OBSSource source)
VolControl *vol = new VolControl(source, true);
+ double meterDecayRate = config_get_double(basicConfig, "Audio",
+ "MeterDecayRate");
+ vol->SetMeterDecayRate(meterDecayRate);
vol->setContextMenuPolicy(Qt::CustomContextMenu);
connect(vol, &QWidget::customContextMenuRequested,
diff --git a/UI/window-basic-main.hpp b/UI/window-basic-main.hpp
index d0b1379d248073557bd8da5cc3bee44dc879c501..bcbcfcf07378eda96e2e9409209a16042dd1fe79 100644
--- a/UI/window-basic-main.hpp
+++ b/UI/window-basic-main.hpp
@@ -193,6 +193,7 @@ private:
void CreateFirstRunSources();
void CreateDefaultScene(bool firstStart);
+ void UpdateVolumeControlsDecayRate();
void ClearVolumeControls();
void UploadLog(const char *file);
diff --git a/UI/window-basic-settings.cpp b/UI/window-basic-settings.cpp
index 6db249f14824daefc2f2c7dbc6218951524d604f..9bf61965c76064d900dfcafec405db4aa8033276 100644
--- a/UI/window-basic-settings.cpp
+++ b/UI/window-basic-settings.cpp
@@ -400,6 +400,7 @@ OBSBasicSettings::OBSBasicSettings(QWidget *parent)
HookWidget(ui->advRBMegsMax, SCROLL_CHANGED, OUTPUTS_CHANGED);
HookWidget(ui->channelSetup, COMBO_CHANGED, AUDIO_RESTART);
HookWidget(ui->sampleRate, COMBO_CHANGED, AUDIO_RESTART);
+ HookWidget(ui->meterDecayRate, COMBO_CHANGED, AUDIO_CHANGED);
HookWidget(ui->desktopAudioDevice1, COMBO_CHANGED, AUDIO_CHANGED);
HookWidget(ui->desktopAudioDevice2, COMBO_CHANGED, AUDIO_CHANGED);
HookWidget(ui->auxAudioDevice1, COMBO_CHANGED, AUDIO_CHANGED);
@@ -2119,6 +2120,8 @@ void OBSBasicSettings::LoadAudioSettings()
"SampleRate");
const char *speakers = config_get_string(main->Config(), "Audio",
"ChannelSetup");
+ double meterDecayRate = config_get_double(main->Config(), "Audio",
+ "MeterDecayRate");
loading = true;
@@ -2147,6 +2150,13 @@ void OBSBasicSettings::LoadAudioSettings()
else
ui->channelSetup->setCurrentIndex(1);
+ if (meterDecayRate == VOLUME_METER_DECAY_MEDIUM)
+ ui->meterDecayRate->setCurrentIndex(1);
+ else if (meterDecayRate == VOLUME_METER_DECAY_SLOW)
+ ui->meterDecayRate->setCurrentIndex(2);
+ else
+ ui->meterDecayRate->setCurrentIndex(0);
+
LoadAudioDevices();
LoadAudioSources();
@@ -3079,6 +3089,28 @@ void OBSBasicSettings::SaveAudioSettings()
config_set_string(main->Config(), "Audio", "ChannelSetup",
channelSetup);
+ if (WidgetChanged(ui->meterDecayRate)) {
+ double meterDecayRate;
+ switch (ui->meterDecayRate->currentIndex()) {
+ case 0:
+ meterDecayRate = VOLUME_METER_DECAY_FAST;
+ break;
+ case 1:
+ meterDecayRate = VOLUME_METER_DECAY_MEDIUM;
+ break;
+ case 2:
+ meterDecayRate = VOLUME_METER_DECAY_SLOW;
+ break;
+ default:
+ meterDecayRate = VOLUME_METER_DECAY_FAST;
+ break;
+ }
+ config_set_double(main->Config(), "Audio", "MeterDecayRate",
+ meterDecayRate);
+
+ main->UpdateVolumeControlsDecayRate();
+ }
+
for (auto &audioSource : audioSources) {
auto source = OBSGetStrongRef(get<0>(audioSource));
if (!source)
diff --git a/UI/window-basic-settings.hpp b/UI/window-basic-settings.hpp
index 5996c295067c3bbe577b04ba31553524d52d3df6..585e5353e6e5eb705bc533e41fb34acd7417ae10 100644
--- a/UI/window-basic-settings.hpp
+++ b/UI/window-basic-settings.hpp
@@ -37,6 +37,10 @@ class OBSHotkeyWidget;
#include "ui_OBSBasicSettings.h"
+#define VOLUME_METER_DECAY_FAST 23.53
+#define VOLUME_METER_DECAY_MEDIUM 11.76
+#define VOLUME_METER_DECAY_SLOW 8.57
+
class SilentUpdateCheckBox : public QCheckBox {
Q_OBJECT