summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorXANTRONIX Development2022-03-01 23:43:57 -0500
committerXANTRONIX Development2022-03-01 23:43:57 -0500
commitea5c729f69a9c6c2fb88caa48e37f6f548532b9b (patch)
tree2d2c88aecdb55d911fbc9fe512cce91d0dbae572 /src
parent80f45719b50f394e0cc797fdb20342698afbd14e (diff)
downloadxas-ea5c729f69a9c6c2fb88caa48e37f6f548532b9b.tar.gz
xas-ea5c729f69a9c6c2fb88caa48e37f6f548532b9b.tar.bz2
xas-ea5c729f69a9c6c2fb88caa48e37f6f548532b9b.zip
good cats renaming stuff,,,
Diffstat (limited to 'src')
-rw-r--r--src/Makefile4
-rw-r--r--src/seq.c (renamed from src/script.c)182
2 files changed, 93 insertions, 93 deletions
diff --git a/src/Makefile b/src/Makefile
index ce60d40..099c3ee 100644
--- a/src/Makefile
+++ b/src/Makefile
@@ -8,10 +8,10 @@ CFLAGS += -I$(INCLUDE_PATH)
LDFLAGS +=
HEADERS = audio.h riff.h mixer.h object.h synth.h vox.h bank.h \
- spatial.h script.h
+ spatial.h seq.h
OBJS = audio.o riff.o mixer.o object.o synth.o vox.o bank.o \
- spatial.o script.o
+ spatial.o seq.o
VERSION_MAJOR = 0
VERSION_MINOR = 0.1
diff --git a/src/script.c b/src/seq.c
index 4bd69b1..64b3544 100644
--- a/src/script.c
+++ b/src/seq.c
@@ -5,50 +5,50 @@
#include <xas/bank.h>
#include <xas/synth.h>
#include <xas/vox.h>
-#include <xas/script.h>
+#include <xas/seq.h>
-xas_script *xas_script_new(xas_spatial_scene *scene, size_t buffer_size) {
- xas_script *script;
+xas_seq *xas_seq_new(xas_spatial_scene *scene, size_t buffer_size) {
+ xas_seq *seq;
- if ((script = malloc(sizeof(*script))) == NULL) {
- goto error_malloc_script;
+ if ((seq = malloc(sizeof(*seq))) == NULL) {
+ goto error_malloc_seq;
}
- script->scene = scene;
- script->first = NULL;
- script->buffer_size = buffer_size;
+ seq->scene = scene;
+ seq->first = NULL;
+ seq->buffer_size = buffer_size;
- return script;
+ return seq;
-error_malloc_script:
+error_malloc_seq:
return NULL;
}
-void xas_script_destroy(xas_script *script) {
- xas_script_event *event = script->first;
+void xas_seq_destroy(xas_seq *seq) {
+ xas_seq_event *event = seq->first;
while (event) {
- xas_script_event *next = event->next;
+ xas_seq_event *next = event->next;
free(event);
event = next;
}
- free(script);
+ free(seq);
}
-static void add_event(xas_script *script, xas_script_event *ev) {
- xas_script_event *current = script->first;
+static void add_event(xas_seq *seq, xas_seq_event *ev) {
+ xas_seq_event *current = seq->first;
- if (script->first == NULL) {
- script->first = ev;
+ if (seq->first == NULL) {
+ seq->first = ev;
return;
}
while (current) {
- xas_script_event *next = current->next;
+ xas_seq_event *next = current->next;
if (next == NULL) {
current->next = ev;
@@ -68,22 +68,22 @@ static void add_event(xas_script *script, xas_script_event *ev) {
}
}
-int xas_script_add_event_off(xas_script *script,
- xas_spatial_object *object,
- struct timeval timestamp) {
- xas_script_event *ev;
+int xas_seq_add_event_off(xas_seq *seq,
+ xas_spatial_object *object,
+ struct timeval timestamp) {
+ xas_seq_event *ev;
if ((ev = malloc(sizeof(*ev))) == NULL) {
goto error_malloc_ev;
}
- ev->type = XAS_SCRIPT_EVENT_OFF;
- ev->objtype = XAS_SCRIPT_OBJECT_ANY;
+ ev->type = XAS_SEQ_EVENT_OFF;
+ ev->objtype = XAS_SEQ_OBJECT_ANY;
ev->object = object;
ev->timestamp = timestamp;
ev->next = NULL;
- add_event(script, ev);
+ add_event(seq, ev);
return 0;
@@ -91,22 +91,22 @@ error_malloc_ev:
return -1;
}
-int xas_script_add_event_on(xas_script *script,
- xas_spatial_object *object,
- struct timeval timestamp) {
- xas_script_event *ev;
+int xas_seq_add_event_on(xas_seq *seq,
+ xas_spatial_object *object,
+ struct timeval timestamp) {
+ xas_seq_event *ev;
if ((ev = malloc(sizeof(*ev))) == NULL) {
goto error_malloc_ev;
}
- ev->type = XAS_SCRIPT_EVENT_ON;
- ev->objtype = XAS_SCRIPT_OBJECT_ANY;
+ ev->type = XAS_SEQ_EVENT_ON;
+ ev->objtype = XAS_SEQ_OBJECT_ANY;
ev->object = object;
ev->timestamp = timestamp;
ev->next = NULL;
- add_event(script, ev);
+ add_event(seq, ev);
return 0;
@@ -114,24 +114,24 @@ error_malloc_ev:
return -1;
}
-int xas_script_add_set_position(xas_script *script,
- xas_spatial_object *object,
- struct timeval timestamp,
- xas_spatial_coord point) {
- xas_script_event *ev;
+int xas_seq_add_set_position(xas_seq *seq,
+ xas_spatial_object *object,
+ struct timeval timestamp,
+ xas_spatial_coord point) {
+ xas_seq_event *ev;
if ((ev = malloc(sizeof(*ev))) == NULL) {
goto error_malloc_ev;
}
- ev->type = XAS_SCRIPT_EVENT_SET_POSITION;
- ev->objtype = XAS_SCRIPT_OBJECT_ANY;
+ ev->type = XAS_SEQ_EVENT_SET_POSITION;
+ ev->objtype = XAS_SEQ_OBJECT_ANY;
ev->object = object;
ev->timestamp = timestamp;
ev->point = point;
ev->next = NULL;
- add_event(script, ev);
+ add_event(seq, ev);
return 0;
@@ -139,24 +139,24 @@ error_malloc_ev:
return -1;
}
-int xas_script_add_set_gain(xas_script *script,
- xas_spatial_object *object,
- struct timeval timestamp,
- float gain) {
- xas_script_event *ev;
+int xas_seq_add_set_gain(xas_seq *seq,
+ xas_spatial_object *object,
+ struct timeval timestamp,
+ float gain) {
+ xas_seq_event *ev;
if ((ev = malloc(sizeof(*ev))) == NULL) {
goto error_malloc_ev;
}
- ev->type = XAS_SCRIPT_EVENT_ON;
- ev->objtype = XAS_SCRIPT_OBJECT_ANY;
+ ev->type = XAS_SEQ_EVENT_ON;
+ ev->objtype = XAS_SEQ_OBJECT_ANY;
ev->object = object;
ev->timestamp = timestamp;
ev->gain = gain;
ev->next = NULL;
- add_event(script, ev);
+ add_event(seq, ev);
return 0;
@@ -164,24 +164,24 @@ error_malloc_ev:
return -1;
}
-int xas_script_add_set_bank(xas_script *script,
- xas_spatial_object *object,
- struct timeval timestamp,
- size_t index) {
- xas_script_event *ev;
+int xas_seq_add_set_bank(xas_seq *seq,
+ xas_spatial_object *object,
+ struct timeval timestamp,
+ size_t index) {
+ xas_seq_event *ev;
if ((ev = malloc(sizeof(*ev))) == NULL) {
goto error_malloc_ev;
}
- ev->type = XAS_SCRIPT_EVENT_SET_BANK_INDEX;
- ev->objtype = XAS_SCRIPT_OBJECT_BANK_PLAYER;
+ ev->type = XAS_SEQ_EVENT_SET_BANK_INDEX;
+ ev->objtype = XAS_SEQ_OBJECT_BANK_PLAYER;
ev->object = object;
ev->timestamp = timestamp;
ev->next = NULL;
ev->index = index;
- add_event(script, ev);
+ add_event(seq, ev);
return 0;
@@ -189,24 +189,24 @@ error_malloc_ev:
return -1;
}
-int xas_script_add_set_frequency(xas_script *script,
- xas_spatial_object *object,
- struct timeval timestamp,
- size_t frequency) {
- xas_script_event *ev;
+int xas_seq_add_set_frequency(xas_seq *seq,
+ xas_spatial_object *object,
+ struct timeval timestamp,
+ size_t frequency) {
+ xas_seq_event *ev;
if ((ev = malloc(sizeof(*ev))) == NULL) {
goto error_malloc_ev;
}
- ev->type = XAS_SCRIPT_EVENT_SET_FREQUENCY;
- ev->objtype = XAS_SCRIPT_OBJECT_SYNTH;
+ ev->type = XAS_SEQ_EVENT_SET_FREQUENCY;
+ ev->objtype = XAS_SEQ_OBJECT_SYNTH;
ev->object = object;
ev->timestamp = timestamp;
ev->next = NULL;
ev->frequency = frequency;
- add_event(script, ev);
+ add_event(seq, ev);
return 0;
@@ -214,24 +214,24 @@ error_malloc_ev:
return -1;
}
-int xas_script_add_phrase(xas_script *script,
- xas_spatial_object *object,
- struct timeval timestamp,
- const char *phrase) {
- xas_script_event *ev;
+int xas_seq_add_phrase(xas_seq *seq,
+ xas_spatial_object *object,
+ struct timeval timestamp,
+ const char *phrase) {
+ xas_seq_event *ev;
if ((ev = malloc(sizeof(*ev))) == NULL) {
goto error_malloc_ev;
}
- ev->type = XAS_SCRIPT_EVENT_SPEECH;
- ev->objtype = XAS_SCRIPT_OBJECT_VOX;
+ ev->type = XAS_SEQ_EVENT_SPEECH;
+ ev->objtype = XAS_SEQ_OBJECT_VOX;
ev->object = object;
ev->timestamp = timestamp;
ev->next = NULL;
ev->phrase = phrase;
- add_event(script, ev);
+ add_event(seq, ev);
return 0;
@@ -239,28 +239,28 @@ error_malloc_ev:
return -1;
}
-static int event_trigger(xas_spatial_scene *scene, xas_script_event *ev) {
+static int event_trigger(xas_spatial_scene *scene, xas_seq_event *ev) {
switch (ev->type) {
- case XAS_SCRIPT_EVENT_OFF:
+ case XAS_SEQ_EVENT_OFF:
return xas_spatial_object_stop(ev->object);
- case XAS_SCRIPT_EVENT_ON:
+ case XAS_SEQ_EVENT_ON:
return xas_spatial_object_start(ev->object);
- case XAS_SCRIPT_EVENT_SET_POSITION:
+ case XAS_SEQ_EVENT_SET_POSITION:
xas_spatial_scene_position_object(scene,
ev->object,
ev->point);
break;
- case XAS_SCRIPT_EVENT_SET_GAIN:
+ case XAS_SEQ_EVENT_SET_GAIN:
xas_object_set_gain(ev->object->ctx, ev->gain);
break;
- case XAS_SCRIPT_EVENT_SET_FREQUENCY:
- if (ev->objtype != XAS_SCRIPT_OBJECT_SYNTH) {
+ case XAS_SEQ_EVENT_SET_FREQUENCY:
+ if (ev->objtype != XAS_SEQ_OBJECT_SYNTH) {
goto error_invalid_event;
}
@@ -268,8 +268,8 @@ static int event_trigger(xas_spatial_scene *scene, xas_script_event *ev) {
break;
- case XAS_SCRIPT_EVENT_SET_BANK_INDEX:
- if (ev->objtype != XAS_SCRIPT_OBJECT_BANK_PLAYER) {
+ case XAS_SEQ_EVENT_SET_BANK_INDEX:
+ if (ev->objtype != XAS_SEQ_OBJECT_BANK_PLAYER) {
goto error_invalid_event;
}
@@ -277,8 +277,8 @@ static int event_trigger(xas_spatial_scene *scene, xas_script_event *ev) {
break;
- case XAS_SCRIPT_EVENT_SPEECH:
- if (ev->objtype != XAS_SCRIPT_OBJECT_VOX) {
+ case XAS_SEQ_EVENT_SPEECH:
+ if (ev->objtype != XAS_SEQ_OBJECT_VOX) {
goto error_invalid_event;
}
@@ -303,20 +303,20 @@ static inline void timerupdate(struct timeval *tv,
tv->tv_usec = usec % 1000000;
}
-int xas_script_play(xas_script *script, xas_audio_stream *sink) {
- xas_script_event *ev = script->first;
+int xas_seq_play(xas_seq *seq, xas_audio_stream *sink) {
+ xas_seq_event *ev = seq->first;
xas_audio_stream *source;
size_t frame = 0,
- sample_rate = script->scene->format.sample_rate,
- buffer_size = script->buffer_size;
+ sample_rate = seq->scene->format.sample_rate,
+ buffer_size = seq->buffer_size;
suseconds_t interval = 1000000 / (sample_rate / buffer_size);
int16_t *samples;
- if ((source = xas_spatial_scene_stream_new(script->scene,
- script->buffer_size)) == NULL) {
+ if ((source = xas_spatial_scene_stream_new(seq->scene,
+ seq->buffer_size)) == NULL) {
goto error_spatial_scene_stream_new;
}
@@ -328,7 +328,7 @@ int xas_script_play(xas_script *script, xas_audio_stream *sink) {
timerupdate(&tv, interval, frame);
while (ev && !timercmp(&tv, &ev->timestamp, <)) {
- if (event_trigger(script->scene, ev) < 0) {
+ if (event_trigger(seq->scene, ev) < 0) {
goto error_event_trigger;
}