summaryrefslogtreecommitdiff
path: root/src/lib/ecore_audio
diff options
context:
space:
mode:
authorDaniel Willmann <d.willmann@samsung.com>2013-04-17 18:43:51 +0100
committerDaniel Willmann <d.willmann@samsung.com>2013-04-18 19:14:32 +0100
commit38b3738384b0c832f202dd545ca79fd9769f7c79 (patch)
tree94234c3211d30e45c28ebdd1ace63cba35f5bbaf /src/lib/ecore_audio
parente865d5b0a4b8eb41def9c5f6412e650b7660a7d9 (diff)
ecore_audio: Allow setting frequency and length in tone input
Signed-off-by: Daniel Willmann <d.willmann@samsung.com>
Diffstat (limited to 'src/lib/ecore_audio')
-rw-r--r--src/lib/ecore_audio/ecore_audio_obj_in.c3
-rw-r--r--src/lib/ecore_audio/ecore_audio_obj_in.h11
-rw-r--r--src/lib/ecore_audio/ecore_audio_obj_in_tone.c47
-rw-r--r--src/lib/ecore_audio/ecore_audio_obj_in_tone.h2
4 files changed, 58 insertions, 5 deletions
diff --git a/src/lib/ecore_audio/ecore_audio_obj_in.c b/src/lib/ecore_audio/ecore_audio_obj_in.c
index d5bb9a3607..704e27d68c 100644
--- a/src/lib/ecore_audio/ecore_audio_obj_in.c
+++ b/src/lib/ecore_audio/ecore_audio_obj_in.c
@@ -238,11 +238,12 @@ static const Eo_Op_Description op_desc[] = {
238 EO_OP_DESCRIPTION(ECORE_AUDIO_OBJ_IN_SUB_ID_PRELOADED_GET, G(preloaded)), 238 EO_OP_DESCRIPTION(ECORE_AUDIO_OBJ_IN_SUB_ID_PRELOADED_GET, G(preloaded)),
239 EO_OP_DESCRIPTION(ECORE_AUDIO_OBJ_IN_SUB_ID_LOOPED_SET, S(looped)), 239 EO_OP_DESCRIPTION(ECORE_AUDIO_OBJ_IN_SUB_ID_LOOPED_SET, S(looped)),
240 EO_OP_DESCRIPTION(ECORE_AUDIO_OBJ_IN_SUB_ID_LOOPED_GET, G(looped)), 240 EO_OP_DESCRIPTION(ECORE_AUDIO_OBJ_IN_SUB_ID_LOOPED_GET, G(looped)),
241 EO_OP_DESCRIPTION(ECORE_AUDIO_OBJ_IN_SUB_ID_LENGTH_SET, S(length)),
242 EO_OP_DESCRIPTION(ECORE_AUDIO_OBJ_IN_SUB_ID_LENGTH_GET, G(length)),
241 EO_OP_DESCRIPTION(ECORE_AUDIO_OBJ_IN_SUB_ID_READ, "Read from the input"), 243 EO_OP_DESCRIPTION(ECORE_AUDIO_OBJ_IN_SUB_ID_READ, "Read from the input"),
242 EO_OP_DESCRIPTION(ECORE_AUDIO_OBJ_IN_SUB_ID_READ_INTERNAL, "Internal implementation for the read"), 244 EO_OP_DESCRIPTION(ECORE_AUDIO_OBJ_IN_SUB_ID_READ_INTERNAL, "Internal implementation for the read"),
243 EO_OP_DESCRIPTION(ECORE_AUDIO_OBJ_IN_SUB_ID_SEEK, "Seek within the input"), 245 EO_OP_DESCRIPTION(ECORE_AUDIO_OBJ_IN_SUB_ID_SEEK, "Seek within the input"),
244 EO_OP_DESCRIPTION(ECORE_AUDIO_OBJ_IN_SUB_ID_OUTPUT_GET, G(output)), 246 EO_OP_DESCRIPTION(ECORE_AUDIO_OBJ_IN_SUB_ID_OUTPUT_GET, G(output)),
245 EO_OP_DESCRIPTION(ECORE_AUDIO_OBJ_IN_SUB_ID_LENGTH_GET, G(length)),
246 EO_OP_DESCRIPTION(ECORE_AUDIO_OBJ_IN_SUB_ID_REMAINING_GET, G(remaining)), 247 EO_OP_DESCRIPTION(ECORE_AUDIO_OBJ_IN_SUB_ID_REMAINING_GET, G(remaining)),
247 EO_OP_DESCRIPTION_SENTINEL 248 EO_OP_DESCRIPTION_SENTINEL
248}; 249};
diff --git a/src/lib/ecore_audio/ecore_audio_obj_in.h b/src/lib/ecore_audio/ecore_audio_obj_in.h
index 10becd0169..6da0ec2b81 100644
--- a/src/lib/ecore_audio/ecore_audio_obj_in.h
+++ b/src/lib/ecore_audio/ecore_audio_obj_in.h
@@ -51,11 +51,12 @@ enum Ecore_Audio_Obj_In_Sub_Ids
51 ECORE_AUDIO_OBJ_IN_SUB_ID_PRELOADED_GET, 51 ECORE_AUDIO_OBJ_IN_SUB_ID_PRELOADED_GET,
52 ECORE_AUDIO_OBJ_IN_SUB_ID_LOOPED_SET, 52 ECORE_AUDIO_OBJ_IN_SUB_ID_LOOPED_SET,
53 ECORE_AUDIO_OBJ_IN_SUB_ID_LOOPED_GET, 53 ECORE_AUDIO_OBJ_IN_SUB_ID_LOOPED_GET,
54 ECORE_AUDIO_OBJ_IN_SUB_ID_LENGTH_SET,
55 ECORE_AUDIO_OBJ_IN_SUB_ID_LENGTH_GET,
54 ECORE_AUDIO_OBJ_IN_SUB_ID_READ, 56 ECORE_AUDIO_OBJ_IN_SUB_ID_READ,
55 ECORE_AUDIO_OBJ_IN_SUB_ID_READ_INTERNAL, 57 ECORE_AUDIO_OBJ_IN_SUB_ID_READ_INTERNAL,
56 ECORE_AUDIO_OBJ_IN_SUB_ID_SEEK, 58 ECORE_AUDIO_OBJ_IN_SUB_ID_SEEK,
57 ECORE_AUDIO_OBJ_IN_SUB_ID_OUTPUT_GET, 59 ECORE_AUDIO_OBJ_IN_SUB_ID_OUTPUT_GET,
58 ECORE_AUDIO_OBJ_IN_SUB_ID_LENGTH_GET,
59 ECORE_AUDIO_OBJ_IN_SUB_ID_REMAINING_GET, 60 ECORE_AUDIO_OBJ_IN_SUB_ID_REMAINING_GET,
60 ECORE_AUDIO_OBJ_IN_SUB_ID_LAST 61 ECORE_AUDIO_OBJ_IN_SUB_ID_LAST
61}; 62};
@@ -97,7 +98,11 @@ enum Ecore_Audio_Obj_In_Sub_Ids
97 98
98#define ecore_audio_obj_in_looped_set(looped) ECORE_AUDIO_OBJ_IN_ID(ECORE_AUDIO_OBJ_IN_SUB_ID_LOOPED_SET), EO_TYPECHECK(Eina_Bool, looped) 99#define ecore_audio_obj_in_looped_set(looped) ECORE_AUDIO_OBJ_IN_ID(ECORE_AUDIO_OBJ_IN_SUB_ID_LOOPED_SET), EO_TYPECHECK(Eina_Bool, looped)
99 100
100#define ecore_audio_obj_in_looped_get(preloaded) ECORE_AUDIO_OBJ_IN_ID(ECORE_AUDIO_OBJ_IN_SUB_ID_LOOPED_GET), EO_TYPECHECK(Eina_Bool *, looped) 101#define ecore_audio_obj_in_looped_get(ret) ECORE_AUDIO_OBJ_IN_ID(ECORE_AUDIO_OBJ_IN_SUB_ID_LOOPED_GET), EO_TYPECHECK(Eina_Bool *, ret)
102
103#define ecore_audio_obj_in_length_set(length) ECORE_AUDIO_OBJ_IN_ID(ECORE_AUDIO_OBJ_IN_SUB_ID_LENGTH_SET), EO_TYPECHECK(double, length)
104
105#define ecore_audio_obj_in_length_get(ret) ECORE_AUDIO_OBJ_IN_ID(ECORE_AUDIO_OBJ_IN_SUB_ID_LENGTH_GET), EO_TYPECHECK(double *, ret)
101 106
102#define ecore_audio_obj_in_read(buf, len, ret) ECORE_AUDIO_OBJ_IN_ID(ECORE_AUDIO_OBJ_IN_SUB_ID_READ), EO_TYPECHECK(char *, buf), EO_TYPECHECK(int, len), EO_TYPECHECK(int *, ret) 107#define ecore_audio_obj_in_read(buf, len, ret) ECORE_AUDIO_OBJ_IN_ID(ECORE_AUDIO_OBJ_IN_SUB_ID_READ), EO_TYPECHECK(char *, buf), EO_TYPECHECK(int, len), EO_TYPECHECK(int *, ret)
103 108
@@ -105,8 +110,6 @@ enum Ecore_Audio_Obj_In_Sub_Ids
105 110
106#define ecore_audio_obj_in_output_get(ret) ECORE_AUDIO_OBJ_IN_ID(ECORE_AUDIO_OBJ_IN_SUB_ID_OUTPUT_GET), EO_TYPECHECK(Eo **, ret) 111#define ecore_audio_obj_in_output_get(ret) ECORE_AUDIO_OBJ_IN_ID(ECORE_AUDIO_OBJ_IN_SUB_ID_OUTPUT_GET), EO_TYPECHECK(Eo **, ret)
107 112
108#define ecore_audio_obj_in_length_get(ret) ECORE_AUDIO_OBJ_IN_ID(ECORE_AUDIO_OBJ_IN_SUB_ID_LENGTH_GET), EO_TYPECHECK(double *, ret)
109
110#define ecore_audio_obj_in_remaining_get(ret) ECORE_AUDIO_OBJ_IN_ID(ECORE_AUDIO_OBJ_IN_SUB_ID_REMAINING_GET), EO_TYPECHECK(double *, ret) 113#define ecore_audio_obj_in_remaining_get(ret) ECORE_AUDIO_OBJ_IN_ID(ECORE_AUDIO_OBJ_IN_SUB_ID_REMAINING_GET), EO_TYPECHECK(double *, ret)
111 114
112extern const Eo_Event_Description _ECORE_AUDIO_EV_IN_LOOPED; 115extern const Eo_Event_Description _ECORE_AUDIO_EV_IN_LOOPED;
diff --git a/src/lib/ecore_audio/ecore_audio_obj_in_tone.c b/src/lib/ecore_audio/ecore_audio_obj_in_tone.c
index 53286cb762..e8969c70bf 100644
--- a/src/lib/ecore_audio/ecore_audio_obj_in_tone.c
+++ b/src/lib/ecore_audio/ecore_audio_obj_in_tone.c
@@ -146,6 +146,49 @@ static void _format_get(Eo *eo_obj, void *_pd EINA_UNUSED, va_list *list)
146 *ret = obj->format; 146 *ret = obj->format;
147} 147}
148 148
149static void _length_set(Eo *eo_obj, void *_pd EINA_UNUSED, va_list *list)
150{
151 Ecore_Audio_Input *in_obj = eo_data_get(eo_obj, ECORE_AUDIO_OBJ_IN_CLASS);
152
153 double length= va_arg(*list, double);
154
155 in_obj->length = length;
156}
157
158static void _data_set(Eo *eo_obj, void *_pd, va_list *list)
159{
160 Ecore_Audio_Tone *obj = _pd;
161
162 const char *key = va_arg(*list, const char *);
163 const void *val = va_arg(*list, const void *);
164 eo_base_data_free_func func = va_arg(*list, eo_base_data_free_func);
165
166 if (!key) return;
167
168 if (!strcmp(key, ECORE_AUDIO_ATTR_TONE_FREQ)) {
169 obj->freq = *(int *)val;
170 } else {
171 eo_do_super(eo_obj, MY_CLASS, eo_base_data_set(key, val, func));
172 }
173
174}
175
176static void _data_get(Eo *eo_obj, void *_pd, va_list *list)
177{
178 Ecore_Audio_Tone *obj = _pd;
179
180 const char *key = va_arg(*list, const char*);
181 void **ret = va_arg(*list, void **);
182
183 if (!strcmp(key, ECORE_AUDIO_ATTR_TONE_FREQ)) {
184 if (ret)
185 *(int *)ret = obj->freq;
186 } else {
187 eo_do_super(eo_obj, MY_CLASS, eo_base_data_get(key, ret));
188 }
189
190}
191
149static void _constructor(Eo *eo_obj, void *_pd, va_list *list EINA_UNUSED) 192static void _constructor(Eo *eo_obj, void *_pd, va_list *list EINA_UNUSED)
150{ 193{
151 Ecore_Audio_Tone *obj = _pd; 194 Ecore_Audio_Tone *obj = _pd;
@@ -167,11 +210,15 @@ static void _class_constructor(Eo_Class *klass)
167 EO_OP_FUNC(EO_BASE_ID(EO_BASE_SUB_ID_CONSTRUCTOR), _constructor), 210 EO_OP_FUNC(EO_BASE_ID(EO_BASE_SUB_ID_CONSTRUCTOR), _constructor),
168 //EO_OP_FUNC(EO_BASE_ID(EO_BASE_SUB_ID_DESTRUCTOR), _destructor), 211 //EO_OP_FUNC(EO_BASE_ID(EO_BASE_SUB_ID_DESTRUCTOR), _destructor),
169 212
213 EO_OP_FUNC(EO_BASE_ID(EO_BASE_SUB_ID_DATA_GET), _data_get),
214 EO_OP_FUNC(EO_BASE_ID(EO_BASE_SUB_ID_DATA_SET), _data_set),
215
170 EO_OP_FUNC(ECORE_AUDIO_OBJ_ID(ECORE_AUDIO_OBJ_SUB_ID_SOURCE_SET), _source_set), 216 EO_OP_FUNC(ECORE_AUDIO_OBJ_ID(ECORE_AUDIO_OBJ_SUB_ID_SOURCE_SET), _source_set),
171 EO_OP_FUNC(ECORE_AUDIO_OBJ_ID(ECORE_AUDIO_OBJ_SUB_ID_SOURCE_GET), _source_get), 217 EO_OP_FUNC(ECORE_AUDIO_OBJ_ID(ECORE_AUDIO_OBJ_SUB_ID_SOURCE_GET), _source_get),
172 EO_OP_FUNC(ECORE_AUDIO_OBJ_ID(ECORE_AUDIO_OBJ_SUB_ID_FORMAT_SET), _format_set), 218 EO_OP_FUNC(ECORE_AUDIO_OBJ_ID(ECORE_AUDIO_OBJ_SUB_ID_FORMAT_SET), _format_set),
173 EO_OP_FUNC(ECORE_AUDIO_OBJ_ID(ECORE_AUDIO_OBJ_SUB_ID_FORMAT_GET), _format_get), 219 EO_OP_FUNC(ECORE_AUDIO_OBJ_ID(ECORE_AUDIO_OBJ_SUB_ID_FORMAT_GET), _format_get),
174 220
221 EO_OP_FUNC(ECORE_AUDIO_OBJ_IN_ID(ECORE_AUDIO_OBJ_IN_SUB_ID_LENGTH_SET), _length_set),
175 EO_OP_FUNC(ECORE_AUDIO_OBJ_IN_ID(ECORE_AUDIO_OBJ_IN_SUB_ID_SEEK), _seek), 222 EO_OP_FUNC(ECORE_AUDIO_OBJ_IN_ID(ECORE_AUDIO_OBJ_IN_SUB_ID_SEEK), _seek),
176 EO_OP_FUNC(ECORE_AUDIO_OBJ_IN_ID(ECORE_AUDIO_OBJ_IN_SUB_ID_READ_INTERNAL), _read), 223 EO_OP_FUNC(ECORE_AUDIO_OBJ_IN_ID(ECORE_AUDIO_OBJ_IN_SUB_ID_READ_INTERNAL), _read),
177 224
diff --git a/src/lib/ecore_audio/ecore_audio_obj_in_tone.h b/src/lib/ecore_audio/ecore_audio_obj_in_tone.h
index a02669118b..7faa0db5d6 100644
--- a/src/lib/ecore_audio/ecore_audio_obj_in_tone.h
+++ b/src/lib/ecore_audio/ecore_audio_obj_in_tone.h
@@ -33,6 +33,8 @@ extern "C"
33 * @{ 33 * @{
34 */ 34 */
35 35
36#define ECORE_AUDIO_ATTR_TONE_FREQ "ecore_audio_freq"
37
36#define ECORE_AUDIO_OBJ_IN_TONE_CLASS ecore_audio_obj_in_tone_class_get() 38#define ECORE_AUDIO_OBJ_IN_TONE_CLASS ecore_audio_obj_in_tone_class_get()
37 39
38const Eo_Class *ecore_audio_obj_in_tone_class_get() EINA_CONST; 40const Eo_Class *ecore_audio_obj_in_tone_class_get() EINA_CONST;