diff --git a/src/lib/edje/edje_multisense.c b/src/lib/edje/edje_multisense.c index fd474f0aab..323d567643 100644 --- a/src/lib/edje/edje_multisense.c +++ b/src/lib/edje/edje_multisense.c @@ -4,13 +4,13 @@ #include #include "Ecore_Audio.h" -static Ecore_Audio_Object *out = NULL; +static Eo *out = NULL; -static Eina_Bool _play_finished(void *data EINA_UNUSED, int type EINA_UNUSED, void *event) +static Eina_Bool _play_finished(void *data EINA_UNUSED, Eo *in, const Eo_Event_Description *desc EINA_UNUSED, void *event_info EINA_UNUSED) { - Ecore_Audio_Object *in = (Ecore_Audio_Object *)event; - ecore_audio_input_del(in); - return EINA_FALSE; + eo_del(in); + + return EINA_TRUE; } struct _edje_multisense_eet_data @@ -21,16 +21,16 @@ struct _edje_multisense_eet_data }; static int -eet_snd_file_get_length(Ecore_Audio_Object *in) +eet_snd_file_get_length(void *data, Eo *eo_obj EINA_UNUSED) { - struct _edje_multisense_eet_data *vf = ecore_audio_input_data_get(in); + struct _edje_multisense_eet_data *vf = data; return vf->length; } static int -eet_snd_file_seek(Ecore_Audio_Object *in, int offset, int whence) +eet_snd_file_seek(void *data, Eo *eo_obj EINA_UNUSED, int offset, int whence) { - struct _edje_multisense_eet_data *vf = ecore_audio_input_data_get(in); + struct _edje_multisense_eet_data *vf = data; switch (whence) { @@ -50,9 +50,9 @@ eet_snd_file_seek(Ecore_Audio_Object *in, int offset, int whence) } static int -eet_snd_file_read(Ecore_Audio_Object *in, void *buffer, int count) +eet_snd_file_read(void *data, Eo *eo_obj EINA_UNUSED, void *buffer, int count) { - struct _edje_multisense_eet_data *vf = ecore_audio_input_data_get(in); + struct _edje_multisense_eet_data *vf = data; if ((vf->offset + count) > vf->length) count = vf->length - vf->offset; @@ -62,9 +62,9 @@ eet_snd_file_read(Ecore_Audio_Object *in, void *buffer, int count) } static int -eet_snd_file_tell(Ecore_Audio_Object *in) +eet_snd_file_tell(void *data, Eo *eo_obj EINA_UNUSED) { - struct _edje_multisense_eet_data *vf = ecore_audio_input_data_get(in); + struct _edje_multisense_eet_data *vf = data; return vf->offset; } @@ -74,7 +74,7 @@ Eina_Bool _edje_multisense_internal_sound_sample_play(Edje *ed, const char *sample_name, const double speed) { #ifdef ENABLE_MULTISENSE - Ecore_Audio_Object *in; + Eo *in; Edje_Sound_Sample *sample; char snd_id_str[255]; int i; @@ -96,9 +96,9 @@ _edje_multisense_internal_sound_sample_play(Edje *ed, const char *sample_name, c struct _edje_multisense_eet_data *eet_data; snprintf(snd_id_str, sizeof(snd_id_str), "edje/sounds/%i", sample->id); - in = ecore_audio_input_add(ECORE_AUDIO_TYPE_SNDFILE); - ecore_audio_input_name_set(in, snd_id_str); - ecore_audio_input_speed_set(in, speed); + in = eo_add(ECORE_AUDIO_OBJ_IN_SNDFILE_CLASS, NULL); + eo_do(in, ecore_audio_obj_name_set(snd_id_str)); + eo_do(in, ecore_audio_obj_in_speed_set(speed)); eet_data = calloc(1, sizeof(struct _edje_multisense_eet_data)); @@ -113,13 +113,13 @@ _edje_multisense_internal_sound_sample_play(Edje *ed, const char *sample_name, c eet_data->offset = 0; - ecore_audio_input_data_set(in, eet_data); - ecore_audio_input_sndfile_vio_set(in, &eet_data->vio); + eo_do(in, ecore_audio_obj_vio_set(&eet_data->vio, eet_data, free)); + eo_do(in, eo_event_callback_add(ECORE_AUDIO_EV_IN_STOPPED, _play_finished, NULL)); if (!out) - out = ecore_audio_output_add(ECORE_AUDIO_TYPE_PULSE); + out = eo_add(ECORE_AUDIO_OBJ_OUT_PULSE_CLASS, NULL); - ecore_audio_output_input_add(out, in); + eo_do(out, ecore_audio_obj_out_input_attach(in)); } } return EINA_TRUE; @@ -139,7 +139,7 @@ _edje_multisense_internal_sound_tone_play(Edje *ed, const char *tone_name, const unsigned int i; Edje_Sound_Tone *tone; - Ecore_Audio_Object *in; + Eo *in; if (!tone_name) { ERR("Given Tone Name is NULL\n"); @@ -153,15 +153,16 @@ _edje_multisense_internal_sound_tone_play(Edje *ed, const char *tone_name, const tone = &ed->file->sound_dir->tones[i]; if (!strcmp(tone->name, tone_name)) { - in = ecore_audio_input_add(ECORE_AUDIO_TYPE_TONE); - ecore_audio_input_name_set(in, "tone"); - ecore_audio_input_tone_frequency_set(in, tone->value); - ecore_audio_input_tone_duration_set(in, duration); + in = eo_add(ECORE_AUDIO_OBJ_IN_TONE_CLASS, NULL); + eo_do(in, ecore_audio_obj_name_set("tone")); + eo_do(in, eo_base_data_set(ECORE_AUDIO_ATTR_TONE_FREQ, &tone->value, NULL)); + eo_do(in, ecore_audio_obj_in_length_set(duration)); + eo_do(in, eo_event_callback_add(ECORE_AUDIO_EV_IN_STOPPED, _play_finished, NULL)); if (!out) - out = ecore_audio_output_add(ECORE_AUDIO_TYPE_PULSE); + out = eo_add(ECORE_AUDIO_OBJ_OUT_PULSE_CLASS, NULL); - ecore_audio_output_input_add(out, in); + eo_do(out, ecore_audio_obj_out_input_attach(in)); } } return EINA_TRUE; @@ -175,13 +176,11 @@ _edje_multisense_internal_sound_tone_play(Edje *ed, const char *tone_name, const } -/* Initialize the modules in main thread. to avoid dlopen issue in the Threads */ void _edje_multisense_init(void) { #ifdef ENABLE_MULTISENSE ecore_audio_init(); - ecore_event_handler_add(ECORE_AUDIO_INPUT_ENDED, _play_finished, NULL); #endif }