[openal] New JACK backend

Chris Robinson chris.kcat at gmail.com
Tue Dec 23 01:33:08 EST 2014


Current Git for OpenAL Soft has a new backend for JACK. People have been 
asking for it, and I finally got around to learning the API. There's a 
few caveats, though:

First, OpenAL Soft will keep an extra period's worth of audio samples 
ahead of the JACK server. Since the mixer is not (currently) real-time 
safe, it has to run separately from JACK's processing callback and keep 
the minimum amount of needed samples ready for when the callback gets 
run. Consequently, OpenAL Soft's buffer metrics (the 'periods' and 
'period_size' config options) are ignored in the backend and it will use 
whatever the server has.

It also means the mixer may be a bit more sensitive to underruns since 
there's only one period's worth of samples between the mixer and JACK, 
and JACK won't wait for the mixer. In practice, this doesn't seem to be 
an issue; on my aging system, it has no problem keeping up with a 512 
server period size @ 48khz, even with real-time priority off for the 
mixing thread. And if you have something really extreme set (e.g. a 16 
sample period size @ 192khz) that causes problems, there is a config 
option to specify a larger mix-ahead buffer if needed, without having to 
modify the JACK server settings.

Secondly, the backend currently only supports stereo output. Because of 
a power-of-two restriction on the lockless ringbuffer size, 6 (5.1) and 
7 (6.1) channel configurations can't work without a sample frame being 
split over the edge of the buffer. Additionally, JACK does not provide 
information about what ports correspond to what channel, which leaves it 
to complete guesswork. These can be worked out, but it will likely mean 
any non-stereo mode won't be autodetected and will need to be explicitly 
configured.

And thirdly, the backend's priority is a bit low on the list, so if you 
want to use it, you'll need to specify it in the config. I'm not sure 
what to do about this since JACK, like PulseAudio, will auto-spawn a 
server by default if one isn't running. PulseAudio will also silently 
step aside when JACK runs, so there's no way to automatically determine 
which should be used without the user specifying. Thus, at least for 
now, JACK needs to be explicitly requested.


Other than that, the JACK backend should Just Work like the other 
backends. Feel free to try it and let me know if there's any issues.

P.S. One more thing. It seems the JACK client will print a bunch of 
stuff to the terminal. I can't see a way to restrict the output to 
warnings and errors only, so it's a bit noisy even when everything's okay.


More information about the openal mailing list