diff options
Diffstat (limited to 'src/object.c')
-rw-r--r-- | src/object.c | 76 |
1 files changed, 56 insertions, 20 deletions
diff --git a/src/object.c b/src/object.c index 357f115..6e3079b 100644 --- a/src/object.c +++ b/src/object.c @@ -3,82 +3,118 @@ #include <xas/object.h> -void xas_object_init(xas_object *object) { - memset(object, '\0', sizeof(xas_object)); -} - int xas_object_start(xas_object *object, size_t index) { - if (object->start == NULL) { + if (object->table->start == NULL) { errno = ENOSYS; return -1; } - return object->start(object, index); + return object->table->start(object, index); } int xas_object_stop(xas_object *object, size_t index) { - if (object->stop == NULL) { + if (object->table->stop == NULL) { errno = ENOSYS; return -1; } - return object->stop(object, index); + return object->table->stop(object, index); +} + +int xas_object_set_type(xas_object *object, int type) { + if (object->table->set_type == NULL) { + errno = ENOSYS; + + return -1; + } + + return object->table->set_type(object, type); } int xas_object_set_gain(xas_object *object, float gain) { - if (object->set_gain == NULL) { + if (object->table->set_gain == NULL) { errno = ENOSYS; return -1; } - return object->set_gain(object, gain); + return object->table->set_gain(object, gain); } int xas_object_set_entry(xas_object *object, size_t index, size_t entry) { - if (object->set_entry == NULL) { + if (object->table->set_entry == NULL) { errno = ENOSYS; return -1; } - return object->set_entry(object, index, entry); + return object->table->set_entry(object, index, entry); } int xas_object_set_freq(xas_object *object, size_t freq) { - if (object->set_freq == NULL) { + if (object->table->set_freq == NULL) { errno = ENOSYS; return -1; } - return object->set_freq(object, freq); + return object->table->set_freq(object, freq); } int xas_object_set_flags(xas_object *object, int flags) { - if (object->set_flags == NULL) { + if (object->table->set_flags == NULL) { + errno = ENOSYS; + + return -1; + } + + return object->table->set_flags(object, flags); +} + +int xas_object_set_point(xas_object *object, xas_object_coord point) { + if (object->table->set_point == NULL) { + errno = ENOSYS; + + return -1; + } + + return object->table->set_point(object, point); +} + +int xas_object_set_heading(xas_object *object, xas_object_coord heading) { + if (object->table->set_heading == NULL) { + errno = ENOSYS; + + return -1; + } + + return object->table->set_heading(object, heading); +} + +int xas_object_set_speed(xas_object *object, float speed) { + if (object->table->set_speed == NULL) { errno = ENOSYS; return -1; } - return object->set_flags(object, flags); + return object->table->set_speed(object, speed); } xas_audio_stream *xas_object_stream_new(xas_object *object) { - if (object->stream_new == NULL) { + if (object->table->stream_new == NULL) { errno = ENOSYS; return NULL; } - return object->stream_new(object); + return object->table->stream_new(object); } void xas_object_destroy(xas_object *object) { - if (object->destroy) { - object->destroy(object); + if (object->table->destroy) { + object->table->destroy(object); } } |