[vlc-commits] aout: Increase/decrease volume in steps of 5%
Sandeep Kumar
git at videolan.org
Mon Apr 29 16:03:23 CEST 2013
vlc | branch: master | Sandeep Kumar <sandeep.kumar.ruhil at gmail.com> | Mon Apr 29 17:44:21 2013 +0530| [1ea37087539f9d31c7749b92df445b526ae1d531] | committer: Rémi Denis-Courmont
aout: Increase/decrease volume in steps of 5%
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=1ea37087539f9d31c7749b92df445b526ae1d531
---
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 126401a..1b3f478 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 8e21228..9ea5efe 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 716777a..91986dd 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 ed734c4..27887fb 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 7a8f70d9..50da9e8 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 5a45515..05ed231 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.)
More information about the vlc-commits
mailing list