From d4e655fa243a5bad21b78a88c294c9e95004d7fd Mon Sep 17 00:00:00 2001 From: Sandeep Kumar Date: Mon, 29 Apr 2013 17:26:21 +0530 Subject: [PATCH] aout: Increase/decrease volume in steps of 5% MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Rémi Denis-Courmont --- modules/gui/qt4/components/controller_widget.cpp | 2 +- modules/gui/qt4/util/input_slider.cpp | 2 +- modules/gui/qt4/util/input_slider.hpp | 2 +- modules/gui/skins2/vars/volume.cpp | 2 +- src/libvlc-module.c | 4 ++-- src/playlist/aout.c | 4 ++-- 6 files changed, 8 insertions(+), 8 deletions(-) diff --git a/modules/gui/qt4/components/controller_widget.cpp b/modules/gui/qt4/components/controller_widget.cpp index 126401aead..1b3f4782dc 100644 --- a/modules/gui/qt4/components/controller_widget.cpp +++ b/modules/gui/qt4/components/controller_widget.cpp @@ -88,7 +88,7 @@ SoundWidget::SoundWidget( QWidget *_parent, intf_thread_t * _p_intf, if( b_shiny ) { volumeSlider = new SoundSlider( this, - config_GetInt( p_intf, "volume-step" ), + config_GetFloat( p_intf, "volume-step" ), var_InheritString( p_intf, "qt-slider-colours" ), var_InheritInteger( p_intf, "qt-max-volume") ); } diff --git a/modules/gui/qt4/util/input_slider.cpp b/modules/gui/qt4/util/input_slider.cpp index 8e212285fb..9ea5efe1f5 100644 --- a/modules/gui/qt4/util/input_slider.cpp +++ b/modules/gui/qt4/util/input_slider.cpp @@ -441,7 +441,7 @@ bool SeekSlider::isAnimationRunning() const #define WHEIGHT 22 // px #define SOUNDMIN 0 // % -SoundSlider::SoundSlider( QWidget *_parent, int _i_step, +SoundSlider::SoundSlider( QWidget *_parent, float _i_step, char *psz_colors, int max ) : QAbstractSlider( _parent ) { diff --git a/modules/gui/qt4/util/input_slider.hpp b/modules/gui/qt4/util/input_slider.hpp index 716777a21c..91986dd0c2 100644 --- a/modules/gui/qt4/util/input_slider.hpp +++ b/modules/gui/qt4/util/input_slider.hpp @@ -130,7 +130,7 @@ class SoundSlider : public QAbstractSlider { Q_OBJECT public: - SoundSlider(QWidget *_parent, int _i_step, char *psz_colors, int max = SOUNDMAX ); + SoundSlider(QWidget *_parent, float _i_step, char *psz_colors, int max = SOUNDMAX ); void setMuted( bool ); /* Set Mute status */ protected: diff --git a/modules/gui/skins2/vars/volume.cpp b/modules/gui/skins2/vars/volume.cpp index ed734c4d3d..27887fba23 100644 --- a/modules/gui/skins2/vars/volume.cpp +++ b/modules/gui/skins2/vars/volume.cpp @@ -35,7 +35,7 @@ Volume::Volume( intf_thread_t *pIntf ): VarPercent( pIntf ) { // compute preferred step in [0.,1.] range - m_step = (float)config_GetInt( pIntf, "volume-step" ) + m_step = config_GetFloat( pIntf, "volume-step" ) / (float)AOUT_VOLUME_MAX; // set current volume from the playlist diff --git a/src/libvlc-module.c b/src/libvlc-module.c index 7a8f70d94b..50da9e80e5 100644 --- a/src/libvlc-module.c +++ b/src/libvlc-module.c @@ -142,7 +142,7 @@ static const char *const ppsz_snap_formats[] = #define VOLUME_STEP_TEXT N_("Audio output volume step") #define VOLUME_STEP_LONGTEXT N_( \ "The step size of the volume is adjustable using this option.") -#define AOUT_VOLUME_STEP 13 +#define AOUT_VOLUME_STEP 12.8 #define VOLUME_SAVE_TEXT N_( "Remember the audio volume" ) #define VOLUME_SAVE_LONGTEXT N_( \ @@ -1460,7 +1460,7 @@ vlc_module_begin () add_float( "gain", 1., GAIN_TEXT, GAIN_LONGTEXT, true ) change_float_range( 0., 8. ) add_obsolete_integer( "volume" ) /* since 2.1.0 */ - add_integer( "volume-step", AOUT_VOLUME_STEP, VOLUME_STEP_TEXT, + add_float( "volume-step", AOUT_VOLUME_STEP, VOLUME_STEP_TEXT, VOLUME_STEP_LONGTEXT, true ) change_integer_range( 1, AOUT_VOLUME_DEFAULT ) add_bool( "volume-save", true, VOLUME_SAVE_TEXT, VOLUME_SAVE_TEXT, true ) diff --git a/src/playlist/aout.c b/src/playlist/aout.c index 5a45515b7d..05ed231ad1 100644 --- a/src/playlist/aout.c +++ b/src/playlist/aout.c @@ -76,7 +76,7 @@ int playlist_VolumeUp (playlist_t *pl, int value, float *volp) { int ret = -1; - value *= var_InheritInteger (pl, "volume-step"); + float delta = value * var_InheritFloat (pl, "volume-step"); audio_output_t *aout = playlist_GetAout (pl); if (aout != NULL) @@ -84,7 +84,7 @@ int playlist_VolumeUp (playlist_t *pl, int value, float *volp) float vol = aout_VolumeGet (aout); if (vol >= 0.) { - vol += value / (float)AOUT_VOLUME_DEFAULT; + vol += delta / (float)AOUT_VOLUME_DEFAULT; if (vol < 0.) vol = 0.; if (vol > 2.) -- 2.39.5