[vlc-commits] auhal: fix handling and reporting of volume and mute
David Fuhrmann
git at videolan.org
Thu Apr 25 20:36:25 CEST 2013
vlc | branch: master | David Fuhrmann <david.fuhrmann at googlemail.com> | Thu Apr 25 20:32:25 2013 +0200| [673a01e1dd2333bfda50bc809584b5768aafe96a] | committer: David Fuhrmann
auhal: fix handling and reporting of volume and mute
Especially in the case that volume-save was set to false...
This adapts to behaviour of the other aout modules.
fixes #8501
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=673a01e1dd2333bfda50bc809584b5768aafe96a
---
modules/audio_output/auhal.c | 24 ++++++++++++------------
1 file changed, 12 insertions(+), 12 deletions(-)
diff --git a/modules/audio_output/auhal.c b/modules/audio_output/auhal.c
index 2b63590..d4964ed 100644
--- a/modules/audio_output/auhal.c
+++ b/modules/audio_output/auhal.c
@@ -112,6 +112,9 @@ struct aout_sys_t
CFArrayRef device_list;
+ float f_volume;
+ bool b_mute;
+
vlc_mutex_t lock;
vlc_cond_t cond;
};
@@ -198,8 +201,10 @@ static int Open(vlc_object_t *obj)
RebuildDeviceList(p_aout);
/* remember the volume */
- aout_VolumeReport(p_aout, var_InheritInteger(p_aout, "auhal-volume") / (float)AOUT_VOLUME_DEFAULT);
- MuteSet(p_aout, var_InheritBool(p_aout, "mute"));
+ p_sys->f_volume = var_InheritInteger(p_aout, "auhal-volume") / (float)AOUT_VOLUME_DEFAULT;
+ aout_VolumeReport(p_aout, p_sys->f_volume);
+ p_sys->b_mute = var_InheritBool(p_aout, "mute");
+ aout_MuteReport(p_aout, p_sys->b_mute);
SwitchAudioDevice(p_aout, config_GetPsz(p_aout, "auhal-audio-device"));
@@ -690,14 +695,8 @@ static int StartAnalog(audio_output_t *p_aout, audio_sample_format_t *fmt)
p_sys->b_got_first_sample = false;
/* Set volume for output unit */
- float volume = var_InheritInteger(p_aout, "auhal-volume") / (float)AOUT_VOLUME_DEFAULT;
- volume = volume * volume * volume;
- verify_noerr(AudioUnitSetParameter(p_sys->au_unit,
- kHALOutputParam_Volume,
- kAudioUnitScope_Global,
- 0,
- volume,
- 0));
+ VolumeSet(p_aout, p_sys->f_volume);
+ MuteSet(p_aout, p_sys->b_mute);
return true;
}
@@ -1139,6 +1138,7 @@ static int VolumeSet(audio_output_t * p_aout, float volume)
if(p_sys->b_digital)
return VLC_EGENERIC;
+ p_sys->f_volume = volume;
aout_VolumeReport(p_aout, volume);
/* Set volume for output unit */
@@ -1163,12 +1163,12 @@ static int MuteSet(audio_output_t * p_aout, bool mute)
if(p_sys->b_digital)
return VLC_EGENERIC;
+ p_sys->b_mute = mute;
aout_MuteReport(p_aout, mute);
float volume = .0;
-
if (!mute)
- volume = var_InheritInteger(p_aout, "auhal-volume") / (float)AOUT_VOLUME_DEFAULT;
+ volume = p_sys->f_volume;
ostatus = AudioUnitSetParameter(p_sys->au_unit,
kHALOutputParam_Volume,
More information about the vlc-commits
mailing list