From fee1ca32b5c1fe86f4c8633b0e261b9cfc390a38 Mon Sep 17 00:00:00 2001 From: "Reece H. Dunn" Date: Thu, 31 Dec 2015 15:29:13 +0000 Subject: [PATCH] wave_sada: make use of the device parameter to wave_open --- src/libespeak-ng/wave_sada.c | 23 +++++------------------ 1 file changed, 5 insertions(+), 18 deletions(-) diff --git a/src/libespeak-ng/wave_sada.c b/src/libespeak-ng/wave_sada.c index 152333b1..4096afa4 100644 --- a/src/libespeak-ng/wave_sada.c +++ b/src/libespeak-ng/wave_sada.c @@ -76,30 +76,17 @@ static uint32_t wave_samplerate; // void *wave_open(int srate, const char *device) { - (void)device; // unused + if (device == NULL) + device = sun_audio_device; audio_info_t ainfo; - char *audio_device = NULL; wave_samplerate = srate; - audio_device = getenv("AUDIODEV"); - if (audio_device != NULL) { - if ((sun_audio_fd = open(audio_device, O_WRONLY)) < 0) { - fprintf(stderr, "wave_open() could not open: %s (%d)\n", - audio_device, sun_audio_fd); - } - } - - if (sun_audio_fd < 0) { - if ((sun_audio_fd = open(sun_audio_device, O_WRONLY)) < 0) { - fprintf(stderr, "wave_open() could not open: %s (%d)\n", - sun_audio_device, sun_audio_fd); - } - } - - if (sun_audio_fd < 0) + if ((sun_audio_fd = open(device, O_WRONLY)) < 0) { + fprintf(stderr, "wave_open() could not open: %s (%d)\n", device, sun_audio_fd); return NULL; + } ioctl(sun_audio_fd, AUDIO_GETINFO, &ainfo); ainfo.play.encoding = AUDIO_ENCODING_LINEAR;