diff options
Diffstat (limited to 'include/xas')
-rw-r--r-- | include/xas/drone.h | 55 | ||||
-rw-r--r-- | include/xas/seq.h | 24 | ||||
-rw-r--r-- | include/xas/spatial.h | 41 |
3 files changed, 74 insertions, 46 deletions
diff --git a/include/xas/drone.h b/include/xas/drone.h index fa28ee3..f924c3a 100644 --- a/include/xas/drone.h +++ b/include/xas/drone.h @@ -4,6 +4,7 @@ #include <stdarg.h> #include <sys/time.h> +#include <xas/object.h> #include <xas/spatial.h> #include <xas/vox.h> #include <xas/seq.h> @@ -14,6 +15,23 @@ #define XAS_DRONE_CHAMBER_BASS_FREQUENCY 20 /* Hz */ #define XAS_DRONE_CHAMBER_BASS_TYPE XAS_SYNTH_SQUARE +#define XAS_DRONE_SFX_BANK_SIZE 441000 +#define XAS_DRONE_SFX_BANK_ENTRIES 4 + +#define XAS_DRONE_SFX_INHALE 0 +#define XAS_DRONE_SFX_EXHALE 1 +#define XAS_DRONE_SFX_FOOT_LEFT 2 +#define XAS_DRONE_SFX_FOOT_RIGHT 3 + +#define XAS_DRONE_BEEP_BUFFER_SIZE 735 + +#define XAS_DRONE_MIXER_BUFFER_SIZE 735 +#define XAS_DRONE_MIXER_DEFAULT_GAIN 1.0f +#define XAS_DRONE_MIXER_DEFAULT_PAN 0.0f + +#define XAS_DRONE_INDEX_BANK 0 +#define XAS_DRONE_INDEX_BEEP 1 + enum xas_drone_mood { XAS_DRONE_MOOD_NEUTRAL, XAS_DRONE_MOOD_HAPPY, @@ -24,19 +42,26 @@ enum xas_drone_mood { }; typedef struct _xas_drone { - xas_bank *bank; + xas_object obj; enum xas_drone_mood mood; + xas_bank *bank, + *sfx; + + xas_vox *vox; + + xas_bank_player *player; + + xas_synth *beep_a, + *beep_b; + + xas_mixer *mixer; + xas_spatial_scene *scene; - xas_spatial_object *obj; + xas_spatial_object *head; } xas_drone; -typedef struct _xas_drone_vox { - xas_drone *drone; - xas_vox *obj; -} xas_drone_vox; - typedef struct _xas_drone_chamber_interval { struct timeval duration; @@ -94,23 +119,19 @@ int xas_drone_seq_sample(xas_drone *drone, /* * Methods for drone vocalisations */ -xas_drone_vox *xas_drone_vox_new(xas_drone *drone); - -void xas_drone_vox_destroy(xas_drone_vox *vox); - -int xas_drone_vox_set_voice(xas_drone_vox *vox, const char *voice); +int xas_drone_vox_set_voice(xas_drone *drone, const char *voice); -int xas_drone_vox_set_speed(xas_drone_vox *vox, float speed); +int xas_drone_vox_set_speed(xas_drone *drone, float speed); -int xas_drone_vox_vsayf(xas_drone_vox *vox, +int xas_drone_vox_vsayf(xas_drone *drone, const char *format, va_list args); -int xas_drone_vox_sayf(xas_drone_vox *vox, const char *format, ...); +int xas_drone_vox_sayf(xas_drone *drone, const char *format, ...); -int xas_drone_vox_say(xas_drone_vox *vox, const char *text); +int xas_drone_vox_say(xas_drone *drone, const char *text); -int xas_drone_vox_save(xas_drone_vox *vox, size_t sample_index); +int xas_drone_vox_save(xas_drone *drone, size_t sample_index); /* * Drone conversion chamber methods diff --git a/include/xas/seq.h b/include/xas/seq.h index 38b7cf4..1562e03 100644 --- a/include/xas/seq.h +++ b/include/xas/seq.h @@ -28,7 +28,7 @@ typedef struct _xas_seq_event xas_seq_event; struct _xas_seq_event { enum xas_seq_event_type type; - xas_spatial_object *object; + xas_object *object; struct timeval timestamp; size_t index; @@ -62,58 +62,58 @@ xas_seq *xas_seq_new(xas_spatial_scene *scene, size_t buffer_size); void xas_seq_destroy(xas_seq *seq); int xas_seq_add_event_off(xas_seq *seq, - xas_spatial_object *object, + xas_object *object, struct timeval timestamp, size_t index); int xas_seq_add_event_on(xas_seq *seq, - xas_spatial_object *object, + xas_object *object, struct timeval timestamp, size_t index); int xas_seq_add_set_position(xas_seq *seq, - xas_spatial_object *object, + xas_object *object, struct timeval timestamp, xas_spatial_coord point); int xas_seq_add_set_heading(xas_seq *seq, - xas_spatial_object *object, + xas_object *object, struct timeval timestamp, xas_spatial_coord heading); int xas_seq_add_set_speed(xas_seq *seq, - xas_spatial_object *object, + xas_object *object, struct timeval timestamp, float speed); int xas_seq_add_set_gain(xas_seq *seq, - xas_spatial_object *object, + xas_object *object, struct timeval timestamp, float gain); int xas_seq_add_set_bank_entry(xas_seq *seq, - xas_spatial_object *object, + xas_object *object, struct timeval timestamp, size_t index, size_t entry); int xas_seq_add_set_player_flags(xas_seq *seq, - xas_spatial_object *object, + xas_object *object, struct timeval timestamp, int flags); int xas_seq_add_set_synth_type(xas_seq *seq, - xas_spatial_object *object, + xas_object *object, struct timeval timestamp, enum xas_synth_type type); int xas_seq_add_set_frequency(xas_seq *seq, - xas_spatial_object *object, + xas_object *object, struct timeval timestamp, size_t frequency); int xas_seq_add_phrase(xas_seq *seq, - xas_spatial_object *object, + xas_object *object, struct timeval timestamp, const char *phrase); diff --git a/include/xas/spatial.h b/include/xas/spatial.h index 4b0f6a7..edd3964 100644 --- a/include/xas/spatial.h +++ b/include/xas/spatial.h @@ -3,7 +3,9 @@ #include <xas/synth.h> #include <xas/bank.h> +#include <xas/mixer.h> #include <xas/audio.h> +#include <xas/object.h> #define XAS_SPATIAL_DEFAULT_OBSERVER_WIDTH 0.18f #define XAS_SPATIAL_DEFAULT_RADIUS 4000.0f /* metres */ @@ -11,12 +13,10 @@ #define XAS_SPATIAL_DEFAULT_OBJECT_SPEED 0.0f /* m/s */ #define XAS_SPATIAL_DEFAULT_CONE_ANGLE 35.0f /* degrees */ -#define XAS_SPATIAL_OBJECT_NONE 0 +#define XAS_SPATIAL_OBJECT_NONE 0 #define XAS_SPATIAL_OBJECT_MANAGED (1 << 0) -typedef struct _xas_spatial_coord { - float x, y, z; -} xas_spatial_coord; +typedef struct _xas_object_coord xas_spatial_coord; typedef struct _xas_spatial_cone { xas_spatial_coord apex, @@ -35,15 +35,6 @@ typedef struct _xas_spatial_observer { typedef struct _xas_spatial_object xas_spatial_object; struct _xas_spatial_object { - float distance_l, - distance_r; - - size_t delay_l, - delay_r; - - ssize_t shift_l, - shift_r; - xas_audio_stream *source; void *ctx; int flags; @@ -53,6 +44,15 @@ struct _xas_spatial_object { float speed; + float distance_l, + distance_r; + + size_t delay_l, + delay_r; + + ssize_t shift_l, + shift_r; + xas_spatial_object *next; }; @@ -78,6 +78,9 @@ typedef struct _xas_spatial_scene { xas_spatial_buffer *buffer; } xas_spatial_scene; +/* + * Methods pertaining to spatial scenes + */ xas_spatial_scene *xas_spatial_scene_new(xas_audio_format format, xas_spatial_coord speaker_l, xas_spatial_coord speaker_r); @@ -119,20 +122,24 @@ xas_spatial_object *xas_spatial_scene_add_bank_player(xas_spatial_scene *scene, xas_spatial_coord point, xas_bank *bank); +xas_spatial_object *xas_spatial_scene_add_mixer(xas_spatial_scene *scene, + xas_spatial_coord point, + xas_mixer *mixer); + xas_spatial_object *xas_spatial_scene_add_vox(xas_spatial_scene *scene, xas_spatial_coord point, const char *text2wave_path); void xas_spatial_scene_position_object(xas_spatial_scene *scene, - xas_spatial_object *object, + xas_object *object, xas_spatial_coord point); xas_audio_stream *xas_spatial_scene_stream_new(xas_spatial_scene *scene, size_t buffer_size); -void xas_spatial_object_get_point(xas_spatial_object *object, - xas_spatial_coord *point); - +/* + * Methods specific to individual spatial objects + */ float xas_spatial_object_get_speed(xas_spatial_object *object); void xas_spatial_object_set_speed(xas_spatial_object *object, float speed); |