summaryrefslogtreecommitdiffstats
path: root/include/xas
diff options
context:
space:
mode:
authorXANTRONIX Development2022-03-13 17:16:26 -0400
committerXANTRONIX Development2022-03-13 17:16:26 -0400
commit7b8375ee2026d42b5444f8ae0e7b98e272e87d69 (patch)
tree38382c0062f095c9efcd0d6bc29e1b5a5e6ac2f1 /include/xas
parent98de824b0eb038d37f62f5317a367b2bfbd38b9d (diff)
downloadxas-7b8375ee2026d42b5444f8ae0e7b98e272e87d69.tar.gz
xas-7b8375ee2026d42b5444f8ae0e7b98e272e87d69.tar.bz2
xas-7b8375ee2026d42b5444f8ae0e7b98e272e87d69.zip
Refactor drone speech modules
Changes: * Implement xas_drone_vox type to wrap a xas_vox and audio stream object in one, and save rendered speech to a drone's audio bank * Implement xas_drone_speech_import() as a convenience wrapper to xas_drone_vox methods
Diffstat (limited to 'include/xas')
-rw-r--r--include/xas/drone.h66
1 files changed, 55 insertions, 11 deletions
diff --git a/include/xas/drone.h b/include/xas/drone.h
index b790cc5..d7dc4c0 100644
--- a/include/xas/drone.h
+++ b/include/xas/drone.h
@@ -1,24 +1,37 @@
#ifndef _XAS_DRONE_H
#define _XAS_DRONE_H
+#include <stdarg.h>
#include <sys/time.h>
#include <xas/spatial.h>
+#include <xas/vox.h>
#include <xas/seq.h>
+#define XAS_DRONE_VOX_BUFFER_SIZE 735
+#define XAS_DRONE_VOX_TEXT2WAVE_PATH "/usr/bin/text2wave"
+
+#define XAS_DRONE_VOX_DEFAULT_SPEED 1.0f
+#define XAS_DRONE_VOX_DEFAULT_VOICE "voice_cmu_us_slt_cg"
+
#define XAS_DRONE_CHAMBER_BASS_FREQUENCY 20 /* Hz */
#define XAS_DRONE_CHAMBER_BASS_TYPE XAS_SYNTH_SQUARE
-typedef struct _xas_drone xas_drone;
-
-struct _xas_drone {
+typedef struct _xas_drone {
xas_bank *bank;
xas_spatial_scene *scene;
xas_spatial_object *obj;
- float speech_speed;
- const char **speech_lines;
-};
+} xas_drone;
+
+typedef struct _xas_drone_vox {
+ xas_drone *drone;
+ xas_vox *obj;
+ xas_audio_stream *source;
+
+ const char *voice;
+ float speed;
+} xas_drone_vox;
typedef struct _xas_drone_chamber_interval {
struct timeval duration;
@@ -36,7 +49,6 @@ typedef struct _xas_drone_chamber_speech {
} xas_drone_chamber_speech;
typedef struct _xas_drone_chamber {
- xas_spatial_scene *scene;
xas_drone **drones;
size_t drone_count;
@@ -45,17 +57,49 @@ typedef struct _xas_drone_chamber {
*synth_r;
} xas_drone_chamber;
+/*
+ * Methods for individual drones
+ */
xas_drone *xas_drone_new(xas_spatial_scene *scene,
xas_spatial_coord position,
- float speech_speed,
- size_t speech_sample_count,
- size_t speech_line_count,
- const char **speech_lines);
+ size_t bank_entry_size,
+ size_t bank_entry_count);
void xas_drone_destroy(xas_drone *drone);
xas_spatial_object *xas_drone_get_spatial_object(xas_drone *drone);
+int xas_drone_speech_import(xas_drone *drone,
+ const char *voice,
+ float speed,
+ size_t speech_sample_first,
+ size_t speech_sample_count,
+ const char **speech_lines);
+
+/*
+ * Methods for drone vocalisations
+ */
+xas_drone_vox *xas_drone_vox_new(xas_drone *drone);
+
+void xas_drone_vox_destroy(xas_drone_vox *vox);
+
+void xas_drone_vox_set_voice(xas_drone_vox *vox, const char *voice);
+
+void xas_drone_vox_set_speed(xas_drone_vox *vox, float speed);
+
+int xas_drone_vox_vsayf(xas_drone_vox *vox,
+ const char *format,
+ va_list args);
+
+int xas_drone_vox_sayf(xas_drone_vox *vox, const char *format, ...);
+
+int xas_drone_vox_say(xas_drone_vox *vox, const char *text);
+
+int xas_drone_vox_save(xas_drone_vox *vox, size_t sample_index);
+
+/*
+ * Drone conversion chamber methods
+ */
xas_drone_chamber *xas_drone_chamber_new(xas_spatial_scene *scene,
xas_spatial_coord location,
size_t drone_count);