cedric pushed a commit to branch master.

http://git.enlightenment.org/core/efl.git/commit/?id=0500f4f33f2a68b224f9661cadeb7c130342b9f7

commit 0500f4f33f2a68b224f9661cadeb7c130342b9f7
Author: Igor Gala <i.g...@samsung.com>
Date:   Mon Jun 16 16:47:16 2014 +0200

    edje: Edje_Edit - edje_edit_sound_compression_type_xet()
    
    Summary:
    There are new 'get and set' API for block 'sound'.
    Those functions return or set compression type for a given sound.
    @feature
    
    Reviewers: cedric, raster, Hermet, seoz
    
    CC: reutskiy.v.v, cedric
    
    Differential Revision: https://phab.enlightenment.org/D1013
    
    Signed-off-by: Cedric BAIL <c.b...@partner.samsung.com>
---
 src/lib/edje/Edje_Edit.h | 31 +++++++++++++++++++++++++++++
 src/lib/edje/edje_edit.c | 52 ++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 83 insertions(+)

diff --git a/src/lib/edje/Edje_Edit.h b/src/lib/edje/Edje_Edit.h
index 6bd96a2..c8f5122 100644
--- a/src/lib/edje/Edje_Edit.h
+++ b/src/lib/edje/Edje_Edit.h
@@ -49,6 +49,15 @@ typedef enum _Edje_Edit_Select_Mode
    EDJE_EDIT_SELECT_MODE_EXPLICIT
 } Edje_Edit_Select_Mode;
 
+typedef enum _Edje_Edit_Sound_Comp
+{
+   EDJE_EDIT_SOUND_COMP_NONE,
+   EDJE_EDIT_SOUND_COMP_RAW,
+   EDJE_EDIT_SOUND_COMP_COMP,
+   EDJE_EDIT_SOUND_COMP_LOSSY,
+   EDJE_EDIT_SOUND_COMP_AS_IS
+} Edje_Edit_Sound_Comp;
+
 struct _Edje_Edit_Script_Error
 {
    const char *program_name; /* null == group shared script */
@@ -3936,6 +3945,28 @@ EAPI Eina_Bool 
edje_edit_sound_tone_frequency_set(Evas_Object *obj, const char *
  */
 EAPI int edje_edit_sound_tone_frequency_get(Evas_Object *obj, const char 
*name);
 
+/** Get the sound type compression.
+ *
+ * @param obj Object being edited.
+ * @param name The name of the sample.
+ *
+ * @return Compression type of the sample sound.
+ * @since 1.11
+ */
+EAPI Edje_Edit_Sound_Comp edje_edit_sound_compression_type_get(Evas_Object 
*obj, const char* name);
+
+/** Set the sound type compression.
+ *
+ * @param obj Object being edited.
+ * @param name The name of the sample.
+ * @param sc Edje_Edit_Sound_Comp
+ * (EDJE_EDIT_SOUND_COMP_RAW, EDJE_EDIT_SOUND_COMP_COMP, 
EDJE_EDIT_SOUND_COMP_LOSSY, EDJE_EDIT_SOUND_COMP_AS_IS).
+ *
+ * @return EINA_TRUE if successful, EINA_FALSE otherwise.
+ * @since 1.11
+ */
+EAPI Eina_Bool edje_edit_sound_compression_type_set(Evas_Object *obj, const 
char* name, Edje_Edit_Sound_Comp sc);
+
 //@}
 
/******************************************************************************/
 /*************************   SPECTRUM API   
***********************************/
diff --git a/src/lib/edje/edje_edit.c b/src/lib/edje/edje_edit.c
index 3c248c4..aabb975 100644
--- a/src/lib/edje/edje_edit.c
+++ b/src/lib/edje/edje_edit.c
@@ -1324,6 +1324,58 @@ edje_edit_sound_compression_rate_set(Evas_Object *obj, 
const char *sound, double
 
 #undef GET_TONE_BY_NAME
 
+EAPI Edje_Edit_Sound_Comp
+edje_edit_sound_compression_type_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 (Edje_Edit_Sound_Comp) ss->compression;
+}
+
+EAPI Eina_Bool
+edje_edit_sound_compression_type_set(Evas_Object *obj, const char *sound, 
Edje_Edit_Sound_Comp sc)
+{
+   Edje_Sound_Sample *ss = NULL;
+   unsigned int i;
+
+   if ((sc <= EDJE_EDIT_SOUND_COMP_NONE) ||
+       (sc > EDJE_EDIT_SOUND_COMP_AS_IS))
+     return EINA_FALSE;
+   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->compression = (int) sc;
+   return EINA_TRUE;
+}
+
 /****************/
 /*  GROUPS API  */
 /****************/

-- 


Reply via email to