From 7366caab1ab57086aca560d57137e8bea4e67b7f Mon Sep 17 00:00:00 2001 From: Igor Gala Date: Sat, 18 Oct 2014 13:44:25 +0200 Subject: [PATCH] edje: Edje_Edit - get the source name of the sample @feature Reviewers: cedric, Hermet, seoz, raster, reutskiy.v.v Subscribers: cedric Differential Revision: https://phab.enlightenment.org/D1546 Signed-off-by: Cedric BAIL --- src/lib/edje/Edje_Edit.h | 10 ++++++++++ src/lib/edje/edje_edit.c | 27 +++++++++++++++++++++++++++ 2 files changed, 37 insertions(+) diff --git a/src/lib/edje/Edje_Edit.h b/src/lib/edje/Edje_Edit.h index 14bbb7222a..795a383971 100644 --- a/src/lib/edje/Edje_Edit.h +++ b/src/lib/edje/Edje_Edit.h @@ -5014,6 +5014,16 @@ EAPI Eina_Bool edje_edit_sound_compression_type_set(Evas_Object *obj, const char */ EAPI Eina_Binbuf *edje_edit_sound_samplebuffer_get(Evas_Object *obj, const char *sample_name); +/** Get the name of sample source. + * + * @param obj Object being edited. + * @param sample_name The name of the sample. + * + * @return snd_src The sample source name. + * @since 1.11 + */ +EAPI const char *edje_edit_sound_samplesource_get(Evas_Object *obj, const char *sample_name); + //@} /******************************************************************************/ /************************* SPECTRUM API ***********************************/ diff --git a/src/lib/edje/edje_edit.c b/src/lib/edje/edje_edit.c index bc743c6b88..2802ba503d 100644 --- a/src/lib/edje/edje_edit.c +++ b/src/lib/edje/edje_edit.c @@ -1500,6 +1500,33 @@ edje_edit_sound_samplebuffer_get(Evas_Object *obj, const char *sample_name) return NULL; } +EAPI const char * +edje_edit_sound_samplesource_get(Evas_Object *obj, const char *sample_name) +{ + Edje_Sound_Sample *sample; + int i; + + if (!sample_name) + { + ERR("Given Sample Name is NULL"); + return NULL; + } + + GET_ED_OR_RETURN(NULL); + + if ((!ed) || (!ed->file) || (!ed->file->sound_dir)) + return NULL; + + for(i = 0; i < (int)ed->file->sound_dir->samples_count; i++) + { + sample = &ed->file->sound_dir->samples[i]; + if (!strcmp(sample->name, sample_name)) + return eina_stringshare_add(sample->snd_src); + } + + return NULL; +} + /****************/ /* GROUPS API */