[vlc-commits] macosx: implement visual feedback for volume changes (close #5837)

Felix Paul Kühne git at videolan.org
Sun Feb 19 23:31:17 CET 2012


vlc/vlc-2.0 | branch: master | Felix Paul Kühne <fkuehne at videolan.org> | Sun Feb 19 20:40:27 2012 +0100| [deb80d2af4396b687c1d6098007719b406f29024] | committer: Jean-Baptiste Kempf

macosx: implement visual feedback for volume changes (close #5837)

the osd sliders don't display correctly - no idea why yet so far
(cherry picked from commit f70cd93da07d2f421791e83101c3796f34365fbc)

Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>

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

 modules/gui/macosx/CoreInteraction.m |   28 ++++++++++++++++++++++++++++
 1 files changed, 28 insertions(+), 0 deletions(-)

diff --git a/modules/gui/macosx/CoreInteraction.m b/modules/gui/macosx/CoreInteraction.m
index 3a7f1be..d773774 100644
--- a/modules/gui/macosx/CoreInteraction.m
+++ b/modules/gui/macosx/CoreInteraction.m
@@ -465,6 +465,19 @@ static VLCCoreInteraction *_o_sharedInstance = nil;
     }
 }
 
+- (void)displayVolume
+{
+    vout_thread_t *p_vout = getVout();
+    if (p_vout)
+    {
+        vout_OSDSlider( p_vout, SPU_DEFAULT_CHANNEL,
+                       [self volume]*100/AOUT_VOLUME_MAX, OSD_VERT_SLIDER );
+        vout_OSDMessage( p_vout, SPU_DEFAULT_CHANNEL, _( "Volume %d%%" ),
+                       [self volume]*100/AOUT_VOLUME_DEFAULT );
+        vlc_object_release( p_vout );
+    }
+}
+
 - (void)volumeUp
 {
     intf_thread_t *p_intf = VLCIntf;
@@ -472,6 +485,7 @@ static VLCCoreInteraction *_o_sharedInstance = nil;
         return;
 
     aout_VolumeUp( pl_Get( p_intf ), 1, NULL );
+    [self displayVolume];
 }
 
 - (void)volumeDown
@@ -481,6 +495,7 @@ static VLCCoreInteraction *_o_sharedInstance = nil;
         return;
 
     aout_VolumeDown( pl_Get( p_intf ), 1, NULL );
+    [self displayVolume];
 }
 
 - (void)mute
@@ -490,6 +505,19 @@ static VLCCoreInteraction *_o_sharedInstance = nil;
         return;
 
     aout_ToggleMute( pl_Get( p_intf ), NULL );
+
+    vout_thread_t *p_vout = getVout();
+    if( p_vout )
+    {
+        if( [self isMuted] )
+        {
+            vout_OSDIcon( p_vout, SPU_DEFAULT_CHANNEL, OSD_MUTE_ICON );
+        }
+        else
+            [self displayVolume];
+
+        vlc_object_release( p_vout );
+    }
 }
 
 - (BOOL)isMuted



More information about the vlc-commits mailing list