Subject: Re: Problems with SoundBlaster Live!
To: None <oherrala@ees2.oulu.fi, toshii@netbsd.org>
From: Izumi Tsutsui <tsutsui@ceres.dti.ne.jp>
List: current-users
Date: 03/16/2003 04:05:49
In article <20030314140112.GA23831@ee.oulu.fi>
oherrala@ees2.oulu.fi wrote:

> On Mon, Mar 10, 2003 at 04:41:17PM +0200, Ossi Herrala wrote:
> 
> > After upgrading from 1.6O to 1.6P (sources from 9.3.2003) I have had
> > problems with my sound card.
> > 
> 
> I compiled kernel with older sys/dev/pci/emuxki.c
> 
> Last working version is
> 
> 	$NetBSD: emuxki.c,v 1.18 2003/02/22 04:57:48 tsutsui Exp $ 
> 
> revisions 1.19 and 1.20 doesn't work. 1.19 has recording support added.
> Can there be something which generates problem?

Reverting changes in emuxki_voice_new() of rev 1.19
seems to fix the problem. I guess voice->dataloc.chan[]
should be free()'d before re-initialization.

---
Index: emuxki.c
===================================================================
RCS file: /cvsroot/src/sys/dev/pci/emuxki.c,v
retrieving revision 1.20
diff -u -r1.20 emuxki.c
--- emuxki.c	2003/03/03 23:49:18	1.20
+++ emuxki.c	2003/03/15 18:36:09
@@ -1298,25 +1298,26 @@
 	sc->lvoice = NULL;
 	splx(s);
 
-	if (!voice)
+	if (!voice) {
 		if (!(voice = malloc(sizeof(*voice), M_DEVBUF, M_WAITOK)))
 			return (NULL);
 
-	voice->sc = sc;
-	voice->state = !EMU_VOICE_STATE_STARTED;
-	voice->stereo = EMU_VOICE_STEREO_NOTSET;
-	voice->b16 = 0;
-	voice->sample_rate = 0;
-	if (use & EMU_VOICE_USE_PLAY)
-		voice->dataloc.chan[0] = voice->dataloc.chan[1] = NULL;
-	else
-		voice->dataloc.source = EMU_RECSRC_NOTSET;
-	voice->buffer = NULL;
-	voice->blksize = 0;
-	voice->trigblk = 0;
-	voice->blkmod = 0;
-	voice->inth = NULL;
-	voice->inthparam = NULL;
+		voice->sc = sc;
+		voice->state = !EMU_VOICE_STATE_STARTED;
+		voice->stereo = EMU_VOICE_STEREO_NOTSET;
+		voice->b16 = 0;
+		voice->sample_rate = 0;
+		if (use & EMU_VOICE_USE_PLAY)
+			voice->dataloc.chan[0] = voice->dataloc.chan[1] = NULL;
+		else
+			voice->dataloc.source = EMU_RECSRC_NOTSET;
+		voice->buffer = NULL;
+		voice->blksize = 0;
+		voice->trigblk = 0;
+		voice->blkmod = 0;
+		voice->inth = NULL;
+		voice->inthparam = NULL;
+	}
 	voice->use = use;
 
 	s = splaudio();

---
Izumi Tsutsui
tsutsui@ceres.dti.ne.jp