[vlc-commits] coreaudio_lag_fix.patch

Jon Stacey git at videolan.org
Tue Mar 6 19:52:56 CET 2012


vlc/vlc-2.0 | branch: master | Jon Stacey <jon at jonsview.com> | Mon Mar  5 00:54:35 2012 -0600| [b55752f36696ef03dcda026c42274749cc305807] | committer: Felix Paul Kühne

coreaudio_lag_fix.patch

Signed-off-by: Felix Paul Kühne <fkuehne at videolan.org>
(cherry picked from commit 93a0d5ab5b51d369c20f933f379ad4934daeb7bf)

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

 modules/audio_output/auhal.c |   28 +++++++++++++++++++++++++++-
 1 files changed, 27 insertions(+), 1 deletions(-)

diff --git a/modules/audio_output/auhal.c b/modules/audio_output/auhal.c
index 0e2c4b2..f7b4eb6 100644
--- a/modules/audio_output/auhal.c
+++ b/modules/audio_output/auhal.c
@@ -119,6 +119,8 @@ static OSStatus StreamListener          ( AudioObjectID, UInt32, const AudioObje
 static int      AudioDeviceCallback     ( vlc_object_t *, const char *,
                                           vlc_value_t, vlc_value_t, void * );
 
+static int      VolumeSet               ( audio_output_t *, float, bool );
+
 
 /*****************************************************************************
  * Module descriptor
@@ -557,7 +559,7 @@ static int OpenAnalog( audio_output_t *p_aout )
     /* Do the last VLC aout setups */
     aout_FormatPrepare( &p_aout->format );
     aout_PacketInit( p_aout, &p_sys->packet, FRAMESIZE );
-    aout_VolumeSoftInit( p_aout );
+    aout_VolumeHardInit (p_aout, VolumeSet);
 
     /* set the IOproc callback */
     input.inputProc = (AURenderCallback) RenderCallbackAnalog;
@@ -1448,3 +1450,27 @@ static int AudioDeviceCallback( vlc_object_t *p_this, const char *psz_variable,
     return aout_ChannelsRestart( p_this, psz_variable, old_val, new_val, param );
 }
 
+
+/*****************************************************************************
+ * VolumeSet: Implements pf_volume_set(). Update the CoreAudio AU volume immediately.
+ *****************************************************************************/
+static int VolumeSet( audio_output_t * p_aout, float volume, bool mute )
+{
+    struct   aout_sys_t *p_sys = p_aout->sys;
+    OSStatus ostatus;
+
+    if( mute )
+        volume = 0.0;
+    else
+        volume = volume * volume * volume; // cubic mapping from output.c
+
+    /* Set volume for output unit */
+    ostatus = AudioUnitSetParameter( p_sys->au_unit,
+                                     kHALOutputParam_Volume,
+                                     kAudioUnitScope_Global,
+                                     0,
+                                     volume,
+                                     0 );
+
+    return ostatus;
+}



More information about the vlc-commits mailing list