Heya Dan,

I've found that there is about a 800ms delay between the output data
being written to /dev/dsp and being able to hear the output from the
soundcard on FreeBSD. I'm working to a 200ms deadline.
What's your write size?  At 44100khz*2 channels, a 65k write would take
around 800 ms to play.  Try writing smaller chunks, or maybe raise

Don't I feel like a dunce right now. I forgot the cardinal rule of reproducing my results with other software. I tried the same file with XMMS and it played instantly.

My problem was primarly due to the fragment sizes of buffers. I don't know what sizes are set as default but they're to big for my applpications. I've found with:

val = (2 << 16) | 9;
ioctl(audio_fd, SNDCTL_DSP_SETFRAGMENT, &val);

It kills the delay to next to nothing. As far as I understand this, and it's not well, the above means use a maximum of 2 fragments and each fragment should be 2^9 large (ie 512 bytes long).

Which I figure to be 1204 bytes total for buffer (or 5ms).

It still doesn't happen that quickly for me, but what I'd imagin is delaying it now (and is my problem) is the write() I'm doing. As I'm writing 20ms of Audio out at any time, so I'm waiting for that to complete.

Thanks for the suggestion Dan, helped a lot.

Andreas, this will be your problem to for your guitar problem, try using the above code (add error checks, it can fail on some hardware (statically set fragments)).

I also managed to find the guide to OSS at http://www.opensound.com/pguide/oss.pdf, I shall be looking there before asking here again, don't worry.

Off to knock the dust of my dunce cap off,

Peter Wood BSc (Hons) :: <[EMAIL PROTECTED]> :: Tel +44 7974 799440
[EMAIL PROTECTED] mailing list
To unsubscribe, send any mail to "[EMAIL PROTECTED]"

Reply via email to