Skip to content
Snippets Groups Projects
Commit 4d373219 authored by Deucе's avatar Deucе :ok_hand_tone4:
Browse files

Fix ALSA output on Linux

It seems that the "real" ALSA will actually silently fail if you
try to clear errors when no errors have occured.  The FreeBSD
emulation of ALSA does not have this insane requirement, so this
went unnoticed for the 1.1 release.

I suspect that this actually fixes SF bug 24, because ALSA is
preferred over pulseaudio.
parent b5efb545
No related branches found
No related tags found
No related merge requests found
......@@ -936,17 +936,21 @@ do_xp_play_sample(const unsigned char *sampo, size_t sz, int *freed)
int ret;
int written=0;
alsa_api->snd_pcm_prepare(playback_handle);
while(written < sz) {
ret=alsa_api->snd_pcm_writei(playback_handle, samp+written, sz-written);
if(ret < 0) {
if(written==0) {
/* Go back and try OSS */
xptone_close_locked();
alsa_device_open_failed=TRUE;
xptone_open_locked();
while (written < sz) {
ret = alsa_api->snd_pcm_writei(playback_handle, samp + written, sz - written);
if (ret < 0) {
if (alsa_api->snd_pcm_prepare(playback_handle) == 0) {
ret = 0;
}
else {
if (written == 0) {
/* Go back and try OSS */
xptone_close_locked();
alsa_device_open_failed = TRUE;
xptone_open_locked();
}
break;
}
break;
}
written += ret;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment