Commit 03eac524 authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

aout: map software volume as cubic root of amplification factor

Also scale maximum down to 2 times the nominal volume (i.e. +18dB) to
stay in the recommended range of +10 to +20dB.
parent 5c437c34
......@@ -27,7 +27,7 @@
*/
#define AOUT_VOLUME_DEFAULT 256
#define AOUT_VOLUME_MAX 1024
#define AOUT_VOLUME_MAX 512
VLC_API audio_volume_t aout_VolumeGet( vlc_object_t * );
#define aout_VolumeGet(a) aout_VolumeGet(VLC_OBJECT(a))
......
......@@ -283,7 +283,19 @@ void aout_VolumeNoneInit (audio_output_t *aout)
static int aout_VolumeSoftSet (audio_output_t *aout, float volume, bool mute)
{
vlc_assert_locked (&aout->lock);
aout->mixer_multiplier = mute ? 0. : volume;
/* Cubic mapping from software volume to amplification factor.
* This provides a good tradeoff between low and high volume ranges.
*
* This code is only used for the VLC software mixer. If you change this
* formula, be sure to update the aout_VolumeHardInit()-based plugins also.
*/
if (!mute)
volume = volume * volume * volume;
else
volume = 0.;
aout->mixer_multiplier = volume;
return 0;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment