Re: Reversed Stereo in 2.1.x

Itai Nahshon (nahshon@actcom.co.il)
Sat, 21 Mar 1998 17:32:34 +0300


Alan Cox wrote:
>
> > I have a little progress. I could reproduce the problem with
> > memory mapped stereo sound using a SoundBlaster-16 card. Channels
> > are not reversed with my 82C931 based card, or when I use normal
> > write() system call (ie, using vplay -S). I do not have access to
> > other sound cards.
>
> Ok. This seems to be something we acquired from Hannu rather than
> modularising. I will dig a bit on this.

I have a diagnosis and a suggested fix.

The ioctl call SNDCTL_DSP_SETTRIGGER is first calling the low-level
trigger function (eg., sb16_audio_trigger) twice. Once from
DMAbuf_launch_output (or from DMAbuf_activate_recording) the second time
directly:

if (changed && audio_devs[dev]->d->trigger)
audio_devs[dev]->d->trigger(dev, bits * audio_devs[dev]->go);

This second call is redundant and causes the reverse stereo. Some cards
(eg. ad1848 based) ignore it. Other cards (SB) restart playing at the
sample which belongs to the wrong channel.

>
> > Linux 2.1.90 introduced a new problem WRT mmapped audio output. It
> > produces clicks (estimated on every 4KB = frag size) where output was
> > smooth in 2.1.89. I suspect some changes in dmabuf.c are responsible
> > for that.
>
> No clicks here with write. I'll test mmap tomorrow
>
I'm using mmap_test.c from
<ftp://ftp.4front-tech.com/ossfree/mmap_test.c>.
Trivial modification to play stereo, 8 bit, 8000 samples/second.

Incrementing the 'extra' from 16 to 128 makes a big improvement. This
points the problem at the value returned by SNDCTL_DSP_GETOPTR, or to
the select call.

Itai

-- 
Itai Nahshon   nahshon@actcom.co.il
        Also   nahshon@vnet.ibm.com

- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu