Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Is JACK considered paUtilFixedHostBufferSize? #1007

Open
mgeier opened this issue Feb 22, 2025 · 0 comments
Open

Is JACK considered paUtilFixedHostBufferSize? #1007

mgeier opened this issue Feb 22, 2025 · 0 comments

Comments

@mgeier
Copy link

mgeier commented Feb 22, 2025

I was looking at the latency of PortAudio streams when using the JACK host API.

When setting framesPerBuffer to 0 (a.k.a. paFramesPerBufferUnspecified), no latency is added, which is good and expected.

For other values of framesPerBuffer, however, that value seems to be added to the latency.

I found this code, which might be relevant:

if( hostBufferSizeMode == paUtilFixedHostBufferSize )
{
unsigned long frameShift =
CalculateFrameShift( framesPerHostBuffer, framesPerUserBuffer );
if( framesPerUserBuffer > framesPerHostBuffer )
{
bp->initialFramesInTempInputBuffer = frameShift;
bp->initialFramesInTempOutputBuffer = 0;
}
else
{
bp->initialFramesInTempInputBuffer = 0;
bp->initialFramesInTempOutputBuffer = frameShift;
}
}
else /* variable host buffer size, add framesPerUserBuffer latency */
{
bp->initialFramesInTempInputBuffer = 0;
bp->initialFramesInTempOutputBuffer = framesPerUserBuffer;
}

I didn't find any mention of paUtilFixedHostBufferSize in the code of the JACK host API, which could be the reason that framesPerBuffer is always added to the latency.

This latency is generally larger than necessary, so I guess my question is: is this intentional?

I understand that JACK has a jack_set_buffer_size_callback() function, which could be used to react to changes in the buffer size, but AFAIU, this is rarely supported by applications.

Does PortAudio/JACK support changing the buffer size, or should it be designated as paUtilFixedHostBufferSize?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant