Commit 9778203f authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

playlist: convert "volume" to float

...and simplify accordingly.
parent 96dfe793
...@@ -465,7 +465,7 @@ libvlc_media_player_new( libvlc_instance_t *instance ) ...@@ -465,7 +465,7 @@ libvlc_media_player_new( libvlc_instance_t *instance )
/* Audio */ /* Audio */
var_Create (mp, "aout", VLC_VAR_STRING | VLC_VAR_DOINHERIT); var_Create (mp, "aout", VLC_VAR_STRING | VLC_VAR_DOINHERIT);
var_Create (mp, "mute", VLC_VAR_BOOL); var_Create (mp, "mute", VLC_VAR_BOOL);
var_Create (mp, "volume", VLC_VAR_INTEGER); var_Create (mp, "volume", VLC_VAR_FLOAT);
var_Create (mp, "find-input-callback", VLC_VAR_ADDRESS); var_Create (mp, "find-input-callback", VLC_VAR_ADDRESS);
var_SetAddress (mp, "find-input-callback", find_input); var_SetAddress (mp, "find-input-callback", find_input);
var_Create (mp, "amem-data", VLC_VAR_ADDRESS); var_Create (mp, "amem-data", VLC_VAR_ADDRESS);
......
...@@ -902,7 +902,8 @@ static int VolumeChanged( vlc_object_t *p_this, char const *psz_cmd, ...@@ -902,7 +902,8 @@ static int VolumeChanged( vlc_object_t *p_this, char const *psz_cmd,
intf_thread_t *p_intf = (intf_thread_t*)p_data; intf_thread_t *p_intf = (intf_thread_t*)p_data;
vlc_mutex_lock( &p_intf->p_sys->status_lock ); vlc_mutex_lock( &p_intf->p_sys->status_lock );
msg_rc( STATUS_CHANGE "( audio volume: %"PRId64" )", newval.i_int ); msg_rc( STATUS_CHANGE "( audio volume: %ld )",
lroundf(newval.f_float * AOUT_VOLUME_DEFAULT) );
vlc_mutex_unlock( &p_intf->p_sys->status_lock ); vlc_mutex_unlock( &p_intf->p_sys->status_lock );
return VLC_SUCCESS; return VLC_SUCCESS;
} }
......
...@@ -958,7 +958,7 @@ MainInputManager::MainInputManager( intf_thread_t *_p_intf ) ...@@ -958,7 +958,7 @@ MainInputManager::MainInputManager( intf_thread_t *_p_intf )
repeat.addCallback( this, SLOT(notifyRepeatLoop(bool)) ); repeat.addCallback( this, SLOT(notifyRepeatLoop(bool)) );
loop.addCallback( this, SLOT(notifyRepeatLoop(bool)) ); loop.addCallback( this, SLOT(notifyRepeatLoop(bool)) );
volume.addCallback( this, SLOT(notifyVolume(qlonglong)) ); volume.addCallback( this, SLOT(notifyVolume(float)) );
mute.addCallback( this, SLOT(notifyMute(bool)) ); mute.addCallback( this, SLOT(notifyMute(bool)) );
/* Warn our embedded IM about input changes */ /* Warn our embedded IM about input changes */
...@@ -1217,9 +1217,9 @@ static int LeafToParent( vlc_object_t *p_this, const char *psz_var, ...@@ -1217,9 +1217,9 @@ static int LeafToParent( vlc_object_t *p_this, const char *psz_var,
return VLC_SUCCESS; return VLC_SUCCESS;
} }
void MainInputManager::notifyVolume( qlonglong volume ) void MainInputManager::notifyVolume( float volume )
{ {
emit volumeChanged( volume / (float)AOUT_VOLUME_DEFAULT ); emit volumeChanged( volume );
} }
void MainInputManager::notifyMute( bool mute ) void MainInputManager::notifyMute( bool mute )
......
...@@ -274,7 +274,7 @@ private: ...@@ -274,7 +274,7 @@ private:
input_thread_t *p_input; input_thread_t *p_input;
intf_thread_t *p_intf; intf_thread_t *p_intf;
QVLCBool random, repeat, loop; QVLCBool random, repeat, loop;
QVLCInteger volume; QVLCFloat volume;
QVLCBool mute; QVLCBool mute;
public slots: public slots:
...@@ -292,7 +292,7 @@ public slots: ...@@ -292,7 +292,7 @@ public slots:
private slots: private slots:
void notifyRandom( bool ); void notifyRandom( bool );
void notifyRepeatLoop( bool ); void notifyRepeatLoop( bool );
void notifyVolume( qlonglong ); void notifyVolume( float );
void notifyMute( bool ); void notifyMute( bool );
signals: signals:
void inputChanged( input_thread_t * ); void inputChanged( input_thread_t * );
......
...@@ -55,16 +55,6 @@ static int var_Copy (vlc_object_t *src, const char *name, vlc_value_t prev, ...@@ -55,16 +55,6 @@ static int var_Copy (vlc_object_t *src, const char *name, vlc_value_t prev,
return var_Set (dst, name, value); return var_Set (dst, name, value);
} }
static int var_CopyVolume (vlc_object_t *src, const char *name,
vlc_value_t prev, vlc_value_t value, void *data)
{
vlc_object_t *dst = data;
long volume = lroundf (value.f_float * (float)AOUT_VOLUME_DEFAULT);
(void) src; (void) prev;
return var_SetInteger (dst, name, volume);
}
#undef aout_New #undef aout_New
/***************************************************************************** /*****************************************************************************
* aout_New: initialize aout structure * aout_New: initialize aout structure
...@@ -95,7 +85,7 @@ audio_output_t *aout_New( vlc_object_t * p_parent ) ...@@ -95,7 +85,7 @@ audio_output_t *aout_New( vlc_object_t * p_parent )
char *str; char *str;
var_Create (aout, "volume", VLC_VAR_FLOAT); var_Create (aout, "volume", VLC_VAR_FLOAT);
var_AddCallback (aout, "volume", var_CopyVolume, p_parent); var_AddCallback (aout, "volume", var_Copy, p_parent);
var_Create (aout, "mute", VLC_VAR_BOOL | VLC_VAR_DOINHERIT); var_Create (aout, "mute", VLC_VAR_BOOL | VLC_VAR_DOINHERIT);
var_AddCallback (aout, "mute", var_Copy, p_parent); var_AddCallback (aout, "mute", var_Copy, p_parent);
...@@ -206,7 +196,8 @@ void aout_Destroy (audio_output_t *aout) ...@@ -206,7 +196,8 @@ void aout_Destroy (audio_output_t *aout)
aout_Shutdown (aout); aout_Shutdown (aout);
var_DelCallback (aout, "mute", var_Copy, aout->p_parent); var_DelCallback (aout, "mute", var_Copy, aout->p_parent);
var_DelCallback (aout, "volume", var_CopyVolume, aout->p_parent); var_SetFloat (aout, "volume", -1.f);
var_DelCallback (aout, "volume", var_Copy, aout->p_parent);
vlc_object_release (aout); vlc_object_release (aout);
} }
......
...@@ -437,7 +437,8 @@ static void VariablesInit( playlist_t *p_playlist ) ...@@ -437,7 +437,8 @@ static void VariablesInit( playlist_t *p_playlist )
/* Audio output parameters */ /* Audio output parameters */
var_Create( p_playlist, "mute", VLC_VAR_BOOL ); var_Create( p_playlist, "mute", VLC_VAR_BOOL );
var_Create( p_playlist, "volume", VLC_VAR_INTEGER ); var_Create( p_playlist, "volume", VLC_VAR_FLOAT );
var_SetFloat( p_playlist, "volume", -1.f );
/* FIXME: horrible hack for audio output interface code */ /* FIXME: horrible hack for audio output interface code */
var_Create( p_playlist, "find-input-callback", VLC_VAR_ADDRESS ); var_Create( p_playlist, "find-input-callback", VLC_VAR_ADDRESS );
var_SetAddress( p_playlist, "find-input-callback", playlist_FindInput ); var_SetAddress( p_playlist, "find-input-callback", playlist_FindInput );
......
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