From 739d79cff89f2792aa47813e08bdcbb3065c32de Mon Sep 17 00:00:00 2001 From: Christopher Brannon Date: Tue, 23 Jun 2009 10:01:44 -0500 Subject: [PATCH] Select audio mode before initializing espeak. --- alsa.c | 6 +++++- espeak_sound.c | 7 ++++++- espeakup.c | 1 + espeakup.h | 1 + 4 files changed, 13 insertions(+), 2 deletions(-) diff --git a/alsa.c b/alsa.c index 556cf12..daa2adc 100644 --- a/alsa.c +++ b/alsa.c @@ -100,6 +100,11 @@ static int alsa_play_callback(short *audio, int numsamples, return 0; } +void select_audio_mode(void) +{ + audio_mode = AUDIO_OUTPUT_RETRIEVAL; +} + int init_audio(unsigned int rate) { int rc; @@ -158,7 +163,6 @@ int init_audio(unsigned int rate) if (rc < 0) return sound_error(rc, "unable to set hw parameters"); - audio_mode = AUDIO_OUTPUT_RETRIEVAL; audio_callback = alsa_play_callback; return 0; } diff --git a/espeak_sound.c b/espeak_sound.c index 92e6017..826ecff 100644 --- a/espeak_sound.c +++ b/espeak_sound.c @@ -1,7 +1,12 @@ #include "espeakup.h" -int init_audio(unsigned int rate) + +void select_audio_mode(void) { audio_mode = AUDIO_OUTPUT_PLAYBACK; +} + +int init_audio(unsigned int rate) +{ audio_callback = NULL; return 0; } diff --git a/espeakup.c b/espeakup.c index 4ec7580..03760c7 100644 --- a/espeakup.c +++ b/espeakup.c @@ -133,6 +133,7 @@ int main(int argc, char **argv) } /* initialize espeak */ + select_audio_mode(); rate = espeak_Initialize(audio_mode, 0, NULL, 0); if (rate < 0) { fprintf(stderr, "Unable to initialize espeak.\n"); diff --git a/espeakup.h b/espeakup.h index afe75ad..851b597 100644 --- a/espeakup.h +++ b/espeakup.h @@ -78,6 +78,7 @@ extern int open_softsynth(void); extern void close_softsynth(void); extern void main_loop(struct synth_t *s); extern void *queue_runner(void *arg); +extern void select_audio_mode(void); extern int init_audio(unsigned int rate); extern void lock_audio_mutex(void); extern void unlock_audio_mutex(void);