Skip to contentSkip to conversation

trouble with dosemu and alsa oss emulation (and a fix for alsa)

DISCUSSION Vedran Rodic 3 participants 4 messages Sep 6, 2003 – Sep 8, 2003

lore
Share & tools
lore
#0 lore raw

Hi.

I'm having trouble with latest ALSA and oss emulation. I'm using dosemu to play some DOS games and I've noticed that sound in DOS apps stops playing after short time (depending on the app).

I'm regulary updating both alsa and dosemu, I suspected dosemu first, since I had no problems whatsoever with alsa oss emulation.

It turned out that this was not dosemu problem, but alsa oss emulation problem. I've tracked it down to a change in alsa-kernel/core/oss/pcm_oss.c. The change is here:
http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/alsa/alsa-kernel/core/oss/pcm_oss.c.diff?r1=1.40&r2=1.41

I'm currently using the latest pcm_oss.c but without this patch and it works great again.

I think that dosemu code - src/arch/linux/dosext/sound/linux_sound.c is correct.

Anyway, here's a couple of lines from dosemu sound log, starting arround where IOCTL error appears:

SB:[Linux] Get Free Fragments (16, 0) SB:[Linux] Get Free Fragments (16, 0)
SB: Read 0x7f from DSP Write Buffer Status Register
SB: Going to write 128 bytes
SB:[Linux] Get Free Fragments (16, 0) SB:[Linux] Get Free Fragments (16, 0)
SB: DSP command 0xd0 accepted
SB: Pausing DMA transfer, 256 bytes left
SB: Read 0x7e from DSP Write Buffer Status Register
SB: DSP command 0xd4 accepted
SB: Going to write 128 bytes
SB:[Linux] Get Free Fragments IOCTL error (Broken pipe) SB:[Linux] Get Free Fragments IOCTL error (Broken pipe)
SB: Going to write 128 bytes
SB:[Linux] Get Free Fragments IOCTL error (Broken pipe) SB:[Linux] Get Free Fragments IOCTL error (Broken pipe)
SB: Going to write 128 bytes

Vedran

-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf

#1 lore raw

Hi,

Quoted 15 lines · Vedran Rodic

Hi.

I'm having trouble with latest ALSA and oss emulation. I'm using dosemu to play some DOS games and I've noticed that sound in DOS apps stops playing after short time (depending on the app).

I'm regulary updating both alsa and dosemu, I suspected dosemu first, since I had no problems whatsoever with alsa oss emulation.

It turned out that this was not dosemu problem, but alsa oss emulation problem. I've tracked it down to a change in alsa-kernel/core/oss/pcm_oss.c. The change is here:
http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/alsa/alsa-kernel/core/oss/pcm_oss.c.diff?r1=1.40&r2=1.41

Quoted 5 lines

I'm currently using the latest pcm_oss.c but without this patch and it works great again.

I think that dosemu code - src/arch/linux/dosext/sound/linux_sound.c is correct.

Yeah, I know I tried dosemu with the ALSA OSS emulation before, and it worked mostly correct (surprisingly enough!). I'm glad you spotted this regression, it might have gone overlooked for some time otherwise.

DOSEMU really needs the native ALSA sound output... one of these days ;)

Signature · 1 line
Ryan Underwood, <nemesis at icequake.net>, icq=10317253
#2 lore raw
In reply to Vedran Rodic
Quoted 7 lines · Vedran Rodic

Hi.

I'm having trouble with latest ALSA and oss emulation. I'm using dosemu to play some DOS games and I've noticed that sound in DOS apps stops playing after short time (depending on the app).

Quoted 7 lines

I'm regulary updating both alsa and dosemu, I suspected dosemu first, since I had no problems whatsoever with alsa oss emulation.

It turned out that this was not dosemu problem, but alsa oss emulation problem. I've tracked it down to a change in alsa-kernel/core/oss/pcm_oss.c. The change is here:
http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/alsa/alsa-kernel/core/oss/pcm_oss.c.diff?r1=1.40&r2=1.41

Please, try patch bellow.

Jaroslav

Index: pcm_oss.c
===================================================================
RCS file: /cvsroot/alsa/alsa-kernel/core/oss/pcm_oss.c,v retrieving revision 1.47

pcm_oss.c +10 -1
diff -u -r1.47 pcm_oss.c
@@ -1394,6 +1394,10 @@
 	}
 	if (stream == SNDRV_PCM_STREAM_PLAYBACK) {
 		err = snd_pcm_kernel_ioctl(substream, SNDRV_PCM_IOCTL_DELAY, &delay);
+		if (err == -EPIPE || err == -ESTRPIPE) {
+			err = 0;
+			delay = 0;
+		}
 	} else {
 		err = snd_pcm_oss_capture_position_fixup(substream, &delay);
 	}
@@ -1454,7 +1458,12 @@
 	} else {
 		if (stream == SNDRV_PCM_STREAM_PLAYBACK) {
 			err = snd_pcm_kernel_ioctl(substream, SNDRV_PCM_IOCTL_DELAY, &avail);
-			avail = runtime->buffer_size - avail;
+			if (err == -EPIPE || err == -ESTRPIPE) {
+				avail = runtime->buffer_size;
+				err = 0;
+			} else {
+				avail = runtime->buffer_size - avail;
+			}
 		} else {
 			err = snd_pcm_oss_capture_position_fixup(substream, &avail);
 		}

-----
Jaroslav Kysela <[email protected]>
Linux Kernel Sound Maintainer
ALSA Project, SuSE Labs

-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf

#3 lore raw
Quoted 12 lines · Jaroslav Kysela
Quoted 10 lines · Vedran Rodic

Hi.

I'm having trouble with latest ALSA and oss emulation. I'm using dosemu to play some DOS games and I've noticed that sound in DOS apps stops playing after short time (depending on the app).

I'm regulary updating both alsa and dosemu, I suspected dosemu first, since I had no problems whatsoever with alsa oss emulation.

Quoted 6 lines
Quoted 4 lines

It turned out that this was not dosemu problem, but alsa oss emulation problem. I've tracked it down to a change in alsa-kernel/core/oss/pcm_oss.c. The change is here:
http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/alsa/alsa-kernel/core/oss/pcm_oss.c.diff?r1=1.40&r2=1.41

Please, try patch bellow.

It solved the problem. Thanks

Vedran