wave_sada: make use of the device parameter to wave_open

This commit is contained in:
Reece H. Dunn
2015-12-31 15:29:13 +00:00
parent 104a9de6da
commit fee1ca32b5
+5 -18
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;