summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/xas/object.h6
-rw-r--r--include/xas/seq.h14
-rw-r--r--src/bank.c5
-rw-r--r--src/object.c4
-rw-r--r--src/seq.c16
5 files changed, 28 insertions, 17 deletions
diff --git a/include/xas/object.h b/include/xas/object.h
index 1fd3b8c..4d5b754 100644
--- a/include/xas/object.h
+++ b/include/xas/object.h
@@ -13,7 +13,9 @@ typedef int (*xas_object_set_gain_callback)(xas_object *object, float gain);
typedef int (*xas_object_set_freq_callback)(xas_object *object, size_t freq);
-typedef int (*xas_object_set_entry_callback)(xas_object *object, size_t entry);
+typedef int (*xas_object_set_entry_callback)(xas_object *object,
+ size_t index,
+ size_t entry);
typedef int (*xas_object_set_flags_callback)(xas_object *object, int flags);
@@ -40,7 +42,7 @@ int xas_object_stop(xas_object *object, size_t index);
int xas_object_set_gain(xas_object *object, float 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);
int xas_object_set_freq(xas_object *object, size_t freq);
diff --git a/include/xas/seq.h b/include/xas/seq.h
index 05b1919..38b7cf4 100644
--- a/include/xas/seq.h
+++ b/include/xas/seq.h
@@ -15,7 +15,7 @@ enum xas_seq_event_type {
XAS_SEQ_EVENT_SET_GAIN,
XAS_SEQ_EVENT_SET_FREQUENCY,
XAS_SEQ_EVENT_SET_SYNTH_TYPE,
- XAS_SEQ_EVENT_SET_BANK_INDEX,
+ XAS_SEQ_EVENT_SET_BANK_ENTRY,
XAS_SEQ_EVENT_SET_PLAYER_FLAGS,
XAS_SEQ_EVENT_SPEECH,
XAS_SEQ_EVENT_OFF,
@@ -31,6 +31,7 @@ struct _xas_seq_event {
xas_spatial_object *object;
struct timeval timestamp;
+ size_t index;
union {
xas_spatial_coord point;
@@ -38,7 +39,7 @@ struct _xas_seq_event {
float speed;
float gain;
int flags;
- size_t index;
+ size_t entry;
size_t frequency;
enum xas_synth_type synth_type;
const char *phrase;
@@ -90,10 +91,11 @@ int xas_seq_add_set_gain(xas_seq *seq,
struct timeval timestamp,
float gain);
-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);
int xas_seq_add_set_player_flags(xas_seq *seq,
xas_spatial_object *object,
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;