summaryrefslogtreecommitdiff
path: root/src/lib/ecore_audio
diff options
context:
space:
mode:
authorDaniel Willmann <d.willmann@samsung.com>2013-04-19 15:28:00 +0100
committerDaniel Willmann <d.willmann@samsung.com>2013-04-19 15:28:00 +0100
commit1c0107afd8989a48841fd5bd94bfc0bd322b8030 (patch)
tree8f6eeb37d0540e866bd36ac05f677dc1b5a97b21 /src/lib/ecore_audio
parentde265a994ac7e32f4b543df28798a793a7be1bef (diff)
ecore_audio: Fix seeking in tone input
Also make seekable be a property of the input as this doesn't make sense for the output. 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.c10
-rw-r--r--src/lib/ecore_audio/ecore_audio_obj_in_sndfile.c8
-rw-r--r--src/lib/ecore_audio/ecore_audio_obj_in_tone.c2
-rw-r--r--src/lib/ecore_audio/ecore_audio_private.h2
4 files changed, 12 insertions, 10 deletions
diff --git a/src/lib/ecore_audio/ecore_audio_obj_in.c b/src/lib/ecore_audio/ecore_audio_obj_in.c
index 72a0a23e8e..1264939f8a 100644
--- a/src/lib/ecore_audio/ecore_audio_obj_in.c
+++ b/src/lib/ecore_audio/ecore_audio_obj_in.c
@@ -128,11 +128,10 @@ static void _length_get(Eo *eo_obj EINA_UNUSED, void *_pd, va_list *list)
128static void _remaining_get(Eo *eo_obj, void *_pd, va_list *list) 128static void _remaining_get(Eo *eo_obj, void *_pd, va_list *list)
129{ 129{
130 const Ecore_Audio_Input *obj = _pd; 130 const Ecore_Audio_Input *obj = _pd;
131 Ecore_Audio_Object *ea_obj = eo_data_get(eo_obj, ECORE_AUDIO_OBJ_CLASS);
132 131
133 double *ret = va_arg(*list, double *); 132 double *ret = va_arg(*list, double *);
134 133
135 if (!ea_obj->seekable && ret) { 134 if (!obj->seekable && ret) {
136 *ret = -1; 135 *ret = -1;
137 } else if (ret) { 136 } else if (ret) {
138 eo_do(eo_obj, ecore_audio_obj_in_seek(0, SEEK_CUR, ret)); 137 eo_do(eo_obj, ecore_audio_obj_in_seek(0, SEEK_CUR, ret));
@@ -156,7 +155,7 @@ static void _read(Eo *eo_obj, void *_pd, va_list *list)
156 } else { 155 } else {
157 eo_do(eo_obj, ecore_audio_obj_in_read_internal(buf, len, &len_read)); 156 eo_do(eo_obj, ecore_audio_obj_in_read_internal(buf, len, &len_read));
158 if (len_read == 0) { 157 if (len_read == 0) {
159 if (!obj->looped || !ea_obj->seekable) { 158 if (!obj->looped || !obj->seekable) {
160 eo_do(eo_obj, eo_event_callback_call(ECORE_AUDIO_EV_IN_STOPPED, NULL, NULL)); 159 eo_do(eo_obj, eo_event_callback_call(ECORE_AUDIO_EV_IN_STOPPED, NULL, NULL));
161 } else { 160 } else {
162 eo_do(eo_obj, ecore_audio_obj_in_seek(0, SEEK_SET, NULL)); 161 eo_do(eo_obj, ecore_audio_obj_in_seek(0, SEEK_SET, NULL));
@@ -207,8 +206,9 @@ static void _free_vio(Ecore_Audio_Object *ea_obj)
207 ea_obj->vio = NULL; 206 ea_obj->vio = NULL;
208} 207}
209 208
210static void _vio_set(Eo *eo_obj, void *_pd EINA_UNUSED, va_list *list) 209static void _vio_set(Eo *eo_obj, void *_pd, va_list *list)
211{ 210{
211 Ecore_Audio_Input *obj = _pd;
212 Ecore_Audio_Object *ea_obj = eo_data_get(eo_obj, ECORE_AUDIO_OBJ_CLASS); 212 Ecore_Audio_Object *ea_obj = eo_data_get(eo_obj, ECORE_AUDIO_OBJ_CLASS);
213 213
214 Ecore_Audio_Vio *vio = va_arg(*list, Ecore_Audio_Vio *); 214 Ecore_Audio_Vio *vio = va_arg(*list, Ecore_Audio_Vio *);
@@ -226,7 +226,7 @@ static void _vio_set(Eo *eo_obj, void *_pd EINA_UNUSED, va_list *list)
226 ea_obj->vio->data = data; 226 ea_obj->vio->data = data;
227 ea_obj->vio->free_func = free_func; 227 ea_obj->vio->free_func = free_func;
228 //FIXME: Save previous value 228 //FIXME: Save previous value
229 ea_obj->seekable = (vio->seek != NULL); 229 obj->seekable = (vio->seek != NULL);
230} 230}
231 231
232static void _constructor(Eo *eo_obj, void *_pd, va_list *list EINA_UNUSED) 232static void _constructor(Eo *eo_obj, void *_pd, va_list *list EINA_UNUSED)
diff --git a/src/lib/ecore_audio/ecore_audio_obj_in_sndfile.c b/src/lib/ecore_audio/ecore_audio_obj_in_sndfile.c
index 08ff50955d..6dcc9fb591 100644
--- a/src/lib/ecore_audio/ecore_audio_obj_in_sndfile.c
+++ b/src/lib/ecore_audio/ecore_audio_obj_in_sndfile.c
@@ -156,7 +156,7 @@ static void _source_set(Eo *eo_obj, void *_pd, va_list *list)
156 return; 156 return;
157 } 157 }
158 158
159 ea_obj->seekable = EINA_TRUE; 159 in_obj->seekable = EINA_TRUE;
160 in_obj->length = (double)obj->sfinfo.frames / obj->sfinfo.samplerate; 160 in_obj->length = (double)obj->sfinfo.frames / obj->sfinfo.samplerate;
161 161
162 in_obj->samplerate = obj->sfinfo.samplerate; 162 in_obj->samplerate = obj->sfinfo.samplerate;
@@ -254,7 +254,7 @@ static void _vio_set(Eo *eo_obj, void *_pd, va_list *list)
254 if (ea_obj->vio) 254 if (ea_obj->vio)
255 _free_vio(ea_obj); 255 _free_vio(ea_obj);
256 256
257 ea_obj->seekable = EINA_FALSE; 257 in_obj->seekable = EINA_FALSE;
258 258
259 if (!vio) 259 if (!vio)
260 return; 260 return;
@@ -263,7 +263,7 @@ static void _vio_set(Eo *eo_obj, void *_pd, va_list *list)
263 ea_obj->vio->vio = vio; 263 ea_obj->vio->vio = vio;
264 ea_obj->vio->data = data; 264 ea_obj->vio->data = data;
265 ea_obj->vio->free_func = free_func; 265 ea_obj->vio->free_func = free_func;
266 ea_obj->seekable = (vio->seek != NULL); 266 in_obj->seekable = (vio->seek != NULL);
267 267
268 obj->handle = sf_open_virtual(&vio_wrapper, SFM_READ, &obj->sfinfo, eo_obj); 268 obj->handle = sf_open_virtual(&vio_wrapper, SFM_READ, &obj->sfinfo, eo_obj);
269 269
@@ -273,7 +273,7 @@ static void _vio_set(Eo *eo_obj, void *_pd, va_list *list)
273 return; 273 return;
274 } 274 }
275 275
276 ea_obj->seekable = EINA_TRUE; 276 in_obj->seekable = EINA_TRUE;
277 in_obj->length = (double)obj->sfinfo.frames / obj->sfinfo.samplerate; 277 in_obj->length = (double)obj->sfinfo.frames / obj->sfinfo.samplerate;
278 278
279 in_obj->samplerate = obj->sfinfo.samplerate; 279 in_obj->samplerate = obj->sfinfo.samplerate;
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 f00d5d4830..11627f16d3 100644
--- a/src/lib/ecore_audio/ecore_audio_obj_in_tone.c
+++ b/src/lib/ecore_audio/ecore_audio_obj_in_tone.c
@@ -85,6 +85,7 @@ static void _seek(Eo *eo_obj, void *_pd, va_list *list)
85 if (ret) 85 if (ret)
86 *ret = (double)obj->phase / in_obj->samplerate; 86 *ret = (double)obj->phase / in_obj->samplerate;
87 87
88 return;
88err: 89err:
89 if (ret) 90 if (ret)
90 *ret = -1.0; 91 *ret = -1.0;
@@ -196,6 +197,7 @@ static void _constructor(Eo *eo_obj, void *_pd, va_list *list EINA_UNUSED)
196 in_obj->channels = 1; 197 in_obj->channels = 1;
197 in_obj->samplerate = 44100; 198 in_obj->samplerate = 44100;
198 in_obj->length = 1; 199 in_obj->length = 1;
200 in_obj->seekable = EINA_TRUE;
199 201
200 obj->freq = 1000; 202 obj->freq = 1000;
201} 203}
diff --git a/src/lib/ecore_audio/ecore_audio_private.h b/src/lib/ecore_audio/ecore_audio_private.h
index e899a04254..0b0bfec28b 100644
--- a/src/lib/ecore_audio/ecore_audio_private.h
+++ b/src/lib/ecore_audio/ecore_audio_private.h
@@ -106,7 +106,6 @@ struct _Ecore_Audio_Object
106 const char *name; 106 const char *name;
107 const char *source; 107 const char *source;
108 108
109 Eina_Bool seekable;
110 Eina_Bool paused; 109 Eina_Bool paused;
111 double volume; 110 double volume;
112 Ecore_Audio_Format format; 111 Ecore_Audio_Format format;
@@ -129,6 +128,7 @@ struct _Ecore_Audio_Output
129struct _Ecore_Audio_Input 128struct _Ecore_Audio_Input
130{ 129{
131 Eina_Bool paused; /**< Is the input paused? */ 130 Eina_Bool paused; /**< Is the input paused? */
131 Eina_Bool seekable;
132 132
133 Eo *output; /**< The output this input is connected to */ 133 Eo *output; /**< The output this input is connected to */
134 134