jack: add noAutoConnect option and allow arbitrary number of channels - #852
digitalsignalperson wants to merge 1 commit into
Conversation
…ure.channels unless they are set to 0, then use the number of channels in the default device
|
What was your intention for the if (pContext->backend == ma_backend_jack) {
pContext->jack.channelsCapture = pConfig->capture.channels;
pContext->jack.channelsPlayback = pConfig->playback.channels;
}Any backend-specific logic like that needs to be within the backend itself, not in the cross-platform section. Just to clarify the rules. When you specify a channel count in the device config, the caller is specifying what they want. The backend (jack in this case), will use that as a hint. If it can exactly represent that channel count, it should do so, and if not, it should get as close as possible and then report via |
|
Oh about The number of channels set in the and while Since I saw Oh and I think there was a reason I couldn't put Also re: the channel count config rules, I do feel it wasn't easy to understand the different |
|
OK just stepping through the calls to jack backend to trace things out for a better understanding:
So does it make sense to have to store |
|
This has been implemented in the dev-0.12 branch. |
Solves #851
I'm testing with this callback to play a sine wave over all channels
Default case:
I think this is still wrong. I have 2 audio devices with 8 outputs and 2 outputs, and here miniaudio creates 10 outputs and connects them all. I'm not sure what the "default device" is defined as with jack. Also this is with pipewire-jack.
Setting .playback.channels=2
Un-commenting that one line results in:

Setting .jack.noAutoconnect = true
Caveat that I couldn't figure out how to use
ma_context_configwithout crashing, so on line 31793 I just force the value to true.The miniaudio device has 2 channels and initially not connected to anything.
I can now patch them however I want

Here's with 32 channels:

TODO
I must not be using
ma_context_configproperly, or there is a bug.On the master branch without this patch, this code will segfault in
ma_mallocfromma_device__jack_buffer_size_callback.If I try it on my patch here, strangely I see it worked until I uncomment
contextConfig.jack.noAutoConnect = true;. Idk, something bad trashing the memory perhaps.TODO
devbranch.// pContext->jack.noAutoConnect = true; // TODO I don't know how to use custom context config, it crashes