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.bail@partner.samsung.com>
This commit is contained in:
Igor Gala 2014-06-16 16:47:16 +02:00 committed by Cedric BAIL
parent a691b2ebf9
commit 0500f4f33f
2 changed files with 83 additions and 0 deletions

View File

@ -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 ***********************************/

View File

@ -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 */
/****************/