Changeset 09161bc3bde473a5f72f77742f4c991565371eab
- 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
| rf940c37 |
r09161bc |
|
| 757 | 757 | } |
|---|
| 758 | 758 | vlc_mutex_unlock( &p_playlist->object_lock ); |
|---|
| 759 | | } /* End of current playlist status */ |
|---|
| | 759 | } /* End of current playlist status */ |
|---|
| 760 | 760 | } |
|---|
| 761 | 761 | } |
|---|
| … | … | |
| 861 | 861 | p_playlist = NULL; |
|---|
| 862 | 862 | } |
|---|
| 863 | | |
|---|
| | 863 | |
|---|
| 864 | 864 | var_DelCallback( p_intf->p_vlc, "volume", VolumeChanged, p_intf ); |
|---|
| 865 | 865 | } |
|---|
| … | … | |
| 972 | 972 | { |
|---|
| 973 | 973 | intf_thread_t *p_intf = (intf_thread_t*)p_data; |
|---|
| 974 | | |
|---|
| | 974 | |
|---|
| 975 | 975 | vlc_mutex_lock( &p_intf->p_sys->status_lock ); |
|---|
| 976 | 976 | msg_rc( STATUS_CHANGE "( audio volume: %d )", newval.i_int ); |
|---|
| … | … | |
| 985 | 985 | playlist_t *p_playlist = NULL; |
|---|
| 986 | 986 | input_thread_t *p_input = NULL; |
|---|
| 987 | | |
|---|
| | 987 | |
|---|
| 988 | 988 | vlc_mutex_lock( &p_intf->p_sys->status_lock ); |
|---|
| 989 | 989 | p_input = vlc_object_find( p_intf, VLC_OBJECT_INPUT, FIND_ANYWHERE ); |
|---|
| … | … | |
| 1248 | 1248 | { |
|---|
| 1249 | 1249 | vlc_value_t val; |
|---|
| 1250 | | |
|---|
| | 1250 | |
|---|
| 1251 | 1251 | var_Get( p_playlist->p_input, "rate", &val ); |
|---|
| 1252 | 1252 | if( val.i_int != INPUT_RATE_DEFAULT ) |
|---|
| … | … | |
| 1719 | 1719 | int i_nb_steps = atoi(newval.psz_string); |
|---|
| 1720 | 1720 | 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) ) |
|---|
| 1723 | 1725 | { |
|---|
| 1724 | 1726 | i_nb_steps = 1; |
|---|
| rfe087a3 |
r09161bc |
|
| 251 | 251 | intf_thread_t * p_intf = VLCIntf; |
|---|
| 252 | 252 | 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 ); |
|---|
| 254 | 256 | /* Manage volume status */ |
|---|
| 255 | 257 | [o_main manageVolumeSlider]; |
|---|
| rad730d0 |
r09161bc |
|
| 1019 | 1019 | { |
|---|
| 1020 | 1020 | NSString *o_text; |
|---|
| | 1021 | int i_volume_step = 0; |
|---|
| 1021 | 1022 | o_text = [NSString stringWithFormat: _NS("Volume: %d%%"), i_lastShownVolume * 400 / AOUT_VOLUME_MAX]; |
|---|
| 1022 | 1023 | if( i_lastShownVolume != -1 ) |
|---|
| 1023 | 1024 | [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]; |
|---|
| 1026 | 1027 | [o_volumeslider setEnabled: TRUE]; |
|---|
| 1027 | 1028 | p_intf->p_sys->b_mute = ( i_lastShownVolume == 0 ); |
|---|
| rfe087a3 |
r09161bc |
|
| 148 | 148 | aout_instance_t * p_aout = vlc_object_find( p_object, VLC_OBJECT_AOUT, |
|---|
| 149 | 149 | 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" ); |
|---|
| 152 | 153 | 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; |
|---|
| 154 | 155 | if ( i_volume > AOUT_VOLUME_MAX ) |
|---|
| 155 | 156 | { |
|---|
| … | … | |
| 185 | 186 | aout_instance_t * p_aout = vlc_object_find( p_object, VLC_OBJECT_AOUT, |
|---|
| 186 | 187 | 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" ); |
|---|
| 189 | 191 | 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; |
|---|
| 191 | 193 | if ( i_volume < AOUT_VOLUME_MIN ) |
|---|
| 192 | 194 | { |
|---|
| r98a5db4 |
r09161bc |
|
| 124 | 124 | #define VOLUME_SAVE_LONGTEXT N_( \ |
|---|
| 125 | 125 | "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." ) |
|---|
| 126 | 131 | |
|---|
| 127 | 132 | #define AOUT_RATE_TEXT N_("Audio output frequency (Hz)") |
|---|
| … | … | |
| 943 | 948 | AOUT_VOLUME_MAX, NULL, VOLUME_TEXT, |
|---|
| 944 | 949 | 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 ); |
|---|
| 945 | 953 | add_integer( "aout-rate", -1, NULL, AOUT_RATE_TEXT, |
|---|
| 946 | 954 | AOUT_RATE_LONGTEXT, VLC_TRUE ); |
|---|
| r400c890 |
r09161bc |
|
| 34 | 34 | #undef OSD_MENU_DEBUG |
|---|
| 35 | 35 | |
|---|
| 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 | | |
|---|
| 39 | 36 | /***************************************************************************** |
|---|
| 40 | 37 | * Local prototypes |
|---|
| … | … | |
| 43 | 40 | static void osd_UpdateState( osd_menu_state_t *, int, int, int, int, picture_t * ); |
|---|
| 44 | 41 | static inline osd_state_t *osd_VolumeStateChange( osd_state_t *, int ); |
|---|
| 45 | | |
|---|
| | 42 | static int osd_VolumeStep( vlc_object_t *, int, int ); |
|---|
| | 43 | |
|---|
| | 44 | /***************************************************************************** |
|---|
| | 45 | * OSD menu Funtions |
|---|
| | 46 | *****************************************************************************/ |
|---|
| 46 | 47 | osd_menu_t *__osd_MenuCreate( vlc_object_t *p_this, const char *psz_file ) |
|---|
| 47 | 48 | { |
|---|
| … | … | |
| 81 | 82 | /* Update the volume state images to match the current volume */ |
|---|
| 82 | 83 | 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 ); |
|---|
| 84 | 85 | p_osd->p_state->p_volume->p_current_state = osd_VolumeStateChange( p_osd->p_state->p_volume->p_states, i_steps ); |
|---|
| 85 | 86 | |
|---|
| … | … | |
| 527 | 528 | } |
|---|
| 528 | 529 | |
|---|
| | 530 | static 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 | |
|---|
| 529 | 538 | /** |
|---|
| 530 | 539 | * Display current audio volume bitmap |
|---|
| … | … | |
| 540 | 549 | int i_volume = 0; |
|---|
| 541 | 550 | int i_steps = 0; |
|---|
| 542 | | |
|---|
| | 551 | |
|---|
| 543 | 552 | if( ( p_osd = vlc_object_find( p_this, VLC_OBJECT_OSDMENU, FIND_ANYWHERE ) ) == NULL ) |
|---|
| 544 | 553 | { |
|---|
| … | … | |
| 546 | 555 | return; |
|---|
| 547 | 556 | } |
|---|
| 548 | | |
|---|
| | 557 | |
|---|
| 549 | 558 | var_Get( p_this->p_libvlc, "osd_mutex", &lockval ); |
|---|
| 550 | 559 | vlc_mutex_lock( lockval.p_address ); |
|---|
| … | … | |
| 557 | 566 | /* Update the volume state images to match the current volume */ |
|---|
| 558 | 567 | 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 ); |
|---|
| 560 | 570 | p_button->p_current_state = osd_VolumeStateChange( p_button->p_states, i_steps ); |
|---|
| 561 | 571 | |
|---|