Skip to content
Snippets Groups Projects
Commit 123f60d7 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 1dec0195
No related branches found
No related tags found
1 merge request!463MRC mods by Codefenix (2024-10-20)
Pipeline #1542 passed
......@@ -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.
Please register or to comment