summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/xas/seq.h6
-rw-r--r--src/seq.c30
2 files changed, 35 insertions, 1 deletions
diff --git a/include/xas/seq.h b/include/xas/seq.h
index f7ec322..de8567e 100644
--- a/include/xas/seq.h
+++ b/include/xas/seq.h
@@ -19,7 +19,8 @@ enum xas_seq_event_type {
XAS_SEQ_EVENT_SET_SYNTH_TYPE,
XAS_SEQ_EVENT_SET_BANK_INDEX,
XAS_SEQ_EVENT_SET_PLAYER_FLAGS,
- XAS_SEQ_EVENT_SPEECH
+ XAS_SEQ_EVENT_SPEECH,
+ XAS_SEQ_EVENT_STOP
};
enum xas_seq_object_type {
@@ -120,6 +121,9 @@ int xas_seq_add_phrase(xas_seq *seq,
struct timeval timestamp,
const char *phrase);
+int xas_seq_add_stop(xas_seq *seq,
+ struct timeval timestamp);
+
int xas_seq_play(xas_seq *seq, xas_audio_stream *sink);
#endif /* _XAS_SEQ_H */
diff --git a/src/seq.c b/src/seq.c
index 26e4abe..054b61c 100644
--- a/src/seq.c
+++ b/src/seq.c
@@ -457,6 +457,33 @@ error_malloc_ev:
return -1;
}
+int xas_seq_add_stop(xas_seq *seq,
+ struct timeval timestamp) {
+ xas_seq_event *ev;
+
+ if ((ev = malloc(sizeof(*ev))) == NULL) {
+ goto error_malloc_ev;
+ }
+
+ ev->type = XAS_SEQ_EVENT_STOP;
+ ev->objtype = XAS_SEQ_OBJECT_ANY;
+ ev->object = NULL;
+ ev->timestamp = timestamp;
+ ev->flags = 0;
+
+ if (event_add(seq, ev) < 0) {
+ goto error_event_add;
+ }
+
+ return 0;
+
+error_event_add:
+ free(ev);
+
+error_malloc_ev:
+ return -1;
+}
+
static int event_trigger(xas_spatial_scene *scene, xas_seq_event *ev) {
switch (ev->type) {
case XAS_SEQ_EVENT_OFF:
@@ -532,6 +559,9 @@ static int event_trigger(xas_spatial_scene *scene, xas_seq_event *ev) {
xas_vox_generate(ev->object->ctx);
break;
+
+ case XAS_SEQ_EVENT_STOP:
+ break;
}
return 0;