* controls.m: MacOS X interface plugin
*****************************************************************************
* Copyright (C) 2002 VideoLAN
- * $Id: controls.m,v 1.6 2003/01/05 16:23:57 massiot Exp $
+ * $Id: controls.m,v 1.7 2003/01/15 11:27:29 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 );
+ audio_volume_t i_volume;
if ( p_aout != NULL )
{
- aout_VolumeMute( p_aout, NULL );
+ aout_VolumeMute( p_aout, &i_volume );
vlc_object_release( (vlc_object_t *)p_aout );
}
NSMenuItem * o_mi = (NSMenuItem *)sender;
- p_intf->p_sys->b_mute = !p_intf->p_sys->b_mute;
+ p_intf->p_sys->b_mute = (i_volume == 0);
[o_mi setState: p_intf->p_sys->b_mute ? NSOnState : NSOffState];
}
* intf.c : audio output API towards the interface modules
*****************************************************************************
* Copyright (C) 2002 VideoLAN
- * $Id: intf.c,v 1.11 2002/12/10 18:22:01 gbazin Exp $
+ * $Id: intf.c,v 1.12 2003/01/15 11:27:29 massiot Exp $
*
* Authors: Christophe Massiot <massiot@via.ecp.fr>
*
if ( p_aout->mixer.b_error )
{
+ int i;
/* The output module is destroyed. */
vlc_mutex_unlock( &p_aout->mixer_lock );
- msg_Err( p_aout, "VolumeUp called without output module" );
- return -1;
+ i = config_GetInt( p_aout, "volume" );
+ i += AOUT_VOLUME_STEP * i_nb_steps;
+ if ( i > AOUT_VOLUME_MAX )
+ {
+ i = AOUT_VOLUME_MAX;
+ }
+ config_PutInt( p_aout, "volume", i );
+ if ( pi_volume != NULL ) *pi_volume = (audio_volume_t)i;
+ return 0;
}
if ( p_aout->output.pf_volume_get( p_aout, &i_volume ) )
}
i_volume += AOUT_VOLUME_STEP * i_nb_steps;
- if ( i_volume > 1024 ) i_volume = 1024;
+ if ( i_volume > AOUT_VOLUME_MAX ) i_volume = AOUT_VOLUME_MAX;
i_result = p_aout->output.pf_volume_set( p_aout, i_volume );
if ( p_aout->mixer.b_error )
{
+ int i;
/* The output module is destroyed. */
vlc_mutex_unlock( &p_aout->mixer_lock );
- msg_Err( p_aout, "VolumeUp called without output module" );
- return -1;
+ i = config_GetInt( p_aout, "volume" );
+ i -= AOUT_VOLUME_STEP * i_nb_steps;
+ if ( i < 0 )
+ {
+ i = AOUT_VOLUME_MAX;
+ }
+ config_PutInt( p_aout, "volume", i );
+ if ( pi_volume != NULL ) *pi_volume = (audio_volume_t)i;
+ return 0;
}
if ( p_aout->output.pf_volume_get( p_aout, &i_volume ) )
if ( p_aout->mixer.b_error )
{
+ int i;
/* The output module is destroyed. */
vlc_mutex_unlock( &p_aout->mixer_lock );
- msg_Err( p_aout, "VolumeUp called without output module" );
- return -1;
+ config_PutInt( p_aout, "volume", 0 );
+ if ( pi_volume != NULL ) *pi_volume = 0;
+ return 0;
}
if ( p_aout->output.pf_volume_get( p_aout, &i_volume ) )