Problems with OSS

Michael Still mikal at
Sat Mar 30 08:15:36 EST 2002

On Fri, 29 Mar 2002, Michael Still wrote:

> On Fri, 29 Mar 2002, Simon Burton wrote:
> > you probably need all three of these:
> >      ret=ioctl(dspfd[dev],SNDCTL_DSP_SETFMT,&format); assert(!ret);
> >      ret=ioctl(dspfd[dev],SNDCTL_DSP_STEREO,&stereo); assert(!ret);
> >      ret=ioctl(dspfd[dev],SNDCTL_DSP_SPEED,&srate); assert(!ret);
> > with
> >      int format=AFMT_S16_LE;
> >
> > and stereo=1
> > and srate=44100
> I had all of these, except the stereo which I have added. Even after I
> change the FMT to AFMT_S16_LE, I still get the clicking effect... The
> difference is there is a longish period of silence first.

Ok, please find attached the code for the sound stuff. To run it, you'll
need to add something like:

int main(){
  playSound(0, "wobble.wav");

Any hints on why this doesn't work for stereo? I figure it must be
something fairly obvious I am doing wrong...


PS: If it's more convenient, the code is also at


Michael Still (mikal at     UMT+11hrs

More information about the linux mailing list