Commit 3c7f3126 authored by Hugo Beauzée-Luyssen's avatar Hugo Beauzée-Luyssen

ps: Restore equalizer last state when restarting

parent 60811ddf
......@@ -37,6 +37,7 @@
#include "playback_service.h"
#include "media/media_list.h"
#include "preferences/preferences.h"
#include "ui/equalizer.h"
#include "ui/views/minicontrol_view.h"
......@@ -303,6 +304,17 @@ ps_emotion_create(playback_service *p_ps, Evas *p_evas, bool b_mute_video)
//evas_object_smart_callback_add(p_e, "audio_level_change", ps_emotion_audio_change, p_ps);
//evas_object_smart_callback_add(p_e, "channels_change", ps_emotion_channels_change, p_ps);
if ( equalizer_is_enabled() )
{
float f_preamp = equalizer_get_preamp_value();
unsigned int i_nb_bands = equalizer_get_nb_bands();
float f_bands[i_nb_bands];
for ( unsigned int i = 0; i < i_nb_bands; ++i )
f_bands[i] = equalizer_get_band_value( i );
// Don't use playback_service_eq_set since we haven't assigned p_e yet
emotion_object_equalizer_set( p_e, f_preamp, i_nb_bands, f_bands );
}
return p_e;
}
......
......@@ -139,6 +139,12 @@ equalizer_set_preset_value( const char* psz_value )
preference_remove( EQUALIZER_PRESET_SETTING );
}
unsigned int
equalizer_get_nb_bands()
{
return libvlc_audio_equalizer_get_band_count();
}
static void
equalizer_dismiss_preset_popup(void *data, Evas_Object *obj, void *event_info)
{
......@@ -327,7 +333,7 @@ equalizer_init_sliders(equalizer* p_eq)
equalizer_update_preamp_slider( p_eq, f_value );
p_eq->i_nb_bands = libvlc_audio_equalizer_get_band_count();
p_eq->i_nb_bands = equalizer_get_nb_bands();
p_eq->p_bands = malloc( p_eq->i_nb_bands * sizeof( *p_eq->p_bands ) );
for ( unsigned int i = 0; i < p_eq->i_nb_bands; ++i )
{
......
......@@ -43,8 +43,10 @@ equalizer_is_enabled();
float
equalizer_get_preamp_value();
static float
float
equalizer_get_band_value( unsigned int i_band );
unsigned int
equalizer_get_nb_bands();
#endif // EQUALIZER_H_
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