diff options
author | XANTRONIX Development | 2022-03-17 16:03:47 -0400 |
---|---|---|
committer | XANTRONIX Development | 2022-03-17 16:03:47 -0400 |
commit | 98bd0541b19dd44a599bd599ed7ac57c0fcdc873 (patch) | |
tree | c7e38706fa4c14941ee92ba2b757d3768ac70877 /include/xas | |
parent | d685f7a7c3f1abcc402e1ac8b808f2ccd16708ad (diff) | |
download | xas-98bd0541b19dd44a599bd599ed7ac57c0fcdc873.tar.gz xas-98bd0541b19dd44a599bd599ed7ac57c0fcdc873.tar.bz2 xas-98bd0541b19dd44a599bd599ed7ac57c0fcdc873.zip |
Refactor sequencer to use generic objects
Changes:
* Make most xas_object methods accept an 'index' argument
* Make most event sequence functions in src/seq.c use xas_object
generically
Diffstat (limited to 'include/xas')
-rw-r--r-- | include/xas/object.h | 40 | ||||
-rw-r--r-- | include/xas/seq.h | 43 |
2 files changed, 54 insertions, 29 deletions
diff --git a/include/xas/object.h b/include/xas/object.h index 64d645b..86e86ec 100644 --- a/include/xas/object.h +++ b/include/xas/object.h @@ -13,25 +13,37 @@ typedef int (*xas_object_start_callback)(xas_object *object, size_t index); typedef int (*xas_object_stop_callback)(xas_object *object, size_t index); -typedef int (*xas_object_set_type_callback)(xas_object *object, int type); +typedef int (*xas_object_set_type_callback)(xas_object *object, + size_t index, + int type); -typedef int (*xas_object_set_gain_callback)(xas_object *object, float gain); +typedef int (*xas_object_set_gain_callback)(xas_object *object, + size_t index, + float gain); -typedef int (*xas_object_set_freq_callback)(xas_object *object, size_t freq); +typedef int (*xas_object_set_freq_callback)(xas_object *object, + size_t index, + size_t freq); 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); +typedef int (*xas_object_set_flags_callback)(xas_object *object, + size_t index, + int flags); typedef int (*xas_object_set_point_callback)(xas_object *object, + size_t index, xas_object_coord point); typedef int (*xas_object_set_heading_callback)(xas_object *object, + size_t index, xas_object_coord heading); -typedef int (*xas_object_set_speed_callback)(xas_object *object, float speed); +typedef int (*xas_object_set_speed_callback)(xas_object *object, + size_t index, + float speed); typedef xas_audio_stream *(*xas_object_stream_new_callback)(xas_object *object); @@ -60,21 +72,25 @@ int xas_object_start(xas_object *object, size_t index); int xas_object_stop(xas_object *object, size_t index); -int xas_object_set_type(xas_object *object, int type); +int xas_object_set_type(xas_object *object, size_t index, int type); -int xas_object_set_gain(xas_object *object, float gain); +int xas_object_set_gain(xas_object *object, size_t index, float gain); 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); +int xas_object_set_freq(xas_object *object, size_t index, size_t freq); -int xas_object_set_flags(xas_object *object, int flags); +int xas_object_set_flags(xas_object *object, size_t index, int flags); -int xas_object_set_point(xas_object *object, xas_object_coord point); +int xas_object_set_point(xas_object *object, + size_t index, + xas_object_coord point); -int xas_object_set_heading(xas_object *object, xas_object_coord heading); +int xas_object_set_heading(xas_object *object, + size_t index, + xas_object_coord heading); -int xas_object_set_speed(xas_object *object, float speed); +int xas_object_set_speed(xas_object *object, size_t index, float speed); xas_audio_stream *xas_object_stream_new(xas_object *object); diff --git a/include/xas/seq.h b/include/xas/seq.h index 1562e03..124af96 100644 --- a/include/xas/seq.h +++ b/include/xas/seq.h @@ -14,9 +14,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_ENTRY, - XAS_SEQ_EVENT_SET_PLAYER_FLAGS, + XAS_SEQ_EVENT_SET_TYPE, + XAS_SEQ_EVENT_SET_ENTRY, + XAS_SEQ_EVENT_SET_FLAGS, XAS_SEQ_EVENT_SPEECH, XAS_SEQ_EVENT_OFF, XAS_SEQ_EVENT_ON, @@ -39,9 +39,9 @@ struct _xas_seq_event { float speed; float gain; int flags; + int value; size_t entry; size_t frequency; - enum xas_synth_type synth_type; const char *phrase; }; @@ -86,30 +86,39 @@ int xas_seq_add_set_speed(xas_seq *seq, struct timeval timestamp, float speed); +int xas_seq_add_set_type(xas_seq *seq, + xas_object *object, + struct timeval timestamp, + size_t index, + int type); + int xas_seq_add_set_gain(xas_seq *seq, xas_object *object, struct timeval timestamp, float gain); -int xas_seq_add_set_bank_entry(xas_seq *seq, - xas_object *object, - struct timeval timestamp, - size_t index, - size_t entry); +int xas_seq_add_set_entry(xas_seq *seq, + xas_object *object, + struct timeval timestamp, + size_t index, + size_t entry); -int xas_seq_add_set_player_flags(xas_seq *seq, - xas_object *object, - struct timeval timestamp, - int flags); +int xas_seq_add_set_flags(xas_seq *seq, + xas_object *object, + struct timeval timestamp, + size_t index, + int flags); -int xas_seq_add_set_synth_type(xas_seq *seq, - xas_object *object, - struct timeval timestamp, - enum xas_synth_type type); +int xas_seq_add_set_type(xas_seq *seq, + xas_object *object, + struct timeval timestamp, + size_t index, + int type); int xas_seq_add_set_frequency(xas_seq *seq, xas_object *object, struct timeval timestamp, + size_t index, size_t frequency); int xas_seq_add_phrase(xas_seq *seq, |