Is there a way for a JACK client to choose the PipeWire driver to follow?
A JACK client I'm developing (Overwitch) implements an audio resampler and needs accurate time measurements at any time to ensure the lowest possible latency. AFAIK, a PipeWire client is always following a driver and by default it's the "Dummy-Driver".
$ pw-cli --version
pw-cli
Compiled with libpipewire 0.3.83
Linked with libpipewire 0.3.83
This is what I see in pw-top
whenever I run the client. Ardour is not running and the client has no connections. It runs smoothly and the internal latency is kept at the minimum but, of course, no audio is routed.
S ID QUANT RATE WAIT BUSY W/Q B/Q ERR FORMAT NAME
R 31 64 48000 90,5us 0,2us 0,07 0,00 0 Dummy-Driver
R 112 0 0 13,1us 67,7us 0,01 0,05 0 + Overwitch <--------------------
S 32 0 0 --- --- --- --- 0 Freewheel-Driver
I 36 0 0 0,0us 0,0us 0,00 0,00 0 F32P 2 0 map.playback.MTK12_interval
S 39 0 0 --- --- --- --- 0 map.capture.MTK12_interval
S 40 0 0 --- --- --- --- 0 map.playback.MTK12_master
S 41 0 0 --- --- --- --- 0 map.capture.MTK12_master
S 46 0 0 --- --- --- --- 0 Midi-Bridge
S 64 0 0 --- --- --- --- 0 alsa_output.usb-Soundcraft_Soundcraft_Signature_12_MTK-00.multicha
S 65 0 0 --- --- --- --- 0 alsa_input.usb-Soundcraft_Soundcraft_Signature_12_MTK-00.multichan
If I make a connection, then Overwitch starts following the HW driver and this causes the timing to wobble for a few seconds before stabilizing which causes a latency increment because the internal buffer is filled up. This is the behavior I want to avoid.
S ID QUANT RATE WAIT BUSY W/Q B/Q ERR FORMAT NAME
I 31 64 48000 101,3us 0,3us 0,08 0,00 0 Dummy-Driver
S 32 0 0 --- --- --- --- 0 Freewheel-Driver
I 36 0 0 0,0us 0,0us 0,00 0,00 0 F32P 2 0 map.playback.MTK12_interval
S 39 0 0 --- --- --- --- 0 map.capture.MTK12_interval
S 40 0 0 --- --- --- --- 0 map.playback.MTK12_master
S 41 0 0 --- --- --- --- 0 map.capture.MTK12_master
I 46 0 0 0,0us 0,0us 0,00 0,00 0 Midi-Bridge
R 64 64 48000 84,9us 9,3us 0,06 0,01 0 S32LE 12 48000 alsa_output.usb-Soundcraft_Soundcraft_Signature_12_MTK-00.multicha
R 112 0 0 11,9us 63,3us 0,01 0,05 0 + Overwitch <--------------------
S 65 0 0 --- --- --- --- 0 alsa_input.usb-Soundcraft_Soundcraft_Signature_12_MTK-00.multichan
But if I start Ardour, even with no connections showed in qpwgraph
, Overwitch starts following the HW driver which ensures no time wobbling.
S ID QUANT RATE WAIT BUSY W/Q B/Q ERR FORMAT NAME
I 31 64 48000 +++ 0,3us +++ 0,00 0 Dummy-Driver
S 32 0 0 --- --- --- --- 0 Freewheel-Driver
S 40 0 0 --- --- --- --- 0 map.playback.MTK12_master
S 41 0 0 --- --- --- --- 0 map.capture.MTK12_master
R 65 64 48000 169,5us 0,4us 0,13 0,00 0 S32LE 14 48000 alsa_input.usb-Soundcraft_Soundcraft_Signature_12_MTK-00.multichan
R 36 0 0 3,8us 2,2us 0,00 0,00 0 F32P 2 0 + map.playback.MTK12_interval
R 39 0 0 25,9us 3,4us 0,02 0,00 0 F32P 2 0 + map.capture.MTK12_interval
R 46 0 0 13,2us 6,6us 0,01 0,00 0 + Midi-Bridge
R 64 0 0 13,3us 42,5us 0,01 0,03 0 S32LE 12 48000 + alsa_output.usb-Soundcraft_Soundcraft_Signature_12_MTK-00.multi
R 112 0 0 14,6us 64,4us 0,01 0,05 0 + Overwitch <--------------------
R 130 0 0 13,7us 76,6us 0,01 0,06 2 + ardour
What is changing at the moment I run Ardour? Can I mimic this from the client?
Or, is it possible to force a client to follow the HW driver with a JACK or PipeWire API?
Another option would be to detect if the driver the client is following has changed. Can this be accomplished?
Or Am I missing something else?