sound driver 3.5,4 and sound blaster

Ulrich Windl (
Mon, 27 Jan 1997 08:33:06 +0100

Dear Hannu and other sound hackers,

I'm very new to sound programming, but I have inspected the sound driver
code for Linux-2.0.28, and I have some notes (sound driver 3.5.4):

In sb_common.c the ordinary Soundi Blaster is written in lower case letters,
while the later "Blasters" are written with capitalized spelling. Maybe
change the first string, too. The string is used requesting the I/O port
region. For consistency, shouldn't "hw_config->name" be used for statements
sound_alloc_dma (devc->dma8, "Sound Blaster8")

Why is there a SB_NO_MIDI for DSP version 4 (SB 16 and SB 32)?

The mixer of a Sound Blaster 16 (CT1745) is not detected and there
is no code to support it. It has a finer resolution than the

Card config:
Sound Blaster at 0x220 irq 5 drq 1,5
SB MPU-401 at 0x330 irq 5 drq 0
OPL-2/OPL-3 FM at 0x388 drq 0

Audio devices:
0: Sound Blaster 16 (4.13)

Synth devices:
0: Yamaha OPL-3

Midi devices:
0: Sound Blaster 16

0: System clock

0: Sound Blaster

for the CT1745 the "Automatic Gain Control" register is missing for sb16_mix:
bit 0 of register 0x43 controls AGC inversely (0=AGC on; 1=-20dB).
The defaults for some mixer settings are too high (Bass, Treble, Input Gain,
Output Gain, ...).

The additional mixer switches for assigning left or right channels are missing
for the CT1745 (registers 0x3c, 0x3d, 0x3e).

I also think that all the values for bit_l and bit_r in sb_mixer.h are
"one too small": Having "(1 << n) - 1" (see change_bits routine) you need
n == 8 to get "128 - 1" == 0xff.
With that correction the " + 1" in change_bits should also go away.

mask = (1 << (*devc->iomap)[dev][chn].nbits) - 1;
newval = (int) ((newval * mask) + 50) / 100; /* Scale */

shift = (*devc->iomap)[dev][chn].bitoffs -
(*devc->iomap)[dev][LEFT_CHN].nbits + 1;

*regval &= ~(mask << shift); /* Mask out previous value */
*regval |= (newval & mask) << shift; /* Set the new value */

Ulrich Windl