summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorXANTRONIX Development2022-03-11 10:54:14 -0500
committerXANTRONIX Development2022-03-11 10:54:14 -0500
commitfc164c60cd7d582784827de9a7560cba46fa13e2 (patch)
tree1e925d564e60f9d6b93607d26ba4e312883907a6
parentf3ab1985ddfdaa547734c9324eebe64744fd6bf7 (diff)
downloadxas-fc164c60cd7d582784827de9a7560cba46fa13e2.tar.gz
xas-fc164c60cd7d582784827de9a7560cba46fa13e2.tar.bz2
xas-fc164c60cd7d582784827de9a7560cba46fa13e2.zip
*chef kiss*
-rw-r--r--examples/seq.c48
1 files changed, 32 insertions, 16 deletions
diff --git a/examples/seq.c b/examples/seq.c
index 1482ac3..492c53b 100644
--- a/examples/seq.c
+++ b/examples/seq.c
@@ -14,6 +14,15 @@
#include <xas/drone.h>
#include <xas/seq.h>
+struct sequence {
+ size_t speech_part;
+
+ int single_iterations,
+ unison_iterations;
+
+ xas_drone_chamber_interval *intervals;
+};
+
static void usage(int argc, char **argv, const char *message, ...) {
va_list args;
@@ -141,14 +150,11 @@ int main(int argc, char **argv) {
{ { 0, 0 }, 0, 0, XAS_SYNTH_SINE, XAS_SYNTH_SINE }
};
- struct {
- size_t speech_part;
- xas_drone_chamber_interval *intervals;
- } sequences[] = {
- { 0, intro },
- { 1, middle },
- { 2, ingest },
- { 3, climax }
+ struct sequence sequences[] = {
+ { 0, 3, 1, intro },
+ { 1, 0, 4, middle },
+ { 2, 1, 0, ingest },
+ { 3, 1, 2, climax }
};
xas_drone *drone,
@@ -159,7 +165,7 @@ int main(int argc, char **argv) {
struct timeval cur = { 0, 0 },
tmp;
- size_t part;
+ int s;
if (argc != 2) {
usage(argc, argv, "No output file provided");
@@ -210,8 +216,10 @@ int main(int argc, char **argv) {
timerclear(&cur);
- for (part=0; part<4; part++) {
- xas_drone_chamber_interval *intervals = sequences[part].intervals;
+ for (s=0; s<4; s++) {
+ struct sequence sequence = sequences[s];
+
+ xas_drone_chamber_interval *intervals = sequence.intervals;
int i;
tmp = cur;
@@ -226,11 +234,11 @@ int main(int argc, char **argv) {
cur = tmp;
- for (i=0; i<2; i++) {
+ for (i=0; i<sequence.single_iterations; i++) {
if (xas_drone_chamber_seq_speech(chamber,
drone,
seq,
- part,
+ s,
&cur) < 0) {
goto error_seq;
}
@@ -238,22 +246,30 @@ int main(int argc, char **argv) {
if (xas_drone_chamber_seq_speech(chamber,
nurse,
seq,
- part,
+ s,
&cur) < 0) {
goto error_seq;
}
}
- for (i=0; i<2; i++) {
+ for (i=0; i<sequence.unison_iterations; i++) {
if (xas_drone_chamber_seq_chorus(chamber,
seq,
- part,
+ s,
&cur) < 0) {
goto error_seq;
}
}
}
+ if (xas_drone_chamber_seq_intervals(chamber,
+ sequences[3].intervals,
+ seq,
+ 8,
+ &cur) < 0) {
+ goto error_seq;
+ }
+
xas_seq_add_stop(seq, cur);
xas_seq_play(seq, wave);