[vlc-devel] commit: skins2: correct volume slider stuck to mute once requested by user. (Erwan Tulou )
git version control
git at videolan.org
Mon Aug 24 18:07:57 CEST 2009
vlc | branch: master | Erwan Tulou <erwan10 at videolan.org> | Mon Aug 24 11:58:47 2009 +0200| [3567c033215cc9a5bbd51590789ba59f90eeba01] | committer: Erwan Tulou
skins2: correct volume slider stuck to mute once requested by user.
This problem appeared in vlc1.1.
setting volume from core or from the user slider must be differentiated, as sending back a zero value (mute) tells the core to really set value to zero (thus erasing the saved volume)
this patch reuses what is already done for position slider (similar issue)
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=3567c033215cc9a5bbd51590789ba59f90eeba01
---
modules/gui/skins2/src/vlcproc.cpp | 2 +-
modules/gui/skins2/vars/volume.cpp | 7 ++++---
modules/gui/skins2/vars/volume.hpp | 4 +++-
3 files changed, 8 insertions(+), 5 deletions(-)
diff --git a/modules/gui/skins2/src/vlcproc.cpp b/modules/gui/skins2/src/vlcproc.cpp
index f02d6a4..a475795 100644
--- a/modules/gui/skins2/src/vlcproc.cpp
+++ b/modules/gui/skins2/src/vlcproc.cpp
@@ -256,7 +256,7 @@ void VlcProc::refreshAudio()
audio_volume_t volume;
aout_VolumeGet( getIntf()->p_sys->p_playlist, &volume );
Volume *pVolume = (Volume*)m_cVarVolume.get();
- pVolume->set( (double)volume * 2.0 / AOUT_VOLUME_MAX );
+ pVolume->set( (double)volume * 2.0 / AOUT_VOLUME_MAX , false );
// Set the mute variable
VarBoolImpl *pVarMute = (VarBoolImpl*)m_cVarMute.get();
diff --git a/modules/gui/skins2/vars/volume.cpp b/modules/gui/skins2/vars/volume.cpp
index a3d573f..a965dbd 100644
--- a/modules/gui/skins2/vars/volume.cpp
+++ b/modules/gui/skins2/vars/volume.cpp
@@ -41,7 +41,7 @@ Volume::Volume( intf_thread_t *pIntf ): VarPercent( pIntf )
}
-void Volume::set( float percentage )
+void Volume::set( float percentage, bool updateVLC )
{
// Avoid looping forever...
if( (int)(get() * AOUT_VOLUME_MAX) !=
@@ -49,8 +49,9 @@ void Volume::set( float percentage )
{
VarPercent::set( percentage );
- aout_VolumeSet( getIntf()->p_sys->p_playlist,
- (int)(get() * AOUT_VOLUME_MAX / 2.0) );
+ if( updateVLC )
+ aout_VolumeSet( getIntf()->p_sys->p_playlist,
+ (int)(get() * AOUT_VOLUME_MAX / 2.0) );
}
}
diff --git a/modules/gui/skins2/vars/volume.hpp b/modules/gui/skins2/vars/volume.hpp
index 1786191..1e36775 100644
--- a/modules/gui/skins2/vars/volume.hpp
+++ b/modules/gui/skins2/vars/volume.hpp
@@ -37,7 +37,9 @@ class Volume: public VarPercent
Volume( intf_thread_t *pIntf );
virtual ~Volume() {}
- virtual void set( float percentage );
+ virtual void set( float percentage, bool updateVLC );
+
+ virtual void set( float percentage ) { set( percentage, true ); }
virtual string getAsStringPercent() const;
};
More information about the vlc-devel
mailing list