[Portaudio] pa_sgi and small buffers

Phil Burk philburk@softsynth.com
Fri, 3 May 2002 14:45:56 -0700


> 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...

As long as V18 is better than V17 then we should go with the current code.
There are always  improvements to be made for the next version.

> 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...

Essentially you have a range of acceptable host buffer sizes. If the user
buffer is in that range then userBuffersPerHostBuffer equals one. Easy.
If the userbuffer is smaller than the minimum acceptable host buffer size
then the code is something like this:

    userBuffersPerHostBuffer = (minimumFramesPerHostBuffer +
framesPerUserBuffer  - 1) / framesPerUserBuffer

    framesPerHostBuffer = userBuffersPerHostBuffer * framesPerUserBuffer

If the userBufferSize is biger than the maximumHostBufferSize then we're
screweed which is why we encourage small userBuffer. Or you can get fancy
and do the block adapter thing. See Callback_Adaptation_.pdf in the pa_asio
folder.

Phil Burk