[Portaudio] pa_sgi and small buffers

Pieter Suurmond pieter@kmt.hku.nl
Fri, 3 May 2002 22:25:37 +0200


Phil replyed:
...[snip]
>> ok: pa_tests/patest_saw     (but it does not exit gracefully)
>Crashes? Clicks? Laptop falls off table?

:-) No nothing serious, nothing wrong with the sound or so, it's 
only that the program keeps running after it has done its' job. 
I have to type in control-C in my console to manually quit it.

But this is a much more serious problem, yes:

>> ..  pa_tests/patest_sine  gives coredump (bufSize 64 = too small?)
>
>The implementation should be able to handle small buffers. If the user
>buffer is too small for the host buffer than it should fit N users buffers
>in a host buffer. When it is time to fill each host buffer, then PA should
>call the user callback N times.
>This allows the app to specify the smallest possible buffer size which could
>allow very small latency on some platforms. If I recall, the Apple CoreAudio
>folks claim that "theoretically" the latency under OS X could go as low as
>one sample. So we want to allow small user buffers.

I have never fully understood this N number of buffers mechanism from 
the start. My 'pa_sgi' is probably NOT OK in that respect.
It now takes just 3 or 4 times the user buffer. I have to fix this / 
study this.
What you shortly explained above, Phil, is very helpful for that.
Unfortunately, I think I won't be able to get this right in 'pa_sgi' 
in one or two days. 'pa_sgi' has never been right on that point... 
For now: don't use pa_sgi with buffer sizes below 1024 or 2048 or so, 
or it will coredump. 
Maybe a line should be added to the current 'pa_sgi', saying this is 
not yet all right.

I'll probably bother you (and the list) later, to explain me more 
about how to get the N-buffers thing right....  But I'll first study 
the mac and unix_oss implementations...
Your new '/docs/latency.html'-page that I'm now reading is also helpful.

Thanks for explaining,
Pieter