From sanpei@sanpei.org  Sat Nov 14 05:58:41 1998
Received: from titanium.yy.ics.keio.ac.jp (titanium.yy.ics.keio.ac.jp [131.113.47.73])
          by hub.freebsd.org (8.8.8/8.8.8) with ESMTP id FAA15583
          for <FreeBSD-gnats-submit@freebsd.org>; Sat, 14 Nov 1998 05:58:38 -0800 (PST)
          (envelope-from sanpei@sanpei.org)
Received: from lavender.sanpei.org (u4168.seaple.icc.ne.jp [203.140.32.168])
	by titanium.yy.ics.keio.ac.jp (8.8.8+3.0Wbeta13/3.7W) with ESMTP id WAA12738;
	Sat, 14 Nov 1998 22:58:04 +0900 (JST)
Received: (from sanpei@localhost)
	by lavender.sanpei.org (8.8.8/3.6W) id WAA10827;
	Sat, 14 Nov 1998 22:58:02 +0900 (JST)
Message-Id: <199811141358.WAA10827@lavender.sanpei.org>
Date: Sat, 14 Nov 1998 22:58:02 +0900 (JST)
From: sanpei@sanpei.org
Reply-To: sanpei@sanpei.org
To: FreeBSD-gnats-submit@freebsd.org
Subject: [Patch] Sound only come out from left channel with SBPro/pcm0
X-Send-Pr-Version: 3.2

>Number:         8684
>Category:       i386
>Synopsis:       [Patch] Sound only come out from left channel with SBPro/pcm0
>Confidential:   no
>Severity:       serious
>Priority:       high
>Responsible:    luigi
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Sat Nov 14 06:00:00 PST 1998
>Closed-Date:    Sun Jan 3 08:10:34 PST 1999
>Last-Modified:  Sun Jan  3 08:11:23 PST 1999
>Originator:     MIHIRA Yoshiro
>Release:        FreeBSD 3.0-RELEASE i386
>Organization:
Keio UNIV.
>Environment:

	pcm0 driver under SoundBlasterPro mode
	I tested ESS1868 chip(with SounBlasterPro mode)
	     and ESS688 chip.

	This problem is in 2.2-stable and 3.0-current source tree.

>Description:

	Some one reported at FreeBSD-hardware mailing list,
	that ``The sound only come out of the left channel''
	with ESS1868 chip and pcm0.
	Message-ID: <362E17BD.A41AD5BD@bellatlantic.net>

	If use VoxWare, it's fine, sound come out from both channel.

	Luigi's pcm0 driver use change_bits function which is
	originated from VoxWare driver.

	But ``change_bits'' was change from VoxWare as below.

VoxWare:(/sys/i386/isa/sound/sb_mixer.c)
189:	shift = (*iomap)[dev][chn].bitoffs - (*iomap)[dev][LEFT_CHN].nbits + 1;
pcm0:(/sys/i386/isa/snd/sound.c)
1447:	shift = (*t)[dev][chn].bitoffs /*- (*t)[dev][LEFT_CHN].nbits + 1*/;
	                               ~~                               ~~
	And also changed some header files.

VoxWare for SoundBlaster 16:(/sys/i386/isa/sound/sb_mixer.h)
155:	MIX_ENT(SOUND_MIXER_VOLUME,	0x30, 7, 5, 0x31, 7, 5),
pcm0 for SoundBlaster 16:(/sys/i386/isa/snd/sbcard.h)
310:    PMIX_ENT(SOUND_MIXER_VOLUME,	0x30, 3, 5, 0x31, 3, 5),
	                                      ~           ~
                                        A1    B1 C1 A2    B2 C3

		A: port-offset B: bit-offset C: number of bits
		1: left channel, 2: right channel
		[B of pcm0] = [B of VoxWare] - [C of Voxware] + 1;
		B1 of pcm0 = 3 = 7 - 5 + 1

	But mixertable for SoundBlasterPro and sgnxpro(?) were not
	changed, there are still same as Voxware :-<

