[vlc-commits] macosx: also round volume percents

David Fuhrmann git at videolan.org
Wed Jun 6 22:24:17 CEST 2012


vlc/vlc-2.0 | branch: master | David Fuhrmann <david.fuhrmann at googlemail.com> | Tue Jun  5 19:34:06 2012 +0200| [9299dc60348d07d2b0a507d65d775e46414f99c4] | committer: David Fuhrmann

macosx: also round volume percents

This prevent cases in which the percent value is one smaller than the
previous adjusted value.
(cherry picked from commit 5e06ffd4ca78ed08f5eea90e31b67b04b8f05abb)

Conflicts:

	modules/gui/macosx/simple_prefs.m

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

 modules/gui/macosx/simple_prefs.m |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/modules/gui/macosx/simple_prefs.m b/modules/gui/macosx/simple_prefs.m
index d89bcdd..c5dfa69 100644
--- a/modules/gui/macosx/simple_prefs.m
+++ b/modules/gui/macosx/simple_prefs.m
@@ -536,7 +536,7 @@ static inline char * __config_GetLabel( vlc_object_t *p_this, const char *psz_na
         [o_audio_vol_sld setEnabled: YES];
 
         i = config_GetInt( p_intf, "volume" );
-        i = i * 200 / AOUT_VOLUME_MAX;
+        i = i * 200.0 / AOUT_VOLUME_MAX + 0.5;
         [o_audio_vol_sld setIntValue: i];
         [o_audio_vol_fld setIntValue: i];
     }
@@ -893,7 +893,7 @@ static inline void save_module_list( intf_thread_t * p_intf, id object, const ch
     {
         config_PutInt( p_intf, "audio", [o_audio_enable_ckb state] );
         if( [o_audio_vol_fld isEnabled] )
-            config_PutInt( p_intf, "volume", [o_audio_vol_fld intValue] * AOUT_VOLUME_MAX / 200 );
+            config_PutInt( p_intf, "volume", [o_audio_vol_fld intValue] * AOUT_VOLUME_MAX / 200.0 + 0.5 );
         config_PutInt( p_intf, "macosx-autosave-volume", [o_audio_autosavevol_yes_bcell state] );
         config_PutInt( p_intf, "spdif", [o_audio_spdif_ckb state] );
 



More information about the vlc-commits mailing list