diff options
author | XANTRONIX Development | 2022-03-06 20:13:31 -0500 |
---|---|---|
committer | XANTRONIX Development | 2022-03-06 20:16:05 -0500 |
commit | 64b0b6322bfe2d055346f2a5b150f4023ba447d0 (patch) | |
tree | b51eb23c199b5e4bafb060aa076918f6f58e4aa7 /src | |
parent | 99057a0f6f7e93db6f2dda2e6d8ffeec20e44307 (diff) | |
download | xas-64b0b6322bfe2d055346f2a5b150f4023ba447d0.tar.gz xas-64b0b6322bfe2d055346f2a5b150f4023ba447d0.tar.bz2 xas-64b0b6322bfe2d055346f2a5b150f4023ba447d0.zip |
Implement sequencing bank flag, synth type changes
Diffstat (limited to 'src')
-rw-r--r-- | src/seq.c | 70 |
1 files changed, 69 insertions, 1 deletions
@@ -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; |