Commit 3567c033 authored by Erwan Tulou's avatar 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)
parent 9d1f2cfb
...@@ -256,7 +256,7 @@ void VlcProc::refreshAudio() ...@@ -256,7 +256,7 @@ void VlcProc::refreshAudio()
audio_volume_t volume; audio_volume_t volume;
aout_VolumeGet( getIntf()->p_sys->p_playlist, &volume ); aout_VolumeGet( getIntf()->p_sys->p_playlist, &volume );
Volume *pVolume = (Volume*)m_cVarVolume.get(); 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 // Set the mute variable
VarBoolImpl *pVarMute = (VarBoolImpl*)m_cVarMute.get(); VarBoolImpl *pVarMute = (VarBoolImpl*)m_cVarMute.get();
......
...@@ -41,7 +41,7 @@ Volume::Volume( intf_thread_t *pIntf ): VarPercent( pIntf ) ...@@ -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... // Avoid looping forever...
if( (int)(get() * AOUT_VOLUME_MAX) != if( (int)(get() * AOUT_VOLUME_MAX) !=
...@@ -49,6 +49,7 @@ void Volume::set( float percentage ) ...@@ -49,6 +49,7 @@ void Volume::set( float percentage )
{ {
VarPercent::set( percentage ); VarPercent::set( percentage );
if( updateVLC )
aout_VolumeSet( getIntf()->p_sys->p_playlist, aout_VolumeSet( getIntf()->p_sys->p_playlist,
(int)(get() * AOUT_VOLUME_MAX / 2.0) ); (int)(get() * AOUT_VOLUME_MAX / 2.0) );
} }
......
...@@ -37,7 +37,9 @@ class Volume: public VarPercent ...@@ -37,7 +37,9 @@ class Volume: public VarPercent
Volume( intf_thread_t *pIntf ); Volume( intf_thread_t *pIntf );
virtual ~Volume() {} 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; virtual string getAsStringPercent() const;
}; };
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment