[Portaudio] adding latency parameter to Pa_OpenStream()
Phil Burk
philburk@softsynth.com
Fri, 5 Oct 2001 15:19:31 -0700
Hello John,
I'm confused by your latest letter.
I wrote:
> > To include your idea within the existing API, we could pass these to
> > Pa_OpenStream as numBuffers:
> > #define PA_LATENCY_WHATEVER (0) /* or _NO_OPINION or? */
> > #define PA_LATENCY_LOW (-1)
> > #define PA_LATENCY_HIGH (-2)
You replied:
> No, I wouldn't suggest doing this, at least not for me -- I have no
> use for it, since I would always compute a numBuffers value based on
> the latency the user supplies, or defaults.
But that is basically your idea except it uses an existing parameter and
integer constants instead of double constants.
You had said:
> drivers are able to handle latency requests, is there any interest
> in adding a latency parmameter to Pa_OpenStream()?
> This would have the attributes:
> -- A double, with units in seconds
> -- Special constants (coded as negative double values) to indicate:
> * no opinion about latency
> * generic "high-latency" for audio streaming
> * generic "low-latency" for interaction
Aren't we basically saying the same thing? I'm just trying to overload an
existing parameter with the new functionality.
> But, if the user wants
> to push the latency of the system beyond "recommended", I want for
> that attempt (via the -latency command-line option) to have the
> intended effect.
Maybe we need both. Because if the app writer doesn't give a way for the
user to control that minLatency parameter, then they might be stuck with
glitchy audio.
How about:
PaError Pa_SetMinimumLatency( double seconds );
The implementor can also provide an optional back door using an environment
variable like PA_MIN_LATENCY_MSEC if they want.
Phil Burk