Select audio mode before initializing espeak.

This commit is contained in:
Christopher Brannon 2009-06-23 10:01:44 -05:00 committed by William Hubbs
commit 739d79cff8
4 changed files with 13 additions and 2 deletions

6
alsa.c
View file

@ -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;
}

View file

@ -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;
}

View file

@ -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");

View file

@ -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);