summaryrefslogtreecommitdiff
path: root/src/lib/ecore_audio
diff options
context:
space:
mode:
authorYossi Kantor <yossi.kantor@samsung.com>2014-03-26 10:17:38 +0200
committerDaniel Zaoui <daniel.zaoui@samsung.com>2014-04-02 15:56:14 +0300
commiteb2821bca0eb6e67e8c2bfe345f923bc419bbfa5 (patch)
tree56e2670ac0c7978b7947eec8ead2104ed511bbb2 /src/lib/ecore_audio
parent165efe2254ecd352011d28a351cd874c6eb0a181 (diff)
Eolian: Integration of Ecore Audio
Diffstat (limited to 'src/lib/ecore_audio')
-rw-r--r--src/lib/ecore_audio/ecore_audio.eo132
-rw-r--r--src/lib/ecore_audio/ecore_audio_obj.c107
-rw-r--r--src/lib/ecore_audio/ecore_audio_obj.h4
3 files changed, 153 insertions, 90 deletions
diff --git a/src/lib/ecore_audio/ecore_audio.eo b/src/lib/ecore_audio/ecore_audio.eo
new file mode 100644
index 0000000000..6c2d70536e
--- /dev/null
+++ b/src/lib/ecore_audio/ecore_audio.eo
@@ -0,0 +1,132 @@
1class Ecore_Audio (Eo_Base)
2{
3 eo_prefix: ecore_audio_obj;
4 data: Ecore_Audio_Object;
5 properties {
6 name {
7 set {
8 /*@
9 Set the name of the object
10
11 @since 1.8 */
12 legacy null;
13 }
14 get {
15 /*@
16 Get the name of the object
17
18 @since 1.8 */
19 legacy null;
20 }
21 values {
22 const char *name;
23 }
24 }
25 paused {
26 set {
27 /*@
28 Set the pause state of the object
29
30 @since 1.8 */
31 legacy null;
32 }
33 get {
34 /*@
35 Get the pause state of the object
36
37 @since 1.8 */
38 legacy null;
39 }
40 values {
41 Eina_Bool paused; /*ret EINA_TRUE if object is paused, EINA_FALSE if not*/
42 }
43 }
44 volume {
45 set {
46 /*@
47 Set the volume of the object
48
49 @since 1.8 */
50 legacy null;
51 }
52 get {
53 /*@
54 Get the volume of the object
55
56 @since 1.8 */
57 legacy null;
58 }
59 values {
60 double volume; /*The volume*/
61 }
62 }
63 source {
64 set {
65 /*@
66 Set the source of the object
67
68 What sources are supported depends on the actual object. For example,
69 the libsndfile class accepts WAV, OGG, FLAC files as source.
70
71 @since 1.8 */
72 legacy null;
73 return Eina_Bool; /*EINA_TRUE if the source was set correctly (i.e. the file was opened), EINA_FALSE otherwise*/
74 }
75 get {
76 /*@
77 Get the source of the object
78
79 @since 1.8 */
80 legacy null;
81 }
82 values {
83 const char *source; /*The source to set to (i.e. file, URL, device)*/
84 }
85 }
86 format {
87 set {
88 /*@
89 Set the format of the object
90
91 What formats are supported depends on the actual object. Default is
92 ECORE_AUDIO_FORMAT_AUTO
93
94 @since 1.8 */
95 legacy null;
96 return Eina_Bool; /*EINA_TRUE if the format was supported, EINA_FALSE otherwise*/
97 }
98 get {
99 /*@
100 Get the format of the object
101
102 After setting the source if the format was ECORE_AUDIO_FORMAT_AUTO this
103 function will now return the actual format.
104
105 @since 1.8 */
106 legacy null;
107 }
108 values {
109 Ecore_Audio_Format format; /*The format of the object*/
110 }
111 }
112 }
113 methods {
114 vio_set {
115 /*@
116 Set the virtual IO functions
117
118 @since 1.8 */
119 params {
120 Ecore_Audio_Vio *vio; /*The @ref Ecore_Audio_Vio struct with the function callbacks*/
121 void *data; /*User data to pass to the VIO functions*/
122 eo_base_data_free_func free_func; /*This function takes care to clean up @ref data when he VIO is destroyed. NULL means do nothing.*/
123 }
124 }
125 }
126 implements {
127 Eo_Base::constructor;
128 virtual::source;
129 virtual::format;
130 virtual::vio_set;
131 }
132} \ No newline at end of file
diff --git a/src/lib/ecore_audio/ecore_audio_obj.c b/src/lib/ecore_audio/ecore_audio_obj.c
index 9154e4a744..98468a0f74 100644
--- a/src/lib/ecore_audio/ecore_audio_obj.c
+++ b/src/lib/ecore_audio/ecore_audio_obj.c
@@ -15,122 +15,51 @@
15#include <Eo.h> 15#include <Eo.h>
16#include "ecore_audio_private.h" 16#include "ecore_audio_private.h"
17 17
18EAPI Eo_Op ECORE_AUDIO_OBJ_BASE_ID = EO_NOOP;
19
20#define MY_CLASS ECORE_AUDIO_OBJ_CLASS 18#define MY_CLASS ECORE_AUDIO_OBJ_CLASS
21#define MY_CLASS_NAME "Ecore_Audio" 19#define MY_CLASS_NAME "Ecore_Audio"
22 20
23static void _name_set(Eo *eo_obj EINA_UNUSED, void *_pd, va_list *list) 21EOLIAN static void
22_ecore_audio_name_set(Eo *eo_obj EINA_UNUSED, Ecore_Audio_Object *obj, const char *name)
24{ 23{
25 Ecore_Audio_Object *obj = _pd;
26
27 const char *name = va_arg(*list, const char *);
28
29 eina_stringshare_replace(&obj->name, name); 24 eina_stringshare_replace(&obj->name, name);
30} 25}
31 26
32static void _name_get(Eo *eo_obj EINA_UNUSED, void *_pd, va_list *list) 27EOLIAN static const char*
28_ecore_audio_name_get(Eo *eo_obj EINA_UNUSED, Ecore_Audio_Object *obj)
33{ 29{
34 const Ecore_Audio_Object *obj = _pd; 30 return obj->name;
35
36 const char **name = va_arg(*list, const char **);
37
38 if (name)
39 *name = obj->name;
40} 31}
41 32
42static void _paused_set(Eo *eo_obj EINA_UNUSED, void *_pd, va_list *list) 33EOLIAN static void
34_ecore_audio_paused_set(Eo *eo_obj EINA_UNUSED, Ecore_Audio_Object *obj, Eina_Bool paused)
43{ 35{
44 Ecore_Audio_Object *obj = _pd;
45
46 Eina_Bool paused = va_arg(*list, int);
47
48 obj->paused = paused; 36 obj->paused = paused;
49} 37}
50 38
51static void _paused_get(Eo *eo_obj EINA_UNUSED, void *_pd, va_list *list) 39EOLIAN static Eina_Bool
40_ecore_audio_paused_get(Eo *eo_obj EINA_UNUSED, Ecore_Audio_Object *obj)
52{ 41{
53 const Ecore_Audio_Object *obj = _pd; 42 return obj->paused;
54
55 Eina_Bool *ret = va_arg(*list, Eina_Bool *);
56
57 if (ret)
58 *ret = obj->paused;
59} 43}
60 44
61static void _volume_set(Eo *eo_obj EINA_UNUSED, void *_pd, va_list *list) 45EOLIAN static void
46_ecore_audio_volume_set(Eo *eo_obj EINA_UNUSED, Ecore_Audio_Object *obj, double volume)
62{ 47{
63 Ecore_Audio_Object *obj = _pd;
64
65 double volume = va_arg(*list, double);
66
67 obj->volume = volume; 48 obj->volume = volume;
68} 49}
69 50
70static void _volume_get(Eo *eo_obj EINA_UNUSED, void *_pd, va_list *list) 51EOLIAN static double
52_ecore_audio_volume_get(Eo *eo_obj EINA_UNUSED, Ecore_Audio_Object *obj)
71{ 53{
72 const Ecore_Audio_Object *obj = _pd; 54 return obj->volume;
73
74 double *ret = va_arg(*list, double *);
75
76 if (ret)
77 *ret = obj->volume;
78} 55}
79 56
80static void _constructor(Eo *eo_obj, void *_pd, va_list *list EINA_UNUSED) 57EOLIAN static void
58_ecore_audio_eo_base_constructor(Eo *eo_obj, Ecore_Audio_Object *obj)
81{ 59{
82 Ecore_Audio_Object *obj = _pd;
83
84 eo_do_super(eo_obj, MY_CLASS, eo_constructor()); 60 eo_do_super(eo_obj, MY_CLASS, eo_constructor());
85 61
86 obj->volume = 1.0; 62 obj->volume = 1.0;
87
88} 63}
89 64
90static void _class_constructor(Eo_Class *klass) 65#include "ecore_audio.eo.c"
91{
92 const Eo_Op_Func_Description func_desc[] = {
93 /* Virtual functions of parent class implemented in this class */
94 EO_OP_FUNC(EO_BASE_ID(EO_BASE_SUB_ID_CONSTRUCTOR), _constructor),
95 //EO_OP_FUNC(EO_BASE_ID(EO_BASE_SUB_ID_DESTRUCTOR), _destructor),
96
97 /* Specific functions to this class */
98 EO_OP_FUNC(ECORE_AUDIO_OBJ_ID(ECORE_AUDIO_OBJ_SUB_ID_NAME_SET), _name_set),
99 EO_OP_FUNC(ECORE_AUDIO_OBJ_ID(ECORE_AUDIO_OBJ_SUB_ID_NAME_GET), _name_get),
100 EO_OP_FUNC(ECORE_AUDIO_OBJ_ID(ECORE_AUDIO_OBJ_SUB_ID_PAUSED_SET), _paused_set),
101 EO_OP_FUNC(ECORE_AUDIO_OBJ_ID(ECORE_AUDIO_OBJ_SUB_ID_PAUSED_GET), _paused_get),
102 EO_OP_FUNC(ECORE_AUDIO_OBJ_ID(ECORE_AUDIO_OBJ_SUB_ID_VOLUME_SET), _volume_set),
103 EO_OP_FUNC(ECORE_AUDIO_OBJ_ID(ECORE_AUDIO_OBJ_SUB_ID_VOLUME_GET), _volume_get),
104 EO_OP_FUNC_SENTINEL
105 };
106
107 eo_class_funcs_set(klass, func_desc);
108}
109
110static const Eo_Op_Description op_desc[] = {
111 EO_OP_DESCRIPTION(ECORE_AUDIO_OBJ_SUB_ID_NAME_SET, "Sets the name of the object."),
112 EO_OP_DESCRIPTION(ECORE_AUDIO_OBJ_SUB_ID_NAME_GET, "Gets the name of the object."),
113 EO_OP_DESCRIPTION(ECORE_AUDIO_OBJ_SUB_ID_PAUSED_SET, "Sets the paused stated of the object."),
114 EO_OP_DESCRIPTION(ECORE_AUDIO_OBJ_SUB_ID_PAUSED_GET, "Gets the paused stated of the object."),
115 EO_OP_DESCRIPTION(ECORE_AUDIO_OBJ_SUB_ID_VOLUME_SET, "Sets the volume of the object."),
116 EO_OP_DESCRIPTION(ECORE_AUDIO_OBJ_SUB_ID_VOLUME_GET, "Gets the volume of the object."),
117 EO_OP_DESCRIPTION(ECORE_AUDIO_OBJ_SUB_ID_SOURCE_SET, "Sets the source of the object."),
118 EO_OP_DESCRIPTION(ECORE_AUDIO_OBJ_SUB_ID_SOURCE_GET, "Gets the source of the object."),
119 EO_OP_DESCRIPTION(ECORE_AUDIO_OBJ_SUB_ID_FORMAT_SET, "Sets the format of the object."),
120 EO_OP_DESCRIPTION(ECORE_AUDIO_OBJ_SUB_ID_FORMAT_GET, "Gets the format of the object."),
121 EO_OP_DESCRIPTION(ECORE_AUDIO_OBJ_SUB_ID_VIO_SET, "Sets virtual IO callbacks for this object."),
122 EO_OP_DESCRIPTION_SENTINEL
123};
124
125static const Eo_Class_Description class_desc = {
126 EO_VERSION,
127 MY_CLASS_NAME,
128 EO_CLASS_TYPE_REGULAR,
129 EO_CLASS_DESCRIPTION_OPS(&ECORE_AUDIO_OBJ_BASE_ID, op_desc, ECORE_AUDIO_OBJ_SUB_ID_LAST),
130 NULL,
131 sizeof(Ecore_Audio_Object),
132 _class_constructor,
133 NULL
134};
135
136EO_DEFINE_CLASS(ecore_audio_obj_class_get, &class_desc, EO_BASE_CLASS, NULL);
diff --git a/src/lib/ecore_audio/ecore_audio_obj.h b/src/lib/ecore_audio/ecore_audio_obj.h
index fc8d8ebb2f..b473a55f11 100644
--- a/src/lib/ecore_audio/ecore_audio_obj.h
+++ b/src/lib/ecore_audio/ecore_audio_obj.h
@@ -33,7 +33,8 @@ extern "C"
33 * @ingroup Ecore_Audio_Group 33 * @ingroup Ecore_Audio_Group
34 * @{ 34 * @{
35 */ 35 */
36 36#include "ecore_audio.eo.h"
37#if 0
37#define ECORE_AUDIO_OBJ_CLASS ecore_audio_obj_class_get() /**< Ecore_Audio object class */ 38#define ECORE_AUDIO_OBJ_CLASS ecore_audio_obj_class_get() /**< Ecore_Audio object class */
38 39
39/** 40/**
@@ -176,6 +177,7 @@ enum Ecore_Audio_Obj_Sub_Ids
176 */ 177 */
177#define ecore_audio_obj_vio_set(vio, data, free_func) ECORE_AUDIO_OBJ_ID(ECORE_AUDIO_OBJ_SUB_ID_VIO_SET), EO_TYPECHECK(Ecore_Audio_Vio *, vio), EO_TYPECHECK(void *, data), EO_TYPECHECK(eo_base_data_free_func, free_func) 178#define ecore_audio_obj_vio_set(vio, data, free_func) ECORE_AUDIO_OBJ_ID(ECORE_AUDIO_OBJ_SUB_ID_VIO_SET), EO_TYPECHECK(Ecore_Audio_Vio *, vio), EO_TYPECHECK(void *, data), EO_TYPECHECK(eo_base_data_free_func, free_func)
178 179
180#endif
179/** 181/**
180 * @} 182 * @}
181 */ 183 */