#define SET_STREAMTIME(m,v,b) ((StreamTime*)(m).get())->set(v,b)
#define SET_TEXT(m,v) ((VarText*)(m).get())->set(v)
#define SET_STRING(m,v) ((VarString*)(m).get())->set(v)
-#define SET_VOLUME(m,v,b) ((Volume*)(m).get())->set(v,b)
+#define SET_VOLUME(m,v,b) ((Volume*)(m).get())->setVolume(v,b)
VlcProc::VlcProc( intf_thread_t *pIntf ): SkinObject( pIntf ),
m_varEqBands( pIntf ), m_pVout( NULL ), m_pAout( NULL ),
(void)p_obj; (void)newVal;
playlist_t* pPlaylist = getIntf()->p_sys->p_playlist;
- int volume = var_GetInteger( pPlaylist, "volume" );
- SET_VOLUME( m_cVarVolume, volume, false );
+ SET_VOLUME( m_cVarVolume, var_GetFloat( pPlaylist, "volume" ), false );
bool b_is_muted = aout_MuteGet( pPlaylist ) > 0;
SET_BOOL( m_cVarMute, b_is_muted );
}
SET_BOOL( m_cVarLoop, var_GetBool( pPlaylist, "loop" ) );
SET_BOOL( m_cVarRepeat, var_GetBool( pPlaylist, "repeat" ) );
- int volume = var_GetInteger( pPlaylist, "volume" );
- SET_VOLUME( m_cVarVolume, volume, false );
+ SET_VOLUME( m_cVarVolume, var_GetFloat( pPlaylist, "volume" ), false );
bool b_is_muted = aout_MuteGet( pPlaylist ) > 0;
SET_BOOL( m_cVarMute, b_is_muted );
// set current volume from the playlist
playlist_t* pPlaylist = pIntf->p_sys->p_playlist;
- int volume = var_GetInteger( pPlaylist, "volume" );
- set( volume, false );
+ setVolume( var_GetFloat( pPlaylist, "volume" ), false );
}
}
-void Volume::set( int volume, bool updateVLC )
+void Volume::setVolume( float volume, bool updateVLC )
{
- // volume is kept by the playlist in [0,AOUT_VOLUME_MAX] range
- // this class keeps it in [0.,1.] range
- set( (float)volume/(float)AOUT_VOLUME_MAX, updateVLC );
+ // translate from [0.,AOUT_VOLUME_MAX/AOUT_VOLUME_DEFAULT] into [0.,1.]
+ float percentage = (volume > 0.f ) ?
+ volume * AOUT_VOLUME_DEFAULT / AOUT_VOLUME_MAX :
+ 0.f;
+ set( percentage, updateVLC );
}
float Volume::getVolume() const
{
// translate from [0.,1.] into [0.,AOUT_VOLUME_MAX/AOUT_VOLUME_DEFAULT]
- return get() * AOUT_VOLUME_MAX/AOUT_VOLUME_DEFAULT;
+ return get() * AOUT_VOLUME_MAX / AOUT_VOLUME_DEFAULT;
}
virtual ~Volume() { }
virtual void set( float percentage, bool updateVLC );
-
- virtual void set( int volume, bool updateVLC );
-
virtual void set( float percentage ) { set( percentage, true ); }
virtual float getVolume() const;
+ virtual void setVolume( float volume, bool updateVLC );
virtual float getStep() const { return m_step; }