From 7fa5732cfb273056d72ee23449bdc317a1a310a8 Mon Sep 17 00:00:00 2001 From: XANTRONIX Development Date: Wed, 16 Mar 2022 02:06:58 -0400 Subject: Add index argument to bank entry change events --- src/bank.c | 5 +++++ src/object.c | 4 ++-- src/seq.c | 16 +++++++++------- 3 files changed, 16 insertions(+), 9 deletions(-) (limited to 'src') diff --git a/src/bank.c b/src/bank.c index 90ad394..36e1198 100644 --- a/src/bank.c +++ b/src/bank.c @@ -147,6 +147,10 @@ static int set_gain(xas_bank_player *player, float gain) { return 0; } +static int set_entry(xas_bank_player *player, size_t index, size_t entry) { + return xas_bank_player_set_entry(player, entry); +} + xas_bank_player *xas_bank_player_new(xas_bank *bank) { xas_bank_player *player; @@ -159,6 +163,7 @@ xas_bank_player *xas_bank_player_new(xas_bank *bank) { player->obj.start = (xas_object_start_callback)player_start; player->obj.stop = (xas_object_stop_callback)player_stop; player->obj.set_gain = (xas_object_set_gain_callback)set_gain; + player->obj.set_entry = (xas_object_set_entry_callback)set_entry; player->obj.stream_new = (xas_object_stream_new_callback)xas_bank_player_stream_new; player->obj.destroy = (xas_object_destroy_callback)xas_bank_player_destroy; diff --git a/src/object.c b/src/object.c index 39a1edb..357f115 100644 --- a/src/object.c +++ b/src/object.c @@ -37,14 +37,14 @@ int xas_object_set_gain(xas_object *object, float gain) { return object->set_gain(object, gain); } -int xas_object_set_entry(xas_object *object, size_t entry) { +int xas_object_set_entry(xas_object *object, size_t index, size_t entry) { if (object->set_entry == NULL) { errno = ENOSYS; return -1; } - return object->set_entry(object, entry); + return object->set_entry(object, index, entry); } int xas_object_set_freq(xas_object *object, size_t freq) { diff --git a/src/seq.c b/src/seq.c index 6059d19..63be43f 100644 --- a/src/seq.c +++ b/src/seq.c @@ -324,20 +324,22 @@ error_malloc_ev: return -1; } -int xas_seq_add_set_bank(xas_seq *seq, - xas_spatial_object *object, - struct timeval timestamp, - size_t index) { +int xas_seq_add_set_bank_entry(xas_seq *seq, + xas_spatial_object *object, + struct timeval timestamp, + size_t index, + size_t entry) { xas_seq_event *ev; if ((ev = malloc(sizeof(*ev))) == NULL) { goto error_malloc_ev; } - ev->type = XAS_SEQ_EVENT_SET_BANK_INDEX; + ev->type = XAS_SEQ_EVENT_SET_BANK_ENTRY; ev->object = object; ev->timestamp = timestamp; ev->index = index; + ev->entry = entry; if (event_add(seq, ev) < 0) { goto error_event_add; @@ -530,8 +532,8 @@ static int event_trigger(xas_spatial_scene *scene, xas_seq_event *ev) { break; - case XAS_SEQ_EVENT_SET_BANK_INDEX: - xas_object_set_entry(ev->object->ctx, ev->index); + case XAS_SEQ_EVENT_SET_BANK_ENTRY: + xas_object_set_entry(ev->object->ctx, ev->index, ev->entry); break; -- cgit v1.2.3