Closed stefanha closed 2 months ago
related #641
@RossBencina I have pushed a new commit that replaces the deprecated jack_port_get_latency()
API with jack_port_get_latency_range()
in order to fix #641.
Hi @RossBencina, please let me know if you have any comments. Thanks!
I've assigned this to myself since I need to put in the time to review our specifications and think about why this is correct.
@stefanha sorry about the delay.
I've checked the calculations against our documentation (https://github.com/PortAudio/portaudio/wiki/BufferingLatencyAndTimingImplementationGuidelines) and Phil and I have agreed that this looks like the correct fix, given that the old code was computing zero latency in both the input and output cases.
One more thing: I'm unclear about the JACK "asynchronous mode" vs "synchronous mode" thing. Is it the case that PortAudio/JACK no longer ever uses "asynchronous mode" under any circumstances?
One more thing: I'm unclear about the JACK "asynchronous mode" vs "synchronous mode" thing. Is it the case that PortAudio/JACK no longer ever uses "asynchronous mode" under any circumstances?
@RossBencina Thanks for taking a look at this! The latency reported by the PortAudio JACK host API was incorrect in both modes. Asynchronous mode adds latency, so it is not accurate to subtract the extra latency. I believe the the state of JACK implementations is:
Either way, the latency reported by the JACK host API was not accurate and this fix will ensure that the real latency is reported.
Merged! Thank you!
The latency calculation subtracts the size of one buffer from JACK's port latency value. I suspect this adjustment was made so that jackd's "asynchronous mode" appears to have the user's requested latency value even though jackd adds one extra buffer, thus increasing the real latency.
When jackd runs in "synchronous mode" or the more recent pipewire-jack implementation is used, PortAudio reports incorrect latency values of 0 seconds because the latency is exactly one buffer.
Fix the calculation to produce the real latency.