UI: Add audio meter decay rate option

The decay rate of the audio meters can now be selected in the audio
settings.  The values are:

- "Fast"   (OBS default, 40 dB / 1.7s)
- "Medium" (Type I PPM,  20 dB / 1.7s)
- "Slow"   (Type II PPM, 24 dB / 2.8s)

Closes jp9000/obs-studio#1143
This commit is contained in:
Shaolin
2018-01-09 18:45:20 -02:00
committed by jp9000
parent bba37a7069
commit 53d936c5dc
11 changed files with 112 additions and 15 deletions

View File

@@ -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,