summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/xas/seq.h15
-rw-r--r--src/seq.c70
2 files changed, 84 insertions, 1 deletions
diff --git a/include/xas/seq.h b/include/xas/seq.h
index 3aece2f..a604d31 100644
--- a/include/xas/seq.h
+++ b/include/xas/seq.h
@@ -5,6 +5,7 @@
#include <sys/time.h>
#include <xas/audio.h>
+#include <xas/synth.h>
#include <xas/spatial.h>
enum xas_seq_event_type {
@@ -15,7 +16,9 @@ enum xas_seq_event_type {
XAS_SEQ_EVENT_SET_SPEED,
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_PLAYER_FLAGS,
XAS_SEQ_EVENT_SPEECH
};
@@ -41,8 +44,10 @@ struct _xas_seq_event {
xas_spatial_coord heading;
float speed;
float gain;
+ int flags;
size_t index;
size_t frequency;
+ enum xas_synth_type synth_type;
const char *phrase;
};
@@ -94,6 +99,16 @@ int xas_seq_add_set_bank(xas_seq *seq,
struct timeval timestamp,
size_t index);
+int xas_seq_add_set_player_flags(xas_seq *seq,
+ xas_spatial_object *object,
+ struct timeval timestamp,
+ int flags);
+
+int xas_seq_add_set_synth_type(xas_seq *seq,
+ xas_spatial_object *object,
+ struct timeval timestamp,
+ enum xas_synth_type type);
+
int xas_seq_add_set_frequency(xas_seq *seq,
xas_spatial_object *object,
struct timeval timestamp,
diff --git a/src/seq.c b/src/seq.c
index ba9046c..d6940f0 100644
--- a/src/seq.c
+++ b/src/seq.c
@@ -239,6 +239,56 @@ error_malloc_ev:
return -1;
}
+int xas_seq_add_set_player_flags(xas_seq *seq,
+ xas_spatial_object *object,
+ struct timeval timestamp,
+ int flags) {
+ xas_seq_event *ev;
+
+ if ((ev = malloc(sizeof(*ev))) == NULL) {
+ goto error_malloc_ev;
+ }
+
+ ev->type = XAS_SEQ_EVENT_SET_PLAYER_FLAGS;
+ ev->objtype = XAS_SEQ_OBJECT_BANK_PLAYER;
+ ev->object = object;
+ ev->timestamp = timestamp;
+ ev->next = NULL;
+ ev->flags = flags;
+
+ add_event(seq, ev);
+
+ return 0;
+
+error_malloc_ev:
+ return -1;
+}
+
+int xas_seq_add_set_synth_type(xas_seq *seq,
+ xas_spatial_object *object,
+ struct timeval timestamp,
+ enum xas_synth_type type) {
+ xas_seq_event *ev;
+
+ if ((ev = malloc(sizeof(*ev))) == NULL) {
+ goto error_malloc_ev;
+ }
+
+ ev->type = XAS_SEQ_EVENT_SET_FREQUENCY;
+ ev->objtype = XAS_SEQ_OBJECT_SYNTH;
+ ev->object = object;
+ ev->timestamp = timestamp;
+ ev->next = NULL;
+ ev->synth_type = type;
+
+ add_event(seq, ev);
+
+ return 0;
+
+error_malloc_ev:
+ return -1;
+}
+
int xas_seq_add_set_frequency(xas_seq *seq,
xas_spatial_object *object,
struct timeval timestamp,
@@ -328,12 +378,30 @@ static int event_trigger(xas_spatial_scene *scene, xas_seq_event *ev) {
break;
+ case XAS_SEQ_EVENT_SET_SYNTH_TYPE:
+ if (ev->objtype != XAS_SEQ_OBJECT_SYNTH) {
+ goto error_invalid_event;
+ }
+
+ xas_synth_set_type(ev->object->ctx, ev->synth_type);
+
+ break;
+
case XAS_SEQ_EVENT_SET_BANK_INDEX:
if (ev->objtype != XAS_SEQ_OBJECT_BANK_PLAYER) {
goto error_invalid_event;
}
- xas_bank_player_set_entry(ev->object->ctx, ev->gain);
+ xas_bank_player_set_entry(ev->object->ctx, ev->index);
+
+ break;
+
+ case XAS_SEQ_EVENT_SET_PLAYER_FLAGS:
+ if (ev->objtype != XAS_SEQ_OBJECT_BANK_PLAYER) {
+ goto error_invalid_event;
+ }
+
+ xas_bank_player_set_flags(ev->object->ctx, ev->flags);
break;