[vlc-devel] [PATCH 3/3] mmdevice: reset gain when the volume is changed from outside

Rémi Denis-Courmont remi at remlab.net
Mon Oct 3 18:42:11 CEST 2016


Le maanantaina 3. lokakuuta 2016, 17.43.53 EEST Thomas Guillem a écrit :
> ---
>  modules/audio_output/mmdevice.c | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/modules/audio_output/mmdevice.c
> b/modules/audio_output/mmdevice.c index 77d8df2..1a9170a 100644
> --- a/modules/audio_output/mmdevice.c
> +++ b/modules/audio_output/mmdevice.c
> @@ -280,6 +280,10 @@
> vlc_AudioSessionEvents_OnSimpleVolumeChanged(IAudioSessionEvents *this,
> msg_Dbg(aout, "simple volume changed: %f, muting %sabled", vol, mute ? "en"
> : "dis");
>      EnterCriticalSection(&sys->lock);
> +    /* If the user ask to lower the volume, there is no need to amplify
> +     * anymore. */
> +    if (vol < 1.0f)
> +        sys->gain = 1.0f;
>      WakeConditionVariable(&sys->work); /* implicit state: vol & mute */
>      LeaveCriticalSection(&sys->lock);
>      (void) ctx;

That´s one consistent way to do it. But it will cause a sharp (one-way) volume 
discontinuity from 100% in the mixer. It might also cause problems if the 
volume change is not directly mapped from user interaction.

Ultimately, if you don´t want problems, you have to stick to the OS volume 
range at all times. This has been argued to death.

I am not taking position for or against this patch.

-- 
Rémi Denis-Courmont
Nonsponsored VLC developer
http://www.remlab.net/CV.pdf



More information about the vlc-devel mailing list