VoxWare for SoundBlasterPro :(/sys/i386/isa/sound/sb_mixer.h)
121:	MIX_ENT(SOUND_MIXER_VOLUME,	0x22, 7, 4, 0x22, 3, 4),
pcm0 for SoundBlasterPro:(/sys/i386/isa/snd/sbcard.h)
267:	PMIX_ENT(SOUND_MIXER_VOLUME,	0x22, 7, 4, 0x22, 3, 4),
	                                      ~           ~
	I think Luigi forgot to change these values.
	I made patch file and appended this send-pr.

	BTW, I think some files which are in /sys/i386/isa/snd/
	are needed to add $Id$.

>How-To-Repeat:

	probe SounBlasterPro compatible card with pcm0
	and play back some sounds file.

>Fix:

	
--- sys/i386/isa/snd/sbcard.h.org	Fri Nov 13 02:26:00 1998
+++ sys/i386/isa/snd/sbcard.h	Sat Nov 14 21:49:16 1998
@@ -264,15 +264,15 @@
 static u_char sb16_recmasks_R[SOUND_MIXER_NRDEVICES];
 #else /* __SB_MIXER_C__ defined */
 mixer_tab       sbpro_mix = {
-    PMIX_ENT(SOUND_MIXER_VOLUME,  0x22, 7, 4, 0x22, 3, 4),
+    PMIX_ENT(SOUND_MIXER_VOLUME,  0x22, 4, 4, 0x22, 0, 4),
     PMIX_ENT(SOUND_MIXER_BASS,    0x00, 0, 0, 0x00, 0, 0),
     PMIX_ENT(SOUND_MIXER_TREBLE,  0x00, 0, 0, 0x00, 0, 0),
-    PMIX_ENT(SOUND_MIXER_SYNTH,   0x26, 7, 4, 0x26, 3, 4),
-    PMIX_ENT(SOUND_MIXER_PCM,     0x04, 7, 4, 0x04, 3, 4),
+    PMIX_ENT(SOUND_MIXER_SYNTH,   0x26, 4, 4, 0x26, 0, 4),
+    PMIX_ENT(SOUND_MIXER_PCM,     0x04, 4, 4, 0x04, 0, 4),
     PMIX_ENT(SOUND_MIXER_SPEAKER, 0x00, 0, 0, 0x00, 0, 0),
-    PMIX_ENT(SOUND_MIXER_LINE,    0x2e, 7, 4, 0x2e, 3, 4),
-    PMIX_ENT(SOUND_MIXER_MIC,     0x0a, 2, 3, 0x00, 0, 0),
-    PMIX_ENT(SOUND_MIXER_CD,      0x28, 7, 4, 0x28, 3, 4),
+    PMIX_ENT(SOUND_MIXER_LINE,    0x2e, 4, 4, 0x2e, 0, 4),
+    PMIX_ENT(SOUND_MIXER_MIC,     0x0a, 0, 3, 0x00, 0, 0),
+    PMIX_ENT(SOUND_MIXER_CD,      0x28, 4, 4, 0x28, 0, 4),
     PMIX_ENT(SOUND_MIXER_IMIX,    0x00, 0, 0, 0x00, 0, 0),
     PMIX_ENT(SOUND_MIXER_ALTPCM,  0x00, 0, 0, 0x00, 0, 0),
     PMIX_ENT(SOUND_MIXER_RECLEV,  0x00, 0, 0, 0x00, 0, 0)
@@ -280,15 +280,15 @@
 
 #ifdef	__SGNXPRO__
 mixer_tab       sgnxpro_mix = {
-    PMIX_ENT(SOUND_MIXER_VOLUME,  0x22, 7, 4, 0x22, 3, 4),
-    PMIX_ENT(SOUND_MIXER_BASS,    0x46, 2, 3, 0x00, 0, 0),
-    PMIX_ENT(SOUND_MIXER_TREBLE,  0x44, 2, 3, 0x00, 0, 0),
-    PMIX_ENT(SOUND_MIXER_SYNTH,   0x26, 7, 4, 0x26, 3, 4),
-    PMIX_ENT(SOUND_MIXER_PCM,     0x04, 7, 4, 0x04, 3, 4),
-    PMIX_ENT(SOUND_MIXER_SPEAKER, 0x42, 2, 3, 0x00, 0, 0),
-    PMIX_ENT(SOUND_MIXER_LINE,    0x2e, 7, 4, 0x2e, 3, 4),
-    PMIX_ENT(SOUND_MIXER_MIC,     0x0a, 2, 3, 0x00, 0, 0),
-    PMIX_ENT(SOUND_MIXER_CD,      0x28, 7, 4, 0x28, 3, 4),
+    PMIX_ENT(SOUND_MIXER_VOLUME,  0x22, 4, 4, 0x22, 0, 4),
+    PMIX_ENT(SOUND_MIXER_BASS,    0x46, 0, 3, 0x00, 0, 0),
+    PMIX_ENT(SOUND_MIXER_TREBLE,  0x44, 0, 3, 0x00, 0, 0),
+    PMIX_ENT(SOUND_MIXER_SYNTH,   0x26, 4, 4, 0x26, 0, 4),
+    PMIX_ENT(SOUND_MIXER_PCM,     0x04, 4, 4, 0x04, 0, 4),
+    PMIX_ENT(SOUND_MIXER_SPEAKER, 0x42, 0, 3, 0x00, 0, 0),
+    PMIX_ENT(SOUND_MIXER_LINE,    0x2e, 4, 4, 0x2e, 0, 4),
+    PMIX_ENT(SOUND_MIXER_MIC,     0x0a, 0, 3, 0x00, 0, 0),
+    PMIX_ENT(SOUND_MIXER_CD,      0x28, 4, 4, 0x28, 0, 4),
     PMIX_ENT(SOUND_MIXER_IMIX,    0x00, 0, 0, 0x00, 0, 0),
     PMIX_ENT(SOUND_MIXER_ALTPCM,  0x00, 0, 0, 0x00, 0, 0),
     PMIX_ENT(SOUND_MIXER_RECLEV,  0x00, 0, 0, 0x00, 0, 0),
>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: freebsd-bugs->luigi 
Responsible-Changed-By: luigi 
Responsible-Changed-When: Sun Dec 27 04:28:19 PST 1998 
Responsible-Changed-Why:  
pcm maintainer 

From: MIHIRA Sanpei Yoshiro <sanpei@sanpei.org>
To: freebsd-gnats-submit@freebsd.org, sanpei@sanpei.org
Cc:  Subject: Re: i386/8684: [Patch] Sound only come out from left channel with SBPro/pcm0
Date: Mon, 04 Jan 1999 00:22:52 +0900

   I'm original Problem reporter.
 
   This PR was solved below commit. Please close this PR.
 
 http://www.freebsd.org/cgi/cvsweb.cgi/src/sys/i386/isa/snd/sbcard.h
 >1.3.2.4 Mon Dec 14 17:18:05 1998 UTC by luigi 
 >Branch: RELENG_2_2 
 >
 >MFC: fix some problems with the sbpro mixer, add partial
 >support for ESS.
 
 >1.6 Thu Dec 10 18:36:10 1998 UTC by brian 
 >CVS Tags: HEAD
 >
 >Support ESS1868 (and probably ESS688 & ESS1668).
 >Submitted by: Max Khon <fjoe@husky.iclub.nsu.ru>
 
 Thank you
 MIHIRA Yoshiro
State-Changed-From-To: open->closed 
State-Changed-By: luigi 
State-Changed-When: Sun Jan 3 08:10:34 PST 1999 
State-Changed-Why:  
fixed by commits in mid december -- luigi 
>Unformatted:
