1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
|
#ifndef _XAS_DRONE_H
#define _XAS_DRONE_H
#include <stdarg.h>
#include <sys/time.h>
#include <xas/object.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_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,
XAS_DRONE_MOOD_FLIRTY,
XAS_DRONE_MOOD_SAD,
XAS_DRONE_MOOD_ANGRY,
XAS_DRONE_MOOD_DISTRESSED
};
typedef struct _xas_drone {
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 *head;
} xas_drone;
typedef struct _xas_drone_chamber_interval {
struct timeval duration;
size_t freq_l,
freq_r;
enum xas_synth_type type_l,
type_r;
} xas_drone_chamber_interval;
typedef struct _xas_drone_chamber {
xas_drone **drones;
size_t drone_count;
xas_spatial_object *synth_bass,
*synth_l,
*synth_r;
} xas_drone_chamber;
/*
* Methods for individual drones
*/
xas_drone *xas_drone_new(xas_spatial_scene *scene,
xas_spatial_coord position,
size_t bank_entry_size,
size_t bank_entry_count);
void xas_drone_destroy(xas_drone *drone);
enum xas_drone_mood xas_drone_mood_get(xas_drone *drone);
int xas_drone_mood_set(xas_drone *drone, enum xas_drone_mood mood);
ssize_t xas_drone_sample_record(xas_drone *drone,
xas_audio_stream *source,
size_t sample_index,
size_t sample_len);
ssize_t xas_drone_sample_import(xas_drone *drone,
const char *file,
size_t sample_index);
int xas_drone_speech_import(xas_drone *drone,
const char *voice,
float speed,
size_t sample_index,
size_t sample_count,
const char **speech_lines);
int xas_drone_seq_sample(xas_drone *drone,
xas_seq *seq,
size_t sample_index,
struct timeval *now);
int xas_drone_seq_beep(xas_drone *drone,
xas_seq *seq,
enum xas_drone_mood mood,
struct timeval *now);
/*
* Methods for drone vocalisations
*/
int xas_drone_vox_set_voice(xas_drone *drone, const char *voice);
int xas_drone_vox_set_speed(xas_drone *drone, float speed);
int xas_drone_vox_vsayf(xas_drone *drone,
const char *format,
va_list args);
int xas_drone_vox_sayf(xas_drone *drone, const char *format, ...);
int xas_drone_vox_say(xas_drone *drone, const char *text);
int xas_drone_vox_save(xas_drone *drone, 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);
void xas_drone_chamber_destroy(xas_drone_chamber *chamber);
void xas_drone_chamber_insert_drone(xas_drone_chamber *chamber,
xas_drone *drone,
size_t index);
void xas_drone_chamber_set_drone_gain(xas_drone_chamber *chamber, float gain);
void xas_drone_chamber_set_synth_gain(xas_drone_chamber *chamber, float gain);
void xas_drone_chamber_set_bass_gain(xas_drone_chamber *chamber, float gain);
void xas_drone_chamber_bass_start(xas_drone_chamber *chamber);
void xas_drone_chamber_bass_stop(xas_drone_chamber *chamber);
void xas_drone_chamber_bass_set_type(xas_drone_chamber *chamber,
enum xas_synth_type type);
void xas_drone_chamber_bass_set_frequency(xas_drone_chamber *chamber,
size_t freq);
int xas_drone_chamber_seq_intervals(xas_drone_chamber *chamber,
xas_drone_chamber_interval *intervals,
xas_seq *seq,
size_t count,
struct timeval *now);
int xas_drone_chamber_seq_chorus(xas_drone_chamber *chamber,
xas_seq *seq,
size_t speech_part,
struct timeval *now);
#endif /* _XAS_DRONE_H */
|