summaryrefslogtreecommitdiffstats
path: root/include/xas
diff options
context:
space:
mode:
authorXANTRONIX Development2022-02-28 09:36:13 -0500
committerXANTRONIX Development2022-02-28 09:36:13 -0500
commit3c6872ccab4dcddc6ab6df7d17df3394964a6e46 (patch)
tree09c87dbd146f9c2aed4338fc0751f770743d3a45 /include/xas
parent89a2e977336e544f170e682a48e3b361e86e3fa9 (diff)
downloadxas-3c6872ccab4dcddc6ab6df7d17df3394964a6e46.tar.gz
xas-3c6872ccab4dcddc6ab6df7d17df3394964a6e46.tar.bz2
xas-3c6872ccab4dcddc6ab6df7d17df3394964a6e46.zip
Initial implementation of src/script.c
Diffstat (limited to 'include/xas')
-rw-r--r--include/xas/script.h86
1 files changed, 86 insertions, 0 deletions
diff --git a/include/xas/script.h b/include/xas/script.h
new file mode 100644
index 0000000..102d421
--- /dev/null
+++ b/include/xas/script.h
@@ -0,0 +1,86 @@
+#ifndef _XAS_SCRIPT_H
+#define _XAS_SCRIPT_H
+
+#include <sys/types.h>
+#include <sys/time.h>
+
+#include <xas/audio.h>
+#include <xas/vox.h>
+#include <xas/bank.h>
+#include <xas/synth.h>
+#include <xas/spatial.h>
+
+enum xas_script_event_type {
+ XAS_SCRIPT_EVENT_OFF,
+ XAS_SCRIPT_EVENT_ON,
+ XAS_SCRIPT_EVENT_SET_POSITION,
+ XAS_SCRIPT_EVENT_SET_GAIN,
+ XAS_SCRIPT_EVENT_SET_BANK_INDEX,
+ XAS_SCRIPT_EVENT_SET_FREQUENCY
+};
+
+typedef struct _xas_script_event xas_script_event;
+
+struct _xas_script_event {
+ enum xas_script_event_type type;
+
+ xas_spatial_object *object;
+
+ struct timeval timestamp;
+
+ union {
+ float gain;
+ xas_spatial_coord point;
+ size_t index;
+ size_t frequency;
+ };
+
+ xas_script_event *next;
+};
+
+typedef struct _xas_script {
+ xas_spatial_scene *scene;
+
+ xas_script_event *first;
+
+ struct timeval timestamp;
+
+ size_t buffer_size,
+ current_index;
+} xas_script;
+
+xas_script *xas_script_new(xas_spatial_scene *scene, size_t buffer_size);
+
+void xas_script_destroy(xas_script *script);
+
+int xas_script_add_event_off(xas_script *script,
+ xas_spatial_object *object,
+ struct timeval timestamp);
+
+int xas_script_add_event_on(xas_script *script,
+ xas_spatial_object *object,
+ struct timeval timestamp);
+
+int xas_script_add_position_set(xas_script *script,
+ xas_spatial_object *object,
+ struct timeval timestamp,
+ xas_spatial_coord point);
+
+int xas_script_add_gain_set(xas_script *script,
+ xas_spatial_object *object,
+ struct timeval timestamp,
+ float gain);
+
+int xas_script_add_bank_set(xas_script *script,
+ xas_spatial_object *object,
+ struct timeval timestamp,
+ size_t index);
+
+int xas_script_add_frequency_set(xas_script *script,
+ xas_spatial_object *object,
+ struct timeval timestamp,
+ size_t frequency);
+
+int xas_script_play(xas_script *script, xas_audio_stream *sink);
+
+#endif /* _XAS_SCRIPT_H */