forked from enlightenment/efl
Eolian: Integration of Ecore Audio In
This commit is contained in:
parent
eb2821bca0
commit
2c8bc8df52
|
@ -7,7 +7,8 @@ BUILT_SOURCES =
|
|||
EOLIAN_FLAGS = \
|
||||
-I$(srcdir)/lib/eo \
|
||||
-I$(srcdir)/lib/evas/canvas \
|
||||
-I$(srcdir)/lib/edje
|
||||
-I$(srcdir)/lib/edje \
|
||||
-I$(srcdir)/lib/ecore_audio
|
||||
|
||||
|
||||
DIST_SUBDIRS =
|
||||
|
|
|
@ -4,11 +4,14 @@ if HAVE_ECORE_AUDIO
|
|||
|
||||
BUILT_SOURCES += \
|
||||
lib/ecore_audio/ecore_audio.eo.c \
|
||||
lib/ecore_audio/ecore_audio.eo.h
|
||||
lib/ecore_audio/ecore_audio.eo.h \
|
||||
lib/ecore_audio/ecore_audio_in.eo.c \
|
||||
lib/ecore_audio/ecore_audio_in.eo.h
|
||||
|
||||
ecore_audioeolianfilesdir = $(datadir)/eolian/include/ecore-@VMAJ@
|
||||
ecore_audioeolianfiles_DATA = \
|
||||
lib/ecore_audio/ecore_audio.eo
|
||||
lib/ecore_audio/ecore_audio.eo \
|
||||
lib/ecore_audio/ecore_audio_in.eo
|
||||
|
||||
EXTRA_DIST += \
|
||||
${ecore_audioeolianfiles_DATA}
|
||||
|
@ -25,7 +28,8 @@ lib/ecore_audio/ecore_audio_obj_in_tone.h \
|
|||
lib/ecore_audio/ecore_audio_protected.h
|
||||
|
||||
nodist_installed_ecoreaudiomainheaders_DATA = \
|
||||
lib/ecore_audio/ecore_audio.eo.h
|
||||
lib/ecore_audio/ecore_audio.eo.h \
|
||||
lib/ecore_audio/ecore_audio_in.eo.h
|
||||
|
||||
lib_ecore_audio_libecore_audio_la_SOURCES = \
|
||||
lib/ecore_audio/ecore_audio.c \
|
||||
|
|
|
@ -116,6 +116,7 @@ class Ecore_Audio (Eo_Base)
|
|||
Set the virtual IO functions
|
||||
|
||||
@since 1.8 */
|
||||
legacy null;
|
||||
params {
|
||||
Ecore_Audio_Vio *vio; /*The @ref Ecore_Audio_Vio struct with the function callbacks*/
|
||||
void *data; /*User data to pass to the VIO functions*/
|
||||
|
@ -125,8 +126,10 @@ class Ecore_Audio (Eo_Base)
|
|||
}
|
||||
implements {
|
||||
Eo_Base::constructor;
|
||||
virtual::source;
|
||||
virtual::format;
|
||||
virtual::source::get;
|
||||
virtual::source::set;
|
||||
virtual::format::get;
|
||||
virtual::format::set;
|
||||
virtual::vio_set;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,205 @@
|
|||
class Ecore_Audio_In (Ecore_Audio)
|
||||
{
|
||||
eo_prefix: ecore_audio_obj_in;
|
||||
data: Ecore_Audio_Input;
|
||||
properties {
|
||||
speed {
|
||||
set {
|
||||
/*@
|
||||
Set the playback speed of the input.
|
||||
|
||||
@since 1.8 */
|
||||
legacy null;
|
||||
}
|
||||
get {
|
||||
/*@
|
||||
Get the playback speed of the input.
|
||||
|
||||
@since 1.8 */
|
||||
legacy null;
|
||||
}
|
||||
values {
|
||||
double speed; /*The speed, 1.0 is the default*/
|
||||
}
|
||||
}
|
||||
samplerate {
|
||||
set {
|
||||
/*@
|
||||
Set the sample-rate of the input
|
||||
|
||||
@since 1.8 */
|
||||
legacy null;
|
||||
}
|
||||
get {
|
||||
/*@
|
||||
Get the he sample-rate of the input
|
||||
|
||||
@since 1.8 */
|
||||
legacy null;
|
||||
}
|
||||
values {
|
||||
int samplerate; /*The samplerate in Hz*/
|
||||
}
|
||||
}
|
||||
channels {
|
||||
set {
|
||||
/*@
|
||||
Set the amount of channels the input has
|
||||
|
||||
@since 1.8 */
|
||||
legacy null;
|
||||
}
|
||||
get {
|
||||
/*@
|
||||
Get the amount of channels the input has
|
||||
|
||||
@since 1.8 */
|
||||
legacy null;
|
||||
}
|
||||
values {
|
||||
int channels; /*The number of channels*/
|
||||
}
|
||||
}
|
||||
preloaded {
|
||||
set {
|
||||
/*@
|
||||
Set the preloaded state of the input
|
||||
|
||||
@since 1.8 */
|
||||
legacy null;
|
||||
}
|
||||
get {
|
||||
/*@
|
||||
Get the the preloaded state of the input
|
||||
|
||||
@since 1.8 */
|
||||
legacy null;
|
||||
}
|
||||
values {
|
||||
Eina_Bool preloaded; /*EINA_TRUE if the input should be cached, EINA_FALSE otherwise*/
|
||||
}
|
||||
}
|
||||
looped {
|
||||
set {
|
||||
/*@
|
||||
Set the looped state of the input
|
||||
|
||||
If the input is looped and reaches the end it will start from the
|
||||
beginning again. At the same time the event @ref ECORE_AUDIO_EV_IN_LOOPED
|
||||
will be emitted
|
||||
|
||||
@since 1.8 */
|
||||
legacy null;
|
||||
}
|
||||
get {
|
||||
/*@
|
||||
Get the looped state of the input
|
||||
|
||||
@since 1.8 */
|
||||
legacy null;
|
||||
}
|
||||
values {
|
||||
Eina_Bool looped; /*EINA_TRUE if the input should be looped, EINA_FALSE otherwise*/
|
||||
}
|
||||
}
|
||||
length {
|
||||
set {
|
||||
/*@
|
||||
Set the length of the input
|
||||
|
||||
This function is only implemented by some classes
|
||||
(i.e. ECORE_AUDIO_OBJ_IN_TONE_CLASS)
|
||||
|
||||
@since 1.8 */
|
||||
legacy null;
|
||||
}
|
||||
get {
|
||||
/*@
|
||||
Get the length of the input
|
||||
|
||||
@since 1.8 */
|
||||
legacy null;
|
||||
}
|
||||
values {
|
||||
double length; /*The length of the input in seconds*/
|
||||
}
|
||||
}
|
||||
output {
|
||||
get {
|
||||
/*@
|
||||
Get the output that this input is attached to
|
||||
|
||||
@since 1.8 */
|
||||
legacy null;
|
||||
}
|
||||
values {
|
||||
Eo *output; /*The output*/
|
||||
}
|
||||
}
|
||||
remaining {
|
||||
get {
|
||||
/*@
|
||||
Get the remaining time of the input
|
||||
|
||||
@since 1.8 */
|
||||
legacy null;
|
||||
}
|
||||
values {
|
||||
double remaining; /*The amount of time in seconds left to play*/
|
||||
}
|
||||
}
|
||||
}
|
||||
methods {
|
||||
read {
|
||||
/*@
|
||||
Read from the input
|
||||
|
||||
@since 1.8 */
|
||||
legacy null;
|
||||
return ssize_t; /*The amount of samples written to buf*/
|
||||
params {
|
||||
@in void *buf; /*The buffer to read into*/
|
||||
@in size_t len; /*The amount of samples to read*/
|
||||
}
|
||||
}
|
||||
read_internal {
|
||||
/*@
|
||||
Internal read function
|
||||
|
||||
@since 1.8 */
|
||||
legacy null;
|
||||
return ssize_t; /*The amount of samples written to buf*/
|
||||
params {
|
||||
@in void *buf; /*The buffer to read into*/
|
||||
@in size_t len; /*The amount of samples to read*/
|
||||
}
|
||||
}
|
||||
seek {
|
||||
/*@
|
||||
Seek within the input
|
||||
|
||||
@since 1.8 */
|
||||
legacy null;
|
||||
return double; /*The current absolute position in seconds within the input*/
|
||||
params {
|
||||
@in double offs; /*The offset in seconds*/
|
||||
@in int mode; /*mode The seek mode. Is absolute with SEEK_SET, relative to the
|
||||
current position with SEEK_CUR and relative to the end with SEEK_END.*/
|
||||
}
|
||||
}
|
||||
}
|
||||
implements {
|
||||
Eo_Base::constructor;
|
||||
Eo_Base::destructor;
|
||||
Ecore_Audio::vio_set;
|
||||
virtual::preloaded::get;
|
||||
virtual::preloaded::set;
|
||||
virtual::seek;
|
||||
virtual::length::set;
|
||||
}
|
||||
events {
|
||||
in,looped; /*@ Called when an input has looped. */
|
||||
in,stopped; /*@ Called when an input has stopped playing. */
|
||||
in,samplerate,changed; /*@ Called when the input samplerate has changed. */
|
||||
}
|
||||
}
|
|
@ -14,24 +14,12 @@
|
|||
|
||||
#include "ecore_audio_private.h"
|
||||
|
||||
EAPI Eo_Op ECORE_AUDIO_OBJ_IN_BASE_ID = EO_NOOP;
|
||||
|
||||
EAPI const Eo_Event_Description _ECORE_AUDIO_EV_IN_LOOPED =
|
||||
EO_EVENT_DESCRIPTION("in,looped", "Called when an input has looped.");
|
||||
EAPI const Eo_Event_Description _ECORE_AUDIO_EV_IN_STOPPED =
|
||||
EO_EVENT_DESCRIPTION("in,stopped", "Called when an input has stopped playing.");
|
||||
EAPI const Eo_Event_Description _ECORE_AUDIO_EV_IN_SAMPLERATE_CHANGED =
|
||||
EO_EVENT_DESCRIPTION("in,samplerate,changed", "Called when the input samplerate has changed.");
|
||||
|
||||
#define MY_CLASS ECORE_AUDIO_OBJ_IN_CLASS
|
||||
#define MY_CLASS_NAME "Ecore_Audio_In"
|
||||
|
||||
static void _speed_set(Eo *eo_obj EINA_UNUSED, void *_pd, va_list *list)
|
||||
EOLIAN static void
|
||||
_ecore_audio_in_speed_set(Eo *eo_obj EINA_UNUSED, Ecore_Audio_Input *obj, double speed)
|
||||
{
|
||||
Ecore_Audio_Input *obj = _pd;
|
||||
|
||||
double speed = va_arg(*list, double);
|
||||
|
||||
if (speed < 0.2)
|
||||
speed = 0.2;
|
||||
if (speed > 5.0)
|
||||
|
@ -39,116 +27,79 @@ static void _speed_set(Eo *eo_obj EINA_UNUSED, void *_pd, va_list *list)
|
|||
|
||||
obj->speed = speed;
|
||||
|
||||
eo_do(eo_obj, eo_event_callback_call(ECORE_AUDIO_EV_IN_SAMPLERATE_CHANGED, NULL, NULL));
|
||||
eo_do(eo_obj, eo_event_callback_call(ECORE_AUDIO_IN_EVENT_IN_SAMPLERATE_CHANGED, NULL, NULL));
|
||||
}
|
||||
|
||||
static void _speed_get(Eo *eo_obj EINA_UNUSED, void *_pd, va_list *list)
|
||||
EOLIAN static double
|
||||
_ecore_audio_in_speed_get(Eo *eo_obj EINA_UNUSED, Ecore_Audio_Input *obj)
|
||||
{
|
||||
const Ecore_Audio_Input *obj = _pd;
|
||||
|
||||
double *speed = va_arg(*list, double *);
|
||||
|
||||
if (speed)
|
||||
*speed = obj->speed;
|
||||
return obj->speed;
|
||||
}
|
||||
|
||||
static void _samplerate_set(Eo *eo_obj EINA_UNUSED, void *_pd, va_list *list)
|
||||
EOLIAN static void
|
||||
_ecore_audio_in_samplerate_set(Eo *eo_obj EINA_UNUSED, Ecore_Audio_Input *obj, int samplerate)
|
||||
{
|
||||
Ecore_Audio_Input *obj = _pd;
|
||||
|
||||
int samplerate = va_arg(*list, int);
|
||||
|
||||
obj->samplerate = samplerate;
|
||||
|
||||
eo_do(eo_obj, eo_event_callback_call(ECORE_AUDIO_EV_IN_SAMPLERATE_CHANGED, NULL, NULL));
|
||||
eo_do(eo_obj, eo_event_callback_call(ECORE_AUDIO_IN_EVENT_IN_SAMPLERATE_CHANGED, NULL, NULL));
|
||||
}
|
||||
|
||||
static void _samplerate_get(Eo *eo_obj EINA_UNUSED, void *_pd, va_list *list)
|
||||
EOLIAN static int
|
||||
_ecore_audio_in_samplerate_get(Eo *eo_obj EINA_UNUSED, Ecore_Audio_Input *obj)
|
||||
{
|
||||
const Ecore_Audio_Input *obj = _pd;
|
||||
|
||||
int *samplerate = va_arg(*list, int *);
|
||||
|
||||
if (samplerate)
|
||||
*samplerate = obj->samplerate;
|
||||
return obj->samplerate;;
|
||||
}
|
||||
|
||||
static void _channels_set(Eo *eo_obj EINA_UNUSED, void *_pd, va_list *list)
|
||||
EOLIAN static void
|
||||
_ecore_audio_in_channels_set(Eo *eo_obj EINA_UNUSED, Ecore_Audio_Input *obj, int channels)
|
||||
{
|
||||
Ecore_Audio_Input *obj = _pd;
|
||||
|
||||
int channels = va_arg(*list, int);
|
||||
|
||||
obj->channels = channels;
|
||||
|
||||
/* TODO: Notify output */
|
||||
|
||||
}
|
||||
|
||||
static void _channels_get(Eo *eo_obj EINA_UNUSED, void *_pd, va_list *list)
|
||||
EOLIAN static int
|
||||
_ecore_audio_in_channels_get(Eo *eo_obj EINA_UNUSED, Ecore_Audio_Input *obj)
|
||||
{
|
||||
const Ecore_Audio_Input *obj = _pd;
|
||||
|
||||
int *channels = va_arg(*list, int *);
|
||||
|
||||
if (channels)
|
||||
*channels = obj->channels;
|
||||
return obj->channels;
|
||||
}
|
||||
|
||||
static void _looped_set(Eo *eo_obj EINA_UNUSED, void *_pd, va_list *list)
|
||||
EOLIAN static void
|
||||
_ecore_audio_in_looped_set(Eo *eo_obj EINA_UNUSED, Ecore_Audio_Input *obj, Eina_Bool looped)
|
||||
{
|
||||
Ecore_Audio_Input *obj = _pd;
|
||||
|
||||
Eina_Bool looped = va_arg(*list, int);
|
||||
|
||||
obj->looped = looped;
|
||||
}
|
||||
|
||||
static void _looped_get(Eo *eo_obj EINA_UNUSED, void *_pd, va_list *list)
|
||||
EOLIAN static Eina_Bool
|
||||
_ecore_audio_in_looped_get(Eo *eo_obj EINA_UNUSED, Ecore_Audio_Input *obj)
|
||||
{
|
||||
const Ecore_Audio_Input *obj = _pd;
|
||||
|
||||
Eina_Bool *ret = va_arg(*list, Eina_Bool *);
|
||||
|
||||
if (ret)
|
||||
*ret = obj->looped;
|
||||
return obj->looped;
|
||||
}
|
||||
|
||||
static void _length_get(Eo *eo_obj EINA_UNUSED, void *_pd, va_list *list)
|
||||
EOLIAN static double
|
||||
_ecore_audio_in_length_get(Eo *eo_obj EINA_UNUSED, Ecore_Audio_Input *obj)
|
||||
{
|
||||
const Ecore_Audio_Input *obj = _pd;
|
||||
|
||||
double *ret = va_arg(*list, double *);
|
||||
|
||||
if (ret) {
|
||||
*ret = obj->length;
|
||||
}
|
||||
return obj->length;;
|
||||
}
|
||||
|
||||
static void _remaining_get(Eo *eo_obj, void *_pd, va_list *list)
|
||||
EOLIAN static double
|
||||
_ecore_audio_in_remaining_get(Eo *eo_obj, Ecore_Audio_Input *obj)
|
||||
{
|
||||
const Ecore_Audio_Input *obj = _pd;
|
||||
|
||||
double *ret = va_arg(*list, double *);
|
||||
|
||||
if (!obj->seekable && ret) {
|
||||
*ret = -1;
|
||||
} else if (ret) {
|
||||
eo_do(eo_obj, ecore_audio_obj_in_seek(0, SEEK_CUR, ret));
|
||||
*ret = obj->length - *ret;
|
||||
if (!obj->seekable) return -1;
|
||||
else {
|
||||
double ret;
|
||||
eo_do(eo_obj, ecore_audio_obj_in_seek(0, SEEK_CUR, &ret));
|
||||
return obj->length - ret;
|
||||
}
|
||||
}
|
||||
|
||||
static void _in_read(Eo *eo_obj, void *_pd, va_list *list)
|
||||
EOLIAN static ssize_t
|
||||
_ecore_audio_in_read(Eo *eo_obj, Ecore_Audio_Input *obj, void *buf, size_t len)
|
||||
{
|
||||
const Ecore_Audio_Input *obj = _pd;
|
||||
ssize_t len_read = 0;
|
||||
const Ecore_Audio_Object *ea_obj = eo_data_scope_get(eo_obj, ECORE_AUDIO_OBJ_CLASS);
|
||||
|
||||
void *buf = va_arg(*list, void *);
|
||||
size_t len = va_arg(*list, size_t);
|
||||
ssize_t *ret = va_arg(*list, ssize_t *);
|
||||
|
||||
if (ea_obj->paused) {
|
||||
memset(buf, 0, len);
|
||||
len_read = len;
|
||||
|
@ -156,45 +107,36 @@ static void _in_read(Eo *eo_obj, void *_pd, va_list *list)
|
|||
eo_do(eo_obj, ecore_audio_obj_in_read_internal(buf, len, &len_read));
|
||||
if (len_read == 0) {
|
||||
if (!obj->looped || !obj->seekable) {
|
||||
eo_do(eo_obj, eo_event_callback_call(ECORE_AUDIO_EV_IN_STOPPED, NULL, NULL));
|
||||
eo_do(eo_obj, eo_event_callback_call(ECORE_AUDIO_IN_EVENT_IN_STOPPED, NULL, NULL));
|
||||
} else {
|
||||
eo_do(eo_obj, ecore_audio_obj_in_seek(0, SEEK_SET, NULL));
|
||||
eo_do(eo_obj, ecore_audio_obj_in_read_internal(buf, len, &len_read));
|
||||
eo_do(eo_obj, eo_event_callback_call(ECORE_AUDIO_EV_IN_LOOPED, NULL, NULL));
|
||||
eo_do(eo_obj, eo_event_callback_call(ECORE_AUDIO_IN_EVENT_IN_LOOPED, NULL, NULL));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (ret)
|
||||
*ret = len_read;
|
||||
return len_read;
|
||||
}
|
||||
|
||||
static void _read_internal(Eo *eo_obj, void *_pd EINA_UNUSED, va_list *list)
|
||||
EOLIAN static ssize_t
|
||||
_ecore_audio_in_read_internal(Eo *eo_obj, Ecore_Audio_Input *_pd EINA_UNUSED, void *buf, size_t len)
|
||||
{
|
||||
ssize_t len_read = 0;
|
||||
const Ecore_Audio_Object *ea_obj = eo_data_scope_get(eo_obj, ECORE_AUDIO_OBJ_CLASS);
|
||||
|
||||
void *buf = va_arg(*list, void *);
|
||||
size_t len = va_arg(*list, size_t);
|
||||
ssize_t *ret = va_arg(*list, ssize_t *);
|
||||
|
||||
if (ea_obj->vio && ea_obj->vio->vio->read) {
|
||||
len_read = ea_obj->vio->vio->read(ea_obj->vio->data, eo_obj, buf, len);
|
||||
}
|
||||
|
||||
if (ret)
|
||||
*ret = len_read;
|
||||
return len_read;
|
||||
}
|
||||
|
||||
static void _output_get(Eo *eo_obj EINA_UNUSED, void *_pd, va_list *list)
|
||||
EOLIAN static Eo*
|
||||
_ecore_audio_in_output_get(Eo *eo_obj EINA_UNUSED, Ecore_Audio_Input *obj)
|
||||
{
|
||||
const Ecore_Audio_Input *obj = _pd;
|
||||
|
||||
Eo **ret = va_arg(*list, Eo **);
|
||||
|
||||
if (ret)
|
||||
*ret = obj->output;
|
||||
return obj->output;
|
||||
}
|
||||
|
||||
static void _free_vio(Ecore_Audio_Object *ea_obj)
|
||||
|
@ -206,15 +148,11 @@ static void _free_vio(Ecore_Audio_Object *ea_obj)
|
|||
ea_obj->vio = NULL;
|
||||
}
|
||||
|
||||
static void _vio_set(Eo *eo_obj, void *_pd, va_list *list)
|
||||
EOLIAN static void
|
||||
_ecore_audio_in_ecore_audio_vio_set(Eo *eo_obj, Ecore_Audio_Input *obj, Ecore_Audio_Vio *vio, void *data, eo_base_data_free_func free_func)
|
||||
{
|
||||
Ecore_Audio_Input *obj = _pd;
|
||||
Ecore_Audio_Object *ea_obj = eo_data_scope_get(eo_obj, ECORE_AUDIO_OBJ_CLASS);
|
||||
|
||||
Ecore_Audio_Vio *vio = va_arg(*list, Ecore_Audio_Vio *);
|
||||
void *data = va_arg(*list, Ecore_Audio_Vio *);
|
||||
eo_base_data_free_func free_func = va_arg(*list, eo_base_data_free_func);
|
||||
|
||||
if (ea_obj->vio)
|
||||
_free_vio(ea_obj);
|
||||
|
||||
|
@ -232,95 +170,21 @@ static void _vio_set(Eo *eo_obj, void *_pd, va_list *list)
|
|||
obj->seekable = (vio->seek != NULL);
|
||||
}
|
||||
|
||||
static void _constructor(Eo *eo_obj, void *_pd, va_list *list EINA_UNUSED)
|
||||
EOLIAN static void
|
||||
_ecore_audio_in_eo_base_constructor(Eo *eo_obj, Ecore_Audio_Input *obj)
|
||||
{
|
||||
Ecore_Audio_Input *obj = _pd;
|
||||
|
||||
eo_do_super(eo_obj, MY_CLASS, eo_constructor());
|
||||
|
||||
obj->speed = 1.0;
|
||||
}
|
||||
|
||||
static void _destructor(Eo *eo_obj, void *_pd, va_list *list EINA_UNUSED)
|
||||
EOLIAN static void
|
||||
_ecore_audio_in_eo_base_destructor(Eo *eo_obj, Ecore_Audio_Input *obj)
|
||||
{
|
||||
Ecore_Audio_Input *obj = _pd;
|
||||
|
||||
if(obj->output)
|
||||
eo_do(obj->output, ecore_audio_obj_out_input_detach(eo_obj, NULL));
|
||||
|
||||
eo_do_super(eo_obj, MY_CLASS, eo_destructor());
|
||||
}
|
||||
|
||||
static void _class_constructor(Eo_Class *klass)
|
||||
{
|
||||
const Eo_Op_Func_Description func_desc[] = {
|
||||
/* Virtual functions of parent class implemented in this class */
|
||||
EO_OP_FUNC(EO_BASE_ID(EO_BASE_SUB_ID_CONSTRUCTOR), _constructor),
|
||||
EO_OP_FUNC(EO_BASE_ID(EO_BASE_SUB_ID_DESTRUCTOR), _destructor),
|
||||
|
||||
EO_OP_FUNC(ECORE_AUDIO_OBJ_ID(ECORE_AUDIO_OBJ_SUB_ID_VIO_SET), _vio_set),
|
||||
|
||||
/* Specific functions to this class */
|
||||
EO_OP_FUNC(ECORE_AUDIO_OBJ_IN_ID(ECORE_AUDIO_OBJ_IN_SUB_ID_SPEED_SET), _speed_set),
|
||||
EO_OP_FUNC(ECORE_AUDIO_OBJ_IN_ID(ECORE_AUDIO_OBJ_IN_SUB_ID_SPEED_GET), _speed_get),
|
||||
EO_OP_FUNC(ECORE_AUDIO_OBJ_IN_ID(ECORE_AUDIO_OBJ_IN_SUB_ID_SAMPLERATE_SET), _samplerate_set),
|
||||
EO_OP_FUNC(ECORE_AUDIO_OBJ_IN_ID(ECORE_AUDIO_OBJ_IN_SUB_ID_SAMPLERATE_GET), _samplerate_get),
|
||||
EO_OP_FUNC(ECORE_AUDIO_OBJ_IN_ID(ECORE_AUDIO_OBJ_IN_SUB_ID_CHANNELS_SET), _channels_set),
|
||||
EO_OP_FUNC(ECORE_AUDIO_OBJ_IN_ID(ECORE_AUDIO_OBJ_IN_SUB_ID_CHANNELS_GET), _channels_get),
|
||||
EO_OP_FUNC(ECORE_AUDIO_OBJ_IN_ID(ECORE_AUDIO_OBJ_IN_SUB_ID_LOOPED_SET), _looped_set),
|
||||
EO_OP_FUNC(ECORE_AUDIO_OBJ_IN_ID(ECORE_AUDIO_OBJ_IN_SUB_ID_LOOPED_GET), _looped_get),
|
||||
EO_OP_FUNC(ECORE_AUDIO_OBJ_IN_ID(ECORE_AUDIO_OBJ_IN_SUB_ID_LENGTH_GET), _length_get),
|
||||
EO_OP_FUNC(ECORE_AUDIO_OBJ_IN_ID(ECORE_AUDIO_OBJ_IN_SUB_ID_REMAINING_GET), _remaining_get),
|
||||
EO_OP_FUNC(ECORE_AUDIO_OBJ_IN_ID(ECORE_AUDIO_OBJ_IN_SUB_ID_READ), _in_read),
|
||||
EO_OP_FUNC(ECORE_AUDIO_OBJ_IN_ID(ECORE_AUDIO_OBJ_IN_SUB_ID_READ_INTERNAL), _read_internal),
|
||||
EO_OP_FUNC(ECORE_AUDIO_OBJ_IN_ID(ECORE_AUDIO_OBJ_IN_SUB_ID_OUTPUT_GET), _output_get),
|
||||
|
||||
EO_OP_FUNC_SENTINEL
|
||||
};
|
||||
|
||||
eo_class_funcs_set(klass, func_desc);
|
||||
}
|
||||
|
||||
#define S(val) "Sets the " #val " of the input."
|
||||
#define G(val) "Gets the " #val " of the input."
|
||||
|
||||
static const Eo_Op_Description op_desc[] = {
|
||||
EO_OP_DESCRIPTION(ECORE_AUDIO_OBJ_IN_SUB_ID_SPEED_SET, S(speed)),
|
||||
EO_OP_DESCRIPTION(ECORE_AUDIO_OBJ_IN_SUB_ID_SPEED_GET, G(speed)),
|
||||
EO_OP_DESCRIPTION(ECORE_AUDIO_OBJ_IN_SUB_ID_SAMPLERATE_SET, S(samplerate)),
|
||||
EO_OP_DESCRIPTION(ECORE_AUDIO_OBJ_IN_SUB_ID_SAMPLERATE_GET, G(samplerate)),
|
||||
EO_OP_DESCRIPTION(ECORE_AUDIO_OBJ_IN_SUB_ID_CHANNELS_SET, S(channels)),
|
||||
EO_OP_DESCRIPTION(ECORE_AUDIO_OBJ_IN_SUB_ID_CHANNELS_GET, G(channels)),
|
||||
EO_OP_DESCRIPTION(ECORE_AUDIO_OBJ_IN_SUB_ID_PRELOADED_SET, S(preloaded)),
|
||||
EO_OP_DESCRIPTION(ECORE_AUDIO_OBJ_IN_SUB_ID_PRELOADED_GET, G(preloaded)),
|
||||
EO_OP_DESCRIPTION(ECORE_AUDIO_OBJ_IN_SUB_ID_LOOPED_SET, S(looped)),
|
||||
EO_OP_DESCRIPTION(ECORE_AUDIO_OBJ_IN_SUB_ID_LOOPED_GET, G(looped)),
|
||||
EO_OP_DESCRIPTION(ECORE_AUDIO_OBJ_IN_SUB_ID_LENGTH_SET, S(length)),
|
||||
EO_OP_DESCRIPTION(ECORE_AUDIO_OBJ_IN_SUB_ID_LENGTH_GET, G(length)),
|
||||
EO_OP_DESCRIPTION(ECORE_AUDIO_OBJ_IN_SUB_ID_READ, "Read from the input"),
|
||||
EO_OP_DESCRIPTION(ECORE_AUDIO_OBJ_IN_SUB_ID_READ_INTERNAL, "Internal implementation for the read"),
|
||||
EO_OP_DESCRIPTION(ECORE_AUDIO_OBJ_IN_SUB_ID_SEEK, "Seek within the input"),
|
||||
EO_OP_DESCRIPTION(ECORE_AUDIO_OBJ_IN_SUB_ID_OUTPUT_GET, G(output)),
|
||||
EO_OP_DESCRIPTION(ECORE_AUDIO_OBJ_IN_SUB_ID_REMAINING_GET, G(remaining)),
|
||||
EO_OP_DESCRIPTION_SENTINEL
|
||||
};
|
||||
|
||||
static const Eo_Event_Description *event_desc[] = {
|
||||
ECORE_AUDIO_EV_IN_LOOPED,
|
||||
ECORE_AUDIO_EV_IN_STOPPED,
|
||||
ECORE_AUDIO_EV_IN_SAMPLERATE_CHANGED,
|
||||
NULL
|
||||
};
|
||||
|
||||
static const Eo_Class_Description class_desc = {
|
||||
EO_VERSION,
|
||||
MY_CLASS_NAME,
|
||||
EO_CLASS_TYPE_REGULAR,
|
||||
EO_CLASS_DESCRIPTION_OPS(&ECORE_AUDIO_OBJ_IN_BASE_ID, op_desc, ECORE_AUDIO_OBJ_IN_SUB_ID_LAST),
|
||||
event_desc,
|
||||
sizeof(Ecore_Audio_Input),
|
||||
_class_constructor,
|
||||
NULL
|
||||
};
|
||||
|
||||
EO_DEFINE_CLASS(ecore_audio_obj_in_class_get, &class_desc, ECORE_AUDIO_OBJ_CLASS, NULL);
|
||||
#include "ecore_audio_in.eo.c"
|
||||
|
|
|
@ -33,6 +33,8 @@ extern "C"
|
|||
* @ingroup Ecore_Audio_Group
|
||||
* @{
|
||||
*/
|
||||
#include "ecore_audio_in.eo.h"
|
||||
#if 0
|
||||
|
||||
#define ECORE_AUDIO_OBJ_IN_CLASS ecore_audio_obj_in_class_get() /**< Ecore_Audio input object class */
|
||||
|
||||
|
@ -265,6 +267,7 @@ extern const Eo_Event_Description _ECORE_AUDIO_EV_IN_SAMPLERATE_CHANGED;
|
|||
*/
|
||||
#define ECORE_AUDIO_EV_IN_SAMPLERATE_CHANGED (&(_ECORE_AUDIO_EV_IN_SAMPLERATE_CHANGED))
|
||||
|
||||
#endif
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
@ -274,4 +277,3 @@ extern const Eo_Event_Description _ECORE_AUDIO_EV_IN_SAMPLERATE_CHANGED;
|
|||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
|
|
|
@ -141,7 +141,7 @@ static Eina_Bool _input_attach_internal(Eo *eo_obj, Eo *in)
|
|||
return EINA_FALSE;
|
||||
}
|
||||
|
||||
eo_do(in, eo_event_callback_add(ECORE_AUDIO_EV_IN_SAMPLERATE_CHANGED, _update_samplerate_cb, eo_obj));
|
||||
eo_do(in, eo_event_callback_add(ECORE_AUDIO_IN_EVENT_IN_SAMPLERATE_CHANGED, _update_samplerate_cb, eo_obj));
|
||||
|
||||
eo_do(in, eo_base_data_set("pulse_data", stream, NULL));
|
||||
|
||||
|
|
|
@ -5,6 +5,4 @@
|
|||
#include "Ecore.h"
|
||||
#include "Ecore_Audio.h"
|
||||
|
||||
#define ecore_audio_obj_in_read_internal(buf, len, ret) ECORE_AUDIO_OBJ_IN_ID(ECORE_AUDIO_OBJ_IN_SUB_ID_READ_INTERNAL), EO_TYPECHECK(void *, buf), EO_TYPECHECK(size_t, len), EO_TYPECHECK(ssize_t *, ret)
|
||||
|
||||
#endif
|
||||
|
|
|
@ -76,7 +76,7 @@ START_TEST(ecore_test_ecore_audio_obj_pulse)
|
|||
|
||||
ecore_timer_add(0.3, _seek_vol, in);
|
||||
|
||||
eo_do(in, eo_event_callback_add(ECORE_AUDIO_EV_IN_STOPPED, _finished_cb, NULL));
|
||||
eo_do(in, eo_event_callback_add(ECORE_AUDIO_IN_EVENT_IN_STOPPED, _finished_cb, NULL));
|
||||
eo_do(out, eo_event_callback_add(ECORE_AUDIO_EV_OUT_PULSE_CONTEXT_FAIL, _failed_cb, &pulse_context_failed));
|
||||
|
||||
eo_do(out, ecore_audio_obj_out_input_attach(in, &ret));
|
||||
|
@ -215,8 +215,8 @@ START_TEST(ecore_test_ecore_audio_obj_tone)
|
|||
eo_do(out, ecore_audio_obj_out_input_attach(in, &ret));
|
||||
fail_if(!ret);
|
||||
|
||||
eo_do(in, eo_event_callback_add(ECORE_AUDIO_EV_IN_LOOPED, _looped_cb, NULL));
|
||||
eo_do(in, eo_event_callback_add(ECORE_AUDIO_EV_IN_STOPPED, _finished_cb, NULL));
|
||||
eo_do(in, eo_event_callback_add(ECORE_AUDIO_IN_EVENT_IN_LOOPED, _looped_cb, NULL));
|
||||
eo_do(in, eo_event_callback_add(ECORE_AUDIO_IN_EVENT_IN_STOPPED, _finished_cb, NULL));
|
||||
|
||||
ecore_main_loop_begin();
|
||||
|
||||
|
@ -306,7 +306,7 @@ START_TEST(ecore_test_ecore_audio_obj_sndfile)
|
|||
eo_do(out, ecore_audio_obj_out_input_attach(in, &ret));
|
||||
fail_if(!ret);
|
||||
|
||||
eo_do(in, eo_event_callback_add(ECORE_AUDIO_EV_IN_STOPPED, _finished_cb, NULL));
|
||||
eo_do(in, eo_event_callback_add(ECORE_AUDIO_IN_EVENT_IN_STOPPED, _finished_cb, NULL));
|
||||
|
||||
ecore_main_loop_begin();
|
||||
|
||||
|
|
Loading…
Reference in New Issue