Changeset 09161bc3bde473a5f72f77742f4c991565371eab

Show
Ignore:
Timestamp:
18/08/05 18:41:10 (3 years ago)
Author:
Jean-Paul Saman <jpsaman@videolan.org>
git-committer:
Jean-Paul Saman <jpsaman@videolan.org> 1124383270 +0000
git-parent:

[04f2f137a97e0063e49f301021236f7b93343771]

git-author:
Jean-Paul Saman <jpsaman@videolan.org> 1124383270 +0000
Message:

Added --volume-step to override AOUT_VOLUME_DEFAULT. This will give an OSD menu (or skins2) designer to freedom to decide how many steps he wants for turning up the volume from 0 to 1024. It is an advanced option so most users will never see it. Can someone check the MacOSX changes for this? I made them but cannot compiler and test it (I don't have a Mac).

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • modules/control/rc.c

    rf940c37 r09161bc  
    757757                    } 
    758758                    vlc_mutex_unlock( &p_playlist->object_lock ); 
    759                 } /* End of current playlist status */                 
     759                } /* End of current playlist status */ 
    760760            } 
    761761        } 
     
    861861        p_playlist = NULL; 
    862862    } 
    863      
     863 
    864864    var_DelCallback( p_intf->p_vlc, "volume", VolumeChanged, p_intf ); 
    865865} 
     
    972972{ 
    973973    intf_thread_t *p_intf = (intf_thread_t*)p_data; 
    974      
     974 
    975975    vlc_mutex_lock( &p_intf->p_sys->status_lock ); 
    976976    msg_rc( STATUS_CHANGE "( audio volume: %d )", newval.i_int ); 
     
    985985    playlist_t    *p_playlist = NULL; 
    986986    input_thread_t *p_input = NULL; 
    987          
     987 
    988988    vlc_mutex_lock( &p_intf->p_sys->status_lock ); 
    989989    p_input = vlc_object_find( p_intf, VLC_OBJECT_INPUT, FIND_ANYWHERE ); 
     
    12481248        { 
    12491249            vlc_value_t val; 
    1250              
     1250  
    12511251            var_Get( p_playlist->p_input, "rate", &val ); 
    12521252            if( val.i_int != INPUT_RATE_DEFAULT ) 
     
    17191719    int i_nb_steps = atoi(newval.psz_string); 
    17201720    int i_error = VLC_SUCCESS; 
    1721  
    1722     if ( i_nb_steps <= 0 || i_nb_steps > (AOUT_VOLUME_MAX/AOUT_VOLUME_STEP) ) 
     1721    int i_volume_step = 0; 
     1722 
     1723    i_volume_step = config_GetInt( p_intf->p_vlc, "volume-step" ); 
     1724    if ( i_nb_steps <= 0 || i_nb_steps > (AOUT_VOLUME_MAX/i_volume_step) ) 
    17231725    { 
    17241726        i_nb_steps = 1; 
  • modules/gui/macosx/controls.m

    rfe087a3 r09161bc  
    251251    intf_thread_t * p_intf = VLCIntf; 
    252252    audio_volume_t i_volume = (audio_volume_t)[sender intValue]; 
    253     aout_VolumeSet( p_intf, i_volume * AOUT_VOLUME_STEP ); 
     253    int i_volume_step = 0; 
     254    i_volume_step = config_GetInt( p_intf->p_vlc, "volume-step" ); 
     255    aout_VolumeSet( p_intf, i_volume * i_volume_step ); 
    254256    /* Manage volume status */ 
    255257    [o_main manageVolumeSlider]; 
  • modules/gui/macosx/intf.m

    rad730d0 r09161bc  
    10191019        { 
    10201020            NSString *o_text; 
     1021            int i_volume_step = 0; 
    10211022            o_text = [NSString stringWithFormat: _NS("Volume: %d%%"), i_lastShownVolume * 400 / AOUT_VOLUME_MAX]; 
    10221023            if( i_lastShownVolume != -1 ) 
    10231024            [self setScrollField:o_text stopAfter:1000000]; 
    1024  
    1025             [o_volumeslider setFloatValue: (float)i_lastShownVolume / AOUT_VOLUME_STEP]; 
     1025            i_volume_step = config_GetInt( p_intf->p_vlc, "volume-step" ); 
     1026            [o_volumeslider setFloatValue: (float)i_lastShownVolume / i_volume_step]; 
    10261027            [o_volumeslider setEnabled: TRUE]; 
    10271028            p_intf->p_sys->b_mute = ( i_lastShownVolume == 0 ); 
  • src/audio_output/intf.c

    rfe087a3 r09161bc  
    148148    aout_instance_t * p_aout = vlc_object_find( p_object, VLC_OBJECT_AOUT, 
    149149                                                FIND_ANYWHERE ); 
    150     int i_result = 0, i_volume = 0; 
    151  
     150    int i_result = 0, i_volume = 0, i_volume_step = 0; 
     151 
     152    i_volume_step = config_GetInt( p_object->p_vlc, "volume-step" ); 
    152153    i_volume = config_GetInt( p_object, "volume" ); 
    153     i_volume += AOUT_VOLUME_STEP * i_nb_steps; 
     154    i_volume += i_volume_step * i_nb_steps; 
    154155    if ( i_volume > AOUT_VOLUME_MAX ) 
    155156    { 
     
    185186    aout_instance_t * p_aout = vlc_object_find( p_object, VLC_OBJECT_AOUT, 
    186187                                                FIND_ANYWHERE ); 
    187     int i_result = 0, i_volume = 0; 
    188  
     188    int i_result = 0, i_volume = 0, i_volume_step = 0; 
     189 
     190    i_volume_step = config_GetInt( p_object->p_vlc, "volume-step" ); 
    189191    i_volume = config_GetInt( p_object, "volume" ); 
    190     i_volume -= AOUT_VOLUME_STEP * i_nb_steps; 
     192    i_volume -= i_volume_step * i_nb_steps; 
    191193    if ( i_volume < AOUT_VOLUME_MIN ) 
    192194    { 
  • src/libvlc.h

    r98a5db4 r09161bc  
    124124#define VOLUME_SAVE_LONGTEXT N_( \ 
    125125    "This saves the audio output volume when you select mute.") 
     126 
     127#define VOLUME_STEP_TEXT N_("Audio output volume step") 
     128#define VOLUME_STEP_LONGTEXT N_( \ 
     129    "The step size of the volume is adjustable using this option, " \ 
     130    "in a range from 0 to 1024." ) 
    126131 
    127132#define AOUT_RATE_TEXT N_("Audio output frequency (Hz)") 
     
    943948                            AOUT_VOLUME_MAX, NULL, VOLUME_TEXT, 
    944949                            VOLUME_LONGTEXT, VLC_FALSE ); 
     950    add_integer_with_range( "volume-step", AOUT_VOLUME_STEP, AOUT_VOLUME_MIN, 
     951                            AOUT_VOLUME_MAX, NULL, VOLUME_STEP_TEXT, 
     952                            VOLUME_STEP_LONGTEXT, VLC_TRUE ); 
    945953    add_integer( "aout-rate", -1, NULL, AOUT_RATE_TEXT, 
    946954                 AOUT_RATE_LONGTEXT, VLC_TRUE ); 
  • src/osd/osd.c

    r400c890 r09161bc  
    3434#undef OSD_MENU_DEBUG 
    3535 
    36 /* 3 is a magic number for 32 volume decrease steps */ 
    37 #define OSD_VOLUME_STEPS(i_volume,i_n) (i_volume/AOUT_VOLUME_STEP) / (AOUT_VOLUME_STEP/(i_n-1)) 
    38  
    3936/***************************************************************************** 
    4037 * Local prototypes 
     
    4340static void osd_UpdateState( osd_menu_state_t *, int, int, int, int, picture_t * ); 
    4441static inline osd_state_t *osd_VolumeStateChange( osd_state_t *, int ); 
    45  
     42static int osd_VolumeStep( vlc_object_t *, int, int ); 
     43 
     44/***************************************************************************** 
     45 * OSD menu Funtions 
     46 *****************************************************************************/ 
    4647osd_menu_t *__osd_MenuCreate( vlc_object_t *p_this, const char *psz_file ) 
    4748{ 
     
    8182        /* Update the volume state images to match the current volume */ 
    8283        i_volume = config_GetInt( p_this, "volume" ); 
    83         i_steps = OSD_VOLUME_STEPS( i_volume, p_osd->p_state->p_volume->i_ranges ); 
     84        i_steps = osd_VolumeStep( p_this, i_volume, p_osd->p_state->p_volume->i_ranges ); 
    8485        p_osd->p_state->p_volume->p_current_state = osd_VolumeStateChange( p_osd->p_state->p_volume->p_states, i_steps ); 
    8586 
     
    527528} 
    528529 
     530static int osd_VolumeStep( vlc_object_t *p_this, int i_volume, int i_steps ) 
     531{ 
     532    int i_volume_step = 0; 
     533 
     534    i_volume_step = config_GetInt( p_this->p_vlc, "volume-step" ); 
     535    return (i_volume/i_volume_step); 
     536} 
     537 
    529538/** 
    530539 * Display current audio volume bitmap 
     
    540549    int i_volume = 0; 
    541550    int i_steps = 0; 
    542      
     551 
    543552    if( ( p_osd = vlc_object_find( p_this, VLC_OBJECT_OSDMENU, FIND_ANYWHERE ) ) == NULL ) 
    544553    { 
     
    546555        return; 
    547556    } 
    548      
     557 
    549558    var_Get( p_this->p_libvlc, "osd_mutex", &lockval ); 
    550559    vlc_mutex_lock( lockval.p_address ); 
     
    557566        /* Update the volume state images to match the current volume */ 
    558567        i_volume = config_GetInt( p_this, "volume" ); 
    559         i_steps = OSD_VOLUME_STEPS( i_volume, p_button->i_ranges ); 
     568        i_steps = osd_VolumeStep( p_this, i_volume, p_button->i_ranges ); 
     569        msg_Err( p_this, "OSD steps=%d", i_steps ); 
    560570        p_button->p_current_state = osd_VolumeStateChange( p_button->p_states, i_steps ); 
    561571