]> git.sesse.net Git - vlc/blobdiff - modules/gui/macosx/controls.m
* aout_Volume* functions now do their own vlc_object_find() on the
[vlc] / modules / gui / macosx / controls.m
index 1ecc85bb169fbffa42280f108be8b6c82ae383e3..6e91dc426e3e9431b57323ac176ad7f5a6fdad00 100644 (file)
@@ -2,7 +2,7 @@
  * controls.m: MacOS X interface plugin
  *****************************************************************************
  * Copyright (C) 2002 VideoLAN
- * $Id: controls.m,v 1.23 2003/02/08 19:10:21 massiot Exp $
+ * $Id: controls.m,v 1.24 2003/02/09 01:13:43 massiot Exp $
  *
  * Authors: Jon Lech Johansen <jon-vl@nanocrew.net>
  *          Christophe Massiot <massiot@via.ecp.fr>
 {
     intf_thread_t * p_intf = [NSApp getIntf];
 
-    aout_instance_t * p_aout = vlc_object_find( p_intf, VLC_OBJECT_AOUT,
-                                                        FIND_ANYWHERE );
-    if( p_aout != NULL )
-    {
-        if( p_intf->p_sys->b_mute )
-        {
-            [self mute: nil];
-        }
+    aout_VolumeUp( p_intf, 1, NULL );
 
-        aout_VolumeUp( p_aout, 1, NULL );
-        vlc_object_release( (vlc_object_t *)p_aout );
+    if( p_intf->p_sys->b_mute )
+    {
+        [self mute: nil];
     }
 
     [self updateVolumeSlider];
 {
     intf_thread_t * p_intf = [NSApp getIntf];
 
-    aout_instance_t * p_aout = vlc_object_find( p_intf, VLC_OBJECT_AOUT,
-                                                        FIND_ANYWHERE );
-    if( p_aout != NULL )
-    {
-        if( p_intf->p_sys->b_mute )
-        {
-            [self mute: nil];
-        }
+    aout_VolumeDown( p_intf, 1, NULL );
 
-        aout_VolumeDown( p_aout, 1, NULL );
-        vlc_object_release( (vlc_object_t *)p_aout );
+    if( p_intf->p_sys->b_mute )
+    {
+        [self mute: nil];
     }
 
     [self updateVolumeSlider];
 - (IBAction)mute:(id)sender
 {
     intf_thread_t * p_intf = [NSApp getIntf];
+    audio_volume_t i_volume;
 
-    aout_instance_t * p_aout = vlc_object_find( p_intf, VLC_OBJECT_AOUT,
-                                                        FIND_ANYWHERE );
-
-    if ( p_aout != NULL )
-    {
-        audio_volume_t i_volume;
-
-        aout_VolumeMute( p_aout, &i_volume );
-        vlc_object_release( (vlc_object_t *)p_aout );
-
-        p_intf->p_sys->b_mute = ( i_volume == 0 );
-    }
+    aout_VolumeMute( p_intf, &i_volume );
+    p_intf->p_sys->b_mute = ( i_volume == 0 );
 
     [self updateVolumeSlider];
 }
 - (IBAction)volumeSliderUpdated:(id)sender
 {
     intf_thread_t * p_intf = [NSApp getIntf];
+    audio_volume_t i_volume = (audio_volume_t)[sender intValue];
 
-    aout_instance_t * p_aout = vlc_object_find( p_intf, VLC_OBJECT_AOUT,
-                                                        FIND_ANYWHERE );
-    if( p_aout != NULL )
-    {
-        audio_volume_t i_volume;
-
-        i_volume = (audio_volume_t)[sender intValue];
-
-        aout_VolumeSet( p_aout, i_volume * AOUT_VOLUME_STEP );
-        vlc_object_release( (vlc_object_t *)p_aout );
-    }
+    aout_VolumeSet( p_intf, i_volume * AOUT_VOLUME_STEP );
 }
 
 - (void)updateVolumeSlider
 {
     intf_thread_t * p_intf = [NSApp getIntf];
+    audio_volume_t i_volume;
 
-    aout_instance_t * p_aout = vlc_object_find( p_intf, VLC_OBJECT_AOUT,
-                                                        FIND_ANYWHERE );
-
-    if ( p_aout != NULL )
-    {
-        audio_volume_t i_volume;
-
-        aout_VolumeGet( p_aout, &i_volume );
-        vlc_object_release( (vlc_object_t *)p_aout );
+    aout_VolumeGet( p_intf, &i_volume );
 
-        [o_volumeslider setFloatValue: (float)(i_volume / AOUT_VOLUME_STEP)]; 
-    }
+    [o_volumeslider setFloatValue: (float)(i_volume / AOUT_VOLUME_STEP)]; 
 }
 
 - (IBAction)halfWindow:(id)sender
 
         [o_mi setState: i_state];
     }
-    else if( [[o_mi title] isEqualToString: _NS("Volume Up")] ||
-             [[o_mi title] isEqualToString: _NS("Volume Down")] ) 
-    {
-        aout_instance_t * p_aout;
-
-        p_aout = vlc_object_find( p_intf, VLC_OBJECT_AOUT,
-                                          FIND_ANYWHERE );
-        if( p_aout != NULL )
-        {
-            vlc_object_release( (vlc_object_t *)p_aout );
-        }
-        else
-        {
-            bEnabled = FALSE;
-        }
-    }
     else if( [[o_mi title] isEqualToString: _NS("Mute")] ) 
     {
-        aout_instance_t * p_aout;
-
-        p_aout = vlc_object_find( p_intf, VLC_OBJECT_AOUT,
-                                          FIND_ANYWHERE );
-        if( p_aout != NULL )
-        {
-            vlc_object_release( (vlc_object_t *)p_aout );
-        }
-        else
-        {
-            bEnabled = FALSE;
-        }
-
         [o_mi setState: p_intf->p_sys->b_mute ? NSOnState : NSOffState];
     }
     else if( [[o_mi title] isEqualToString: _NS("Fullscreen")] ||