NetBSD Problem Report #2587
From gnats Mon Jul 1 15:08:15 1996
Received: from strauss.coda.cs.cmu.edu by pain.lcs.mit.edu (8.7.5/8.7.3) with SMTP id OAA25016 for <gnats-bugs@gnats.netbsd.org>; Mon, 1 Jul 1996 14:58:36 -0400 (EDT)
Message-Id: <199607011858.OAA25016@pain.lcs.mit.edu>
Date: Mon, 1 Jul 96 14:57:54 EDT
From: rvb@cs.cmu.edu
Sender: rvb+@strauss.coda.cs.cmu.edu
Reply-To: rvb@cs.cmu.edu
To: gnats-bugs@NetBSD.ORG
Subject: src/sys/dev/isa/sbdsp.c
X-Send-Pr-Version: 3.95
>Number: 2587
>Category: port-i386
>Synopsis: audio does not sound right
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: gnats-admin
>State: closed
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Mon Jul 01 15:20:02 +0000 1996
>Closed-Date: Thu Mar 20 15:50:39 +0000 1997
>Last-Modified: Thu Mar 20 16:04:39 +0000 1997
>Originator: Robert V. Baron
>Release: 1.1
>Organization:
>Environment:
System: NetBSD strauss.coda.cs.cmu.edu 1.1 NetBSD 1.1 (CCODA) #14: Wed Jun 19 14:56:34 EDT 1996 bnoble@telemann.coda.cs.cmu.edu:/usr1/bnoble/kernel_tree/src/sys/arch/i386/compile/CCODA i386
>Description:
sbdsp_round_blocksize(addr, blk) has a couple of problems: The
check below (see code) seems pretty braindead. For 8k sample blk =
160 and is left alone. For 16k which has blk = 320 the code kicks in
and yields blk = 2048. This causes a rather poor audio sound. I
think the code should be removed. I have done so for the function
provided in the code listing below. The change is under #ifdef new
Note: The code being commented out itself is wrong for another reason.
For the SB16 it tests the straight rates as follows:
if (sc->sc_orate > 8000 || sc->sc_irate > 8000)
blk = NBPG/2;
But for the time constant rate is checks
if (sc->sc_otc > SB_8K || sc->sc_itc < SB_8K)
blk = NBPG/2;
The < would appear to be a typo.
>How-To-Repeat:
To get the problem to appear, you either have to use /dev/sound
with a sampling rate higher than 8k. Or use /dev/audio and set both
the sampling rate and also the precision or number of channels. (The
value of the precision/channels can be the default -- it just must be set.)
>Fix:
sbdsp_round_blocksize(addr, blk)
void *addr;
int blk;
{
register struct sbdsp_softc *sc = addr;
sc->sc_last_hs_size = 0;
/* Higher speeds need bigger blocks to avoid popping and silence gaps. */
if (blk < NBPG/4 || blk > NBPG/2) {
#define new
#ifdef new
/*
* The check below seems pretty braindead. For 8k sample blk = 160
* and is left alone. For 16k which has blk = 320 [or for 8k+epsilon]
* the code kicks in and yields blk = 2048 !!!!!!!!!!!
*/
#else
if (ISSB16CLASS(sc)) {
if (sc->sc_orate > 8000 || sc->sc_irate > 8000)
blk = NBPG/2;
} else {
if (sc->sc_otc > SB_8K || sc->sc_itc < SB_8K)
blk = NBPG/2;
}
#endif
#undef new
}
/* don't try to DMA too much at once, though. */
if (blk > NBPG)
blk = NBPG;
if (sc->sc_channels == 2)
return (blk & ~1); /* must be even to preserve stereo separation */
else
return (blk); /* Anything goes :-) */
}
>Release-Note:
>Audit-Trail:
State-Changed-From-To: open->closed
State-Changed-By: mycroft
State-Changed-When: Thu Mar 20 07:50:39 PST 1997
State-Changed-Why:
Fixed.
>Unformatted:
(Contact us)
$NetBSD: query-full-pr,v 1.51 2026/08/10 02:28:17 riastradh Exp $
$NetBSD: gnats_config.sh,v 1.10 2026/05/13 22:00:09 riastradh Exp $
Copyright © 1994-2026
The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.