[vlc-devel] [PATCH 2/3] mmdevice: only the gain need to be tapered linearly
Thomas Guillem
thomas at gllm.fr
Mon Oct 3 17:43:52 CEST 2016
This fixes a mismatch between Windows and VLC volume meter
---
modules/audio_output/mmdevice.c | 9 ++++-----
1 file changed, 4 insertions(+), 5 deletions(-)
diff --git a/modules/audio_output/mmdevice.c b/modules/audio_output/mmdevice.c
index e544f66..77d8df2 100644
--- a/modules/audio_output/mmdevice.c
+++ b/modules/audio_output/mmdevice.c
@@ -179,15 +179,14 @@ static int VolumeSet(audio_output_t *aout, float vol)
aout_sys_t *sys = aout->sys;
float gain = 1.f;
- vol = vol * vol * vol; /* ISimpleAudioVolume is tapered linearly. */
-
if (vol > 1.f)
{
gain = vol;
vol = 1.f;
+ aout_GainRequest(aout, gain * gain * gain);
}
-
- aout_GainRequest(aout, gain);
+ else
+ aout_GainRequest(aout, 1.f);
EnterCriticalSection(&sys->lock);
sys->gain = gain;
@@ -961,7 +960,7 @@ static HRESULT MMSession(audio_output_t *aout, IMMDeviceEnumerator *it)
msg_Err(aout, "cannot get master volume (error 0x%lx)", hr);
}
if (level >= 0.f)
- aout_VolumeReport(aout, cbrtf(level * sys->gain));
+ aout_VolumeReport(aout, level * sys->gain);
signed char mute = sys->mute;
if (mute >= 0)
--
2.9.3
More information about the vlc-devel
mailing list