-
-
Notifications
You must be signed in to change notification settings - Fork 337
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
jack: add noAutoConnect option and allow arbitrary number of channels #852
base: master
Are you sure you want to change the base?
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 |
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:
![image](https://private-user-images.githubusercontent.com/45611618/333380990-84b35968-dc45-44e7-8ca7-cec3109aff7f.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjQwMzMyMDksIm5iZiI6MTcyNDAzMjkwOSwicGF0aCI6Ii80NTYxMTYxOC8zMzMzODA5OTAtODRiMzU5NjgtZGM0NS00NGU3LThjYTctY2VjMzEwOWFmZjdmLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA4MTklMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwODE5VDAyMDE0OVomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTU3NzllMGI0ZmIwY2QzNTc1MDY1ZGVjYTA1YjZiMGFiNmU1M2IyOGY4YTA3OGQwMDNiMTdiOTVmM2M1NWVhYWEmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.duDs1CidTtXGcYtD-q6mIilr6wx_nKInffKCTlQZ1v4)
Setting .jack.noAutoconnect = true
Caveat that I couldn't figure out how to use
ma_context_config
without 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
![image](https://private-user-images.githubusercontent.com/45611618/333381427-4e3924ba-2bd0-4565-becd-2bd4db7198d9.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjQwMzMyMDksIm5iZiI6MTcyNDAzMjkwOSwicGF0aCI6Ii80NTYxMTYxOC8zMzMzODE0MjctNGUzOTI0YmEtMmJkMC00NTY1LWJlY2QtMmJkNGRiNzE5OGQ5LnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA4MTklMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwODE5VDAyMDE0OVomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPWY4NjY3NzY0NWNkM2E2ZWFkNGZlNDJkZDJhYmM5YTg1NGJkNDljOTcyYTU4N2M4ZjkxOGI4NmI4YjY4M2ZkYmUmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.hofDexq7XKTW8UZG9mAxW4uRwtBorogn-9iA5sgieMc)
Here's with 32 channels:
![image](https://private-user-images.githubusercontent.com/45611618/333381573-05d94bd8-9de2-49d1-bad0-20371ce3ad45.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjQwMzMyMDksIm5iZiI6MTcyNDAzMjkwOSwicGF0aCI6Ii80NTYxMTYxOC8zMzMzODE1NzMtMDVkOTRiZDgtOWRlMi00OWQxLWJhZDAtMjAzNzFjZTNhZDQ1LnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA4MTklMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwODE5VDAyMDE0OVomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTZkZGU0NTY4Y2ExOTVjNmJjZWI0ODU1ZjZhZjkyZTFlZmExZmQyZmQ5MmU0NGU0NzY2ZjRmZTM0ZjQ3YTljOTEmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.YUutI3gYz3THM9St2cnKf41aZxVgKDXG-fN7FBPZy00)
TODO
I must not be using
ma_context_config
properly, or there is a bug.On the master branch without this patch, this code will segfault in
ma_malloc
fromma_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
dev
branch.// pContext->jack.noAutoConnect = true; // TODO I don't know how to use custom context config, it crashes