[vlc-commits] AudioQueue: implement volume support just because we can

Felix Paul Kühne git at videolan.org
Sun Dec 16 11:05:06 CET 2012


vlc | branch: master | Felix Paul Kühne <fkuehne at videolan.org> | Sun Dec 16 11:04:46 2012 +0100| [8a1ace9ef676f7b311c2a9a1470d7d5f2ad80f3c] | committer: Felix Paul Kühne

AudioQueue: implement volume support just because we can

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=8a1ace9ef676f7b311c2a9a1470d7d5f2ad80f3c
---

 modules/audio_output/audioqueue.c |   23 +++++++++++++++++++++++
 1 file changed, 23 insertions(+)

diff --git a/modules/audio_output/audioqueue.c b/modules/audio_output/audioqueue.c
index 1fe71c4..b67baeb 100644
--- a/modules/audio_output/audioqueue.c
+++ b/modules/audio_output/audioqueue.c
@@ -47,6 +47,7 @@ struct aout_sys_t
 {
     AudioQueueRef audioQueue;
     bool          b_stopped;
+    float         f_volume;
 };
 
 /*****************************************************************************
@@ -211,6 +212,24 @@ static int TimeGet (audio_output_t *p_aout, mtime_t *restrict delay)
  * Module management
  *****************************************************************************/
 
+static int VolumeSet(audio_output_t * p_aout, float volume)
+{
+    struct aout_sys_t *p_sys = p_aout->sys;
+    OSStatus ostatus;
+
+    aout_VolumeReport(p_aout, volume);
+    p_sys->f_volume = volume;
+
+    /* Set volume for output unit */
+    ostatus = AudioQueueSetParameter(p_sys->audioQueue, kAudioQueueParam_Volume, volume * volume * volume);
+
+    return ostatus;
+}
+
+/*****************************************************************************
+ * Module management
+ *****************************************************************************/
+
 static int Open(vlc_object_t *obj)
 {
     audio_output_t *aout = (audio_output_t *)obj;
@@ -222,6 +241,10 @@ static int Open(vlc_object_t *obj)
     aout->sys = sys;
     aout->start = Start;
     aout->stop = Stop;
+    aout->volume_set = VolumeSet;
+
+    /* reset volume */
+    aout_VolumeReport(aout, 1.0);
 
     return VLC_SUCCESS;
 }



More information about the vlc-commits mailing list