cedric pushed a commit to branch master. http://git.enlightenment.org/core/efl.git/commit/?id=e8cebd6ce7afc66d9827e677edd8582eb0545b10
commit e8cebd6ce7afc66d9827e677edd8582eb0545b10 Author: Igor Gala <[email protected]> Date: Thu Jun 12 19:11:54 2014 +0200 edje: Edje_Edit - edje_edit_sound_compression_rate_xet() Summary: There are new 'get and set' API for block 'sound'. Those functions return or set quality of the compression for a given sound. @feature Reviewers: cedric, Hermet, seoz, raster CC: reutskiy.v.v, cedric Differential Revision: https://phab.enlightenment.org/D1017 Signed-off-by: Cedric BAIL <[email protected]> --- src/lib/edje/Edje_Edit.h | 19 +++++++++++++++++++ src/lib/edje/edje_edit.c | 49 ++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 68 insertions(+) diff --git a/src/lib/edje/Edje_Edit.h b/src/lib/edje/Edje_Edit.h index e615ba9..f6a3b3a 100644 --- a/src/lib/edje/Edje_Edit.h +++ b/src/lib/edje/Edje_Edit.h @@ -3628,6 +3628,25 @@ EAPI Eina_Bool edje_edit_sound_sample_del(Evas_Object *obj, const char *name); */ EAPI Eina_Bool edje_edit_sound_tone_del(Evas_Object *obj, const char* name); +/** Get the sound quality compression. + * + *@param obj Object being edited. + *@param name The name of the sample. + * + *@return Quality of the compression of the sample sound. + */ +EAPI double edje_edit_sound_compression_rate_get(Evas_Object *obj, const char* sound); + +/* Set the sound quality compression. + * + *@param obj Object being edited. + *@param name The name of the sample. + *@param rate Quality of the compression. + * + *@return EINA_TRUE if successful, EINA_FALSE otherwise. + */ +EAPI Eina_Bool edje_edit_sound_compression_rate_set(Evas_Object *obj, const char* sound, double rate); + //@} /******************************************************************************/ /************************* SPECTRUM API ***********************************/ diff --git a/src/lib/edje/edje_edit.c b/src/lib/edje/edje_edit.c index 72525e6..6eee47d 100644 --- a/src/lib/edje/edje_edit.c +++ b/src/lib/edje/edje_edit.c @@ -1206,6 +1206,55 @@ edje_edit_sound_tone_del(Evas_Object *obj, const char* name) return EINA_TRUE; } +EAPI double +edje_edit_sound_compression_rate_get(Evas_Object *obj, const char *sound) +{ + Edje_Sound_Sample *ss = NULL; + unsigned int i; + + GET_ED_OR_RETURN(-1); + + if ((!ed->file) || (!ed->file->sound_dir)) + return -1; + + for (i = 0; i < ed->file->sound_dir->samples_count; i++) + { + ss = ed->file->sound_dir->samples + i; + if ((ss->name) && (!strcmp(sound, ss->name))) + break; + } + + if (i == ed->file->sound_dir->samples_count) + return -1; + + return ss->quality; +} + +EAPI Eina_Bool +edje_edit_sound_compression_rate_set(Evas_Object *obj, const char *sound, double rate) +{ + Edje_Sound_Sample *ss = NULL; + unsigned int i; + + GET_ED_OR_RETURN(EINA_FALSE); + + if ((!ed->file) || (!ed->file->sound_dir)) + return EINA_FALSE; + + for (i = 0; i < ed->file->sound_dir->samples_count; i++) + { + ss = ed->file->sound_dir->samples + i; + if ((ss->name) && (!strcmp(sound, ss->name))) + break; + } + + if (i == ed->file->sound_dir->samples_count) + return EINA_FALSE; + + ss->quality = rate; + return EINA_TRUE; +} + /****************/ /* GROUPS API */ /****************/ --
