libobs, UI: Add true peak measurements

Add a new algorithm to calculate the true-peak. It implements the
Whittaker- Shannon interpolation from four samples to create 4
intermediate samples (5 x oversampling) inbetween the middle two
samples.

With 4 samples and 4 intermediate samples the algorithm can be
implemented as a 4x4 vector-matrix cross product, which is ideal for
SSE.

I've also replaced the sample-peak algorithm using SSE as well to
improve performance.

Closes obsproject/obs-studio#1189
This commit is contained in:
Tjienta Vara
2018-04-30 03:53:26 -07:00
committed by jp9000
parent dcbad4af89
commit b0f94afaf2
9 changed files with 417 additions and 45 deletions
+13
View File
@@ -401,6 +401,7 @@ OBSBasicSettings::OBSBasicSettings(QWidget *parent)
HookWidget(ui->channelSetup, COMBO_CHANGED, AUDIO_RESTART);
HookWidget(ui->sampleRate, COMBO_CHANGED, AUDIO_RESTART);
HookWidget(ui->meterDecayRate, COMBO_CHANGED, AUDIO_CHANGED);
HookWidget(ui->peakMeterType, 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);
@@ -2124,6 +2125,8 @@ void OBSBasicSettings::LoadAudioSettings()
"ChannelSetup");
double meterDecayRate = config_get_double(main->Config(), "Audio",
"MeterDecayRate");
uint32_t peakMeterTypeIdx = config_get_uint(main->Config(), "Audio",
"PeakMeterType");
loading = true;
@@ -2159,6 +2162,8 @@ void OBSBasicSettings::LoadAudioSettings()
else
ui->meterDecayRate->setCurrentIndex(0);
ui->peakMeterType->setCurrentIndex(peakMeterTypeIdx);
LoadAudioDevices();
LoadAudioSources();
@@ -3113,6 +3118,14 @@ void OBSBasicSettings::SaveAudioSettings()
main->UpdateVolumeControlsDecayRate();
}
if (WidgetChanged(ui->peakMeterType)) {
uint32_t peakMeterTypeIdx = ui->peakMeterType->currentIndex();
config_set_uint(main->Config(), "Audio", "PeakMeterType",
peakMeterTypeIdx);
main->UpdateVolumeControlsPeakMeterType();
}
for (auto &audioSource : audioSources) {
auto source = OBSGetStrongRef(get<0>(audioSource));
if (!source)