diff options
author | XANTRONIX Development | 2022-03-17 11:44:36 -0400 |
---|---|---|
committer | XANTRONIX Development | 2022-03-17 11:44:36 -0400 |
commit | d685f7a7c3f1abcc402e1ac8b808f2ccd16708ad (patch) | |
tree | 49d9745d840f587ab5bf77ddf164491a53dd570e /examples | |
parent | 89401de8a6caecc8c283081e7036ad7c0b5d6a92 (diff) | |
download | xas-d685f7a7c3f1abcc402e1ac8b808f2ccd16708ad.tar.gz xas-d685f7a7c3f1abcc402e1ac8b808f2ccd16708ad.tar.bz2 xas-d685f7a7c3f1abcc402e1ac8b808f2ccd16708ad.zip |
Refactor to allow sequencing events on drones
Changes:
* Consolidate xas_drone_vox into xas_drone
* Refactor xas_drone to no longer be centered around spatial
objects for its vocalisations
* Add a two-tone beep system to drones to allow beeping according
to mood
* Consolidate head-oriented sound effects into a single spatial
object within drones
* Implement ability to add a mixer to a spatial scene
* Allow setting spatial coordinates for objects generically; remove
code from src/spatial.c for doing this specifically
Diffstat (limited to 'examples')
-rw-r--r-- | examples/pod.c | 34 |
1 files changed, 12 insertions, 22 deletions
diff --git a/examples/pod.c b/examples/pod.c index 156968c..7fd4011 100644 --- a/examples/pod.c +++ b/examples/pod.c @@ -14,7 +14,7 @@ #include <xas/drone.h> #include <xas/seq.h> -static int drone_id_say(xas_drone_vox *vox, +static int drone_id_say(xas_drone *drone, const char *drone_id) { const char *numbers[10] = { "zero", "one", "two", "three", "four", @@ -28,23 +28,23 @@ static int drone_id_say(xas_drone_vox *vox, char c = drone_id[i]; if (c == '-') { - if (xas_drone_vox_say(vox, " dash") < 0) { + if (xas_drone_vox_say(drone, " dash") < 0) { goto error_drone_vox_say; } } else if (c >= 'a' && c <= 'z') { c -= 0x20; - if (xas_drone_vox_sayf(vox, " %c", c) < 0) { + if (xas_drone_vox_sayf(drone, " %c", c) < 0) { goto error_drone_vox_say; } } else if (c >= 'A' && c <= 'Z') { - if (xas_drone_vox_sayf(vox, " %c", c) < 0) { + if (xas_drone_vox_sayf(drone, " %c", c) < 0) { goto error_drone_vox_say; } } else if (c >= '0' && c <= '9') { int n = (int)(c - '0'); - if (xas_drone_vox_sayf(vox, " %s", numbers[n]) < 0) { + if (xas_drone_vox_sayf(drone, " %s", numbers[n]) < 0) { goto error_drone_vox_say; } } @@ -56,7 +56,7 @@ error_drone_vox_say: return -1; } -static int drone_part_say(xas_drone_vox *vox, const char *drone_id) { +static int drone_part_say(xas_drone *drone, const char *drone_id) { const char *id_lines[2] = { " is obedient.\n", " is empty.\n" @@ -70,16 +70,16 @@ static int drone_part_say(xas_drone_vox *vox, const char *drone_id) { int i; for (i=0; i<2; i++) { - if (drone_id_say(vox, drone_id) < 0) { + if (drone_id_say(drone, drone_id) < 0) { goto error_say; } - if (xas_drone_vox_say(vox, id_lines[i]) < 0) { + if (xas_drone_vox_say(drone, id_lines[i]) < 0) { goto error_say; } } - if (xas_drone_vox_say(vox, speech) < 0) { + if (xas_drone_vox_say(drone, speech) < 0) { goto error_say; } @@ -145,8 +145,6 @@ int main(int argc, char **argv) { xas_drone *drone, *nurse; - xas_drone_vox *drone_vox; - xas_drone_chamber *chamber; struct timeval cur = { 0, 0 }, @@ -196,17 +194,13 @@ int main(int argc, char **argv) { goto error_drone_chamber_new; } - if ((drone_vox = xas_drone_vox_new(drone)) == NULL) { - goto error_drone_vox_new; - } - - xas_drone_vox_set_speed(drone_vox, 0.75f); + xas_drone_vox_set_speed(drone, 0.75f); - if (drone_part_say(drone_vox, argv[1]) < 0) { + if (drone_part_say(drone, argv[1]) < 0) { goto error_drone_part_say; } - if (xas_drone_vox_save(drone_vox, 0) < 0) { + if (xas_drone_vox_save(drone, 0) < 0) { goto error_drone_vox_save; } @@ -271,7 +265,6 @@ int main(int argc, char **argv) { xas_seq_play(seq, wave); - xas_drone_vox_destroy(drone_vox); xas_drone_chamber_destroy(chamber); xas_drone_destroy(nurse); xas_drone_destroy(drone); @@ -285,9 +278,6 @@ error_seq: error_drone_speech_import_nurse: error_drone_vox_save: error_drone_part_say: - xas_drone_vox_destroy(drone_vox); - -error_drone_vox_new: xas_drone_chamber_destroy(chamber); error_drone_chamber_new: |