summaryrefslogtreecommitdiffstats
path: root/examples/say.c
diff options
context:
space:
mode:
Diffstat (limited to 'examples/say.c')
-rw-r--r--examples/say.c27
1 files changed, 18 insertions, 9 deletions
diff --git a/examples/say.c b/examples/say.c
index e0aea9a..8741a10 100644
--- a/examples/say.c
+++ b/examples/say.c
@@ -75,8 +75,10 @@ int main(int argc, char **argv) {
xas_bank *bank;
xas_vox *vox;
+ xas_bank_player *player;
+
xas_audio_stream *voice,
- *bank_stream,
+ *player_stream,
*synth_l,
*synth_r,
*output;
@@ -105,6 +107,10 @@ int main(int argc, char **argv) {
goto error_bank_new;
}
+ if ((player = xas_bank_player_new(bank)) == NULL) {
+ goto error_bank_player_new;
+ }
+
if ((output = xas_riff_new_file(argv[1],
format,
O_WRONLY | O_CREAT | O_TRUNC)) == NULL) {
@@ -115,8 +121,8 @@ int main(int argc, char **argv) {
goto error_vox_stream_new;
}
- if ((bank_stream = xas_bank_stream_new(bank)) == NULL) {
- goto error_bank_stream_new;
+ if ((player_stream = xas_bank_player_stream_new(player)) == NULL) {
+ goto error_bank_player_stream_new;
}
if ((synth_l = xas_synth_new((xas_synth_callback_sample)sine_sample,
@@ -139,7 +145,7 @@ int main(int argc, char **argv) {
goto error_mixer_new;
}
- if (xas_mixer_input_add(mixer, bank_stream, 1.0, 0.0) == NULL) {
+ if (xas_mixer_input_add(mixer, player_stream, 1.0, 0.0) == NULL) {
goto error_mixer_input_add;
}
@@ -166,8 +172,8 @@ int main(int argc, char **argv) {
void *buf;
ssize_t readlen;
- if (i >= 300 && !xas_bank_active(bank)) {
- xas_bank_play(bank, 0, 1.0);
+ if (i >= 300 && !xas_bank_player_playing(player)) {
+ xas_bank_player_start(player, 0, 1.0);
}
if ((readlen = xas_audio_stream_read(mixer->output,
@@ -186,7 +192,7 @@ int main(int argc, char **argv) {
xas_mixer_destroy(mixer);
xas_audio_stream_destroy(synth_r);
xas_audio_stream_destroy(synth_l);
- xas_audio_stream_destroy(bank_stream);
+ xas_audio_stream_destroy(player_stream);
xas_audio_stream_destroy(voice);
xas_audio_stream_destroy(output);
@@ -208,15 +214,18 @@ error_synth_new_r:
xas_audio_stream_destroy(synth_l);
error_synth_new_l:
- xas_audio_stream_destroy(bank_stream);
+ xas_audio_stream_destroy(player_stream);
-error_bank_stream_new:
+error_bank_player_stream_new:
xas_audio_stream_destroy(voice);
error_vox_stream_new:
xas_audio_stream_destroy(output);
error_riff_new_file:
+ xas_bank_player_destroy(player);
+
+error_bank_player_new:
xas_bank_destroy(bank);
error_bank_new: