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