summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorXANTRONIX Development2022-03-16 02:06:58 -0400
committerXANTRONIX Development2022-03-16 02:06:58 -0400
commit7fa5732cfb273056d72ee23449bdc317a1a310a8 (patch)
tree803568ba54878ffe73330c892ae2dda0bb3e1081 /src
parent80126af5ddf57c7404eb1a17b6dbc44314ac133f (diff)
downloadxas-7fa5732cfb273056d72ee23449bdc317a1a310a8.tar.gz
xas-7fa5732cfb273056d72ee23449bdc317a1a310a8.tar.bz2
xas-7fa5732cfb273056d72ee23449bdc317a1a310a8.zip
Add index argument to bank entry change events
Diffstat (limited to 'src')
-rw-r--r--src/bank.c5
-rw-r--r--src/object.c4
-rw-r--r--src/seq.c16
3 files changed, 16 insertions, 9 deletions
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;