Browse Source

wave_sada: make use of the device parameter to wave_open

master
Reece H. Dunn 9 years ago
parent
commit
fee1ca32b5
1 changed files with 5 additions and 18 deletions
  1. 5
    18
      src/libespeak-ng/wave_sada.c

+ 5
- 18
src/libespeak-ng/wave_sada.c View File

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

Loading…
Cancel
Save