diff options
Diffstat (limited to 'examples')
-rw-r--r-- | examples/Makefile | 2 | ||||
-rw-r--r-- | examples/seq.c (renamed from examples/script.c) | 35 |
2 files changed, 26 insertions, 11 deletions
diff --git a/examples/Makefile b/examples/Makefile index b167416..756fa89 100644 --- a/examples/Makefile +++ b/examples/Makefile @@ -8,7 +8,7 @@ LIBNAME = xas CFLAGS += -I$(INCLUDE_PATH) LDFLAGS += -L../src -l$(LIBNAME) -lm -EXAMPLES = test open say spatial script +EXAMPLES = test open say spatial seq all: $(EXAMPLES) diff --git a/examples/script.c b/examples/seq.c index f9faccc..3c0293a 100644 --- a/examples/script.c +++ b/examples/seq.c @@ -10,7 +10,7 @@ #include <xas/audio.h> #include <xas/riff.h> #include <xas/spatial.h> -#include <xas/script.h> +#include <xas/seq.h> static void usage(int argc, char **argv, const char *message, ...) { va_list args; @@ -31,7 +31,7 @@ static void usage(int argc, char **argv, const char *message, ...) { int main(int argc, char **argv) { xas_spatial_scene *scene; - xas_script *script; + xas_seq *seq; xas_spatial_object *synth_l, *synth_r, @@ -69,8 +69,8 @@ int main(int argc, char **argv) { goto error_spatial_scene_new; } - if ((script = xas_script_new(scene, buffer_size)) == NULL) { - goto error_script_new; + if ((seq = xas_seq_new(scene, buffer_size)) == NULL) { + goto error_seq_new; } if ((voice = xas_spatial_scene_add_vox(scene, @@ -98,11 +98,26 @@ int main(int argc, char **argv) { xas_vox_set_parameter_float(voice->ctx, "Duration_Stretch", 1.3); - xas_script_add_set_frequency(script, synth_l, (struct timeval){ 0, 0 }, 220); - xas_script_add_event_on( script, synth_l, (struct timeval){ 0, 0 }); - xas_script_add_event_off(script, synth_l, (struct timeval){ 60, 0 }); + xas_seq_add_set_frequency(seq, synth_l, (struct timeval){ 0, 0 }, 220); + xas_seq_add_set_frequency(seq, synth_r, (struct timeval){ 0, 0 }, 420); + xas_seq_add_event_on( seq, synth_l, (struct timeval){ 0, 0 }); + xas_seq_add_event_on( seq, synth_r, (struct timeval){ 0, 0 }); - xas_script_destroy(script); + xas_seq_add_set_position(seq, + synth_l, + (struct timeval){ 15, 0 }, + (xas_spatial_coord){ -10.0, 0.0, 0.0 }); + + xas_seq_add_phrase(seq, + voice, + (struct timeval){ 10, 0 }, + "I will eat your soul."); + + xas_seq_add_event_off(seq, synth_l, (struct timeval){ 60, 0 }); + + xas_seq_play(seq, wave); + + xas_seq_destroy(seq); xas_spatial_scene_destroy(scene); xas_audio_stream_destroy(wave); @@ -112,9 +127,9 @@ error_spatial_scene_stream_new: error_spatial_scene_add_synth_r: error_spatial_scene_add_synth_l: error_spatial_scene_add_vox: - xas_script_destroy(script); + xas_seq_destroy(seq); -error_script_new: +error_seq_new: xas_spatial_scene_destroy(scene); error_spatial_scene_new: |