Problems with OSS

Simon Burton simonb at webone.com.au
Fri Mar 29 17:42:18 EST 2002


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




Michael Still wrote:

> Hey all,
> 
> I was bored yesterday, and wrote a little wav decoder which plays via OSS
> -- it takes about 200 lines of code. Anyway, this works fine for 8KHz mono
> wav files, but for the stereo 44Khz file it just produces a clicking
> noise.
> 
> I am having some troubles identifying what to set SNDCTL_DSP_SETFMT to for
> this data. I have tried AFMT_U16_LE and AFMT_S16_LE, but neither worked.
> 
> Does anyone have any hints / sample code for this? Would it be more
> helpful if I posted a URL to my code?
> 
> Thanks,
> Mikal
> 
> 






More information about the linux mailing list