Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 26 Nov 2005 00:20:06 GMT
From:      Juha-Matti Tilli <juhis@nallukka.net>
To:        freebsd-multimedia@FreeBSD.org
Subject:   Re: kern/72221: [sound] emu10k1 stereo channels are reversed (5.3-beta6)
Message-ID:  <200511260020.jAQ0K6tZ064543@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help
The following reply was made to PR kern/72221; it has been noted by GNATS.

From: Juha-Matti Tilli <juhis@nallukka.net>
To: bug-followup@FreeBSD.org, mkb@mukappabeta.de
Cc:  
Subject: Re: kern/72221: [sound] emu10k1 stereo channels are reversed (5.3-beta6)
Date: Sat, 26 Nov 2005 02:13:03 +0200

 I have also the problem on 6.0-RELEASE. I think I have found the change
 which reversed the channels. Revision 1.44 of emu10k1.c, which added
 Audigy support, has the line
 
 emu_wrptr(sc, v->vnum, FXRT, 0xd01c0000);
 
 replaced with the following lines:
 
 if (sc->audigy) {
         emu_wrptr(sc, v->vnum, A_FXRT1, v->fxrt1);
         emu_wrptr(sc, v->vnum, A_FXRT2, v->fxrt2);
         emu_wrptr(sc, v->vnum, A_SENDAMOUNTS, 0);
 }
 else
         emu_wrptr(sc, v->vnum, FXRT, v->fxrt1 << 16);
 
 where v->fxrt1 << 16 == 0xd10c0000
 
 Here's a patch to correct the order of the channels:
 
 --- emu10k1.c.orig      Tue Mar  1 10:58:05 2005
 +++ emu10k1.c   Sat Nov 26 02:00:56 2005
 @@ -494,12 +494,12 @@
         m->buf = tmp_addr;
         m->slave = s;
         if (sc->audigy) {
 -               m->fxrt1 = FXBUS_MIDI_CHORUS | FXBUS_PCM_LEFT << 8 |
 -                   FXBUS_PCM_RIGHT << 16 | FXBUS_MIDI_REVERB << 24;
 +               m->fxrt1 = FXBUS_MIDI_CHORUS | FXBUS_PCM_RIGHT << 8 |
 +                   FXBUS_PCM_LEFT << 16 | FXBUS_MIDI_REVERB << 24;
                 m->fxrt2 = 0x3f3f3f3f;  /* No effects on second route */
         } else {
 -               m->fxrt1 = FXBUS_MIDI_CHORUS | FXBUS_PCM_LEFT << 4 |
 -                   FXBUS_PCM_RIGHT << 8 | FXBUS_MIDI_REVERB << 12;
 +               m->fxrt1 = FXBUS_MIDI_CHORUS | FXBUS_PCM_RIGHT << 4 |
 +                   FXBUS_PCM_LEFT << 8 | FXBUS_MIDI_REVERB << 12;
                 m->fxrt2 = 0;
         }
 
 
 I don't have Audigy, so I'm not sure if the problem affects Audigy cards
 too. The order of the channels can't be tested by just altering mixer
 settings. Here's a small program to test if the channels are reversed on
 your sound card:
 
 
 #include <sys/soundcard.h>
 #include <fcntl.h>
 #include <unistd.h>
 
 int main(int argc, char **argv)
 {
 	int fd = open("/dev/dsp", O_WRONLY), format = AFMT_S16_LE;
   int channels = 2, rate = 22050, i;
 
   /* 450 Hz sine wave on left channel, right channel silent */
   unsigned char samples[] = {0, 0, 0, 0, 94, 16, 0, 0, 120, 32, 0, 0,
     9, 48, 0, 0, 208, 62, 0, 0, 143, 76, 0, 0, 12, 89, 0, 0, 19, 100,
     0, 0, 117, 109, 0, 0, 11, 117, 0, 0, 182, 122, 0, 0, 92, 126, 0,
     0, 239, 127, 0, 0, 105, 127, 0, 0, 202, 124, 0, 0, 32, 120, 0, 0,
     124, 113, 0, 0, 251, 104, 0, 0, 193, 94, 0, 0, 249, 82, 0, 0,
     212, 69, 0, 0, 138, 55, 0, 0, 85, 40, 0, 0, 120, 24, 0, 0, 51, 8,
     0, 0, 205, 247, 0, 0, 136, 231, 0, 0, 171, 215, 0, 0, 118, 200,
     0, 0, 44, 186, 0, 0, 7, 173, 0, 0, 63, 161, 0, 0, 5, 151, 0, 0,
     132, 142, 0, 0, 224, 135, 0, 0, 54, 131, 0, 0, 151, 128, 0, 0,
     17, 128, 0, 0, 164, 129, 0, 0, 74, 133, 0, 0, 245, 138, 0, 0,
     139, 146, 0, 0, 237, 155, 0, 0, 244, 166, 0, 0, 113, 179, 0, 0,
     48, 193, 0, 0, 247, 207, 0, 0, 136, 223, 0, 0, 162, 239, 0, 0};
 
   ioctl(fd, SNDCTL_DSP_SETFMT,&format);
   ioctl(fd, SNDCTL_DSP_CHANNELS,&channels);
   ioctl(fd, SNDCTL_DSP_SPEED,&rate);
 
   for(i=0;i<500;i++)
     write(fd, &samples, sizeof(samples));
   write(fd, &samples, 2); /* swap channels */
   for(i=0;i<500;i++)
     write(fd, &samples, sizeof(samples));
 
   return 0;
 }
 
 You should hear a sound on the left channel followed by a sound on the
 right channel. If you hear a sound on the right channel first, the
 channels are reversed.
 
 -- 
 Juha-Matti Tilli, email: juhis@nallukka.net



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200511260020.jAQ0K6tZ064543>