Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 24 May 2000 11:17:21 +0300
From:      Maxim Sobolev <SoboMax@FreeBSD.org>
To:        daeron@wit401305.student.utwente.nl
Cc:        cg@FreeBSD.org, multimedia@FreeBSD.org
Subject:   Re: cvs commit: ports/audio/wsoundserver Makefile  ports/audio/wsoundserver/files md5 ports/audio/wsoundserver/patches  patch-aa patch-ab patch-ac patch-ad ports/audio/wsoundserver/pkg DESCR  PLIST
Message-ID:  <392B9011.368FEC6B@FreeBSD.org>
References:  <200005230633.XAA68264@freefall.freebsd.org> <20000524021016.A24438@shadowmere.student.utwente.nl> <392B7DEB.9344C331@FreeBSD.org> <20000524095458.C71443@shadowmere.student.utwente.nl>

next in thread | previous in thread | raw e-mail | index | archive | help
This is a multi-part message in MIME format.
--------------F189634FBF935B75CB181369
Content-Type: text/plain; charset=koi8-r
Content-Transfer-Encoding: 7bit

Pascal Hofstee wrote:

> On Wed, May 24, 2000 at 09:59:55AM +0300, Maxim Sobolev wrote:
> > Pascal Hofstee wrote:
> > Yes, it is already in my TODO list ;).
> >
> > BTW, there is some problem with playing short sounds, at least on my -current
> > with OPL3-SA soundcard. It seems that if length of sound is less that default
> > buffer used to write sounds (8k for 8 bit and 4k for 16 bit) then it simple
> > doesn't produce any sound. Reducing length of the buffer helps, but it might be
> > not the ideal solution. Now I'm looking into the problem and probably will came
> > with the workaround soon.
>
> This problem is something that i noticed quite a while back around the
> first time the emu10k-support was introduced into CURRENT .... from that
> moment on Any wav file that i try to play basically just "skips" the first
> x couple of frames ... i am still convinced this si a bug in the current
> pcm-code

Yes, it is definitely a bug in the pcm driver. It seems that driver needs at least
two write() operations for sound to be actually played. With this message I'm
attaching small workarround which seems fix this problem in wsoundserver, at least
for my OPL3-SA card. Probably we should contact Cameron (he is the current maintainer
of the pcm stuff), for proper kernel fix.

-Maxim



--------------F189634FBF935B75CB181369
Content-Type: text/plain; charset=koi8-r;
 name="wsound.patch"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
 filename="wsound.patch"

--- wslib/audio_voxware.c.orig	Fri Mar 31 23:14:40 2000
+++ wslib/audio_voxware.c	Wed May 24 11:08:24 2000
@@ -403,6 +403,7 @@
 	long		blkFrames;		/* number of frames in current audio block */
 	int		blockSize = 8192;	/* Size of an audio block buffer in frames */
 	int		i;
+	u_int8_t	fakebuffer[2] = {0, 0};
 
 #ifdef DEBUG
 	fprintf(stderr, " >> writing data\n");
@@ -413,7 +414,11 @@
 		SErrorCode = SERR_NOMEMORY;
 		return -1;
 	}
-	
+
+	/* Following line is a simple workarround for buggy pcm driver, which seens need at least to write()
+	   calls for sound to be actually played */
+	write(audiofd, fakebuffer, 2);
+
 	curFrame = 0;
 	while (curFrame < afInfo->FrameCount) {
 		if ((blkFrames = (afInfo->FrameCount - curFrame)) > blockSize) {
@@ -503,6 +508,7 @@
 	long		blkFrames;		/* number of frames in current audio block */
 	int		blockSize = 4096;	/* Size of an audio block buffer in frames */
 	int		i;
+	u_int16_t	fakebuffer[2] = {0, 0};
 
 #ifdef DEBUG
 	fprintf(stderr, " >> writing data\n");
@@ -513,7 +519,11 @@
 		SErrorCode = SERR_NOMEMORY;
 		return -1;
 	}
-	
+
+	/* Following line is a simple workarround for buggy pcm driver, which seens need at least to write()
+	   calls for sound to be actually played */
+	write(audiofd, fakebuffer, 4);
+
 	curFrame = 0;
 	while (curFrame < afInfo->FrameCount) {
 		if ((blkFrames = (afInfo->FrameCount - curFrame)) > blockSize) {

--------------F189634FBF935B75CB181369--



To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-multimedia" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?392B9011.368FEC6B>