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

aout: store software amplification and mute separately

parent 5d5f1713
......@@ -91,7 +91,8 @@ typedef struct
struct
{
vlc_mutex_t lock;
float multiplier; /**< Software volume amplification multiplier */
float amp; /**< Software volume amplification */
bool mute; /**< Software mute */
struct audio_mixer *mixer; /**< Software volume plugin */
} volume;
......
......@@ -62,7 +62,8 @@ audio_output_t *aout_New( vlc_object_t * p_parent )
owner->module = NULL;
owner->input = NULL;
vlc_mutex_init (&owner->volume.lock);
owner->volume.multiplier = 1.0;
owner->volume.amp = 1.f;
owner->volume.mute = false;
owner->volume.mixer = NULL;
aout->pf_play = aout_DecDeleteBuffer;
......
......@@ -310,7 +310,9 @@ int aout_DecPlay (audio_output_t *p_aout, block_t *p_buffer, int i_input_rate)
/* Mixer */
if (owner->volume.mixer != NULL)
{
float amp = owner->volume.multiplier
float amp = 0.f;
if (!owner->volume.mute)
amp = owner->volume.amp
* vlc_atomic_getf (&owner->gain.multiplier);
aout_MixerRun (owner->volume.mixer, p_buffer, amp);
}
......
......@@ -279,7 +279,8 @@ void aout_OutputDelete (audio_output_t *aout)
aout->pf_flush = NULL;
aout->pf_volume_set = NULL;
owner->module = NULL;
owner->volume.multiplier = 1.0;
owner->volume.amp = 1.f;
owner->volume.mute = false;
aout_FiltersDestroyPipeline (owner->filters, owner->nb_filters);
}
......@@ -348,12 +349,8 @@ static int aout_VolumeSoftSet (audio_output_t *aout, float volume, bool mute)
* 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.;
owner->volume.multiplier = volume;
owner->volume.amp = volume * volume * volume;
owner->volume.mute = mute;
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