Skip to content
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: only open as many channels as requested, option to not autoconnect to default device #851

Open
digitalsignalperson opened this issue May 23, 2024 · 2 comments

Comments

@digitalsignalperson
Copy link

Current behavior:

My default device has 8 channels. If I request 2 channels it creates a jack device with 8 outputs and auto-connect them all.

Desired behavior:

  • Request 2 channels, get 2 channels
  • Request 32 channels, get 32 (regardless if the default device has less)
  • Ability to enable or disable autoconnecting to the default device

Details

With this config

    ma_device_config deviceConfig = ma_device_config_init(ma_device_type_playback);
    deviceConfig.playback.format = ma_format_f32;
    deviceConfig.playback.channels = 2;
    deviceConfig.sampleRate = 48000.0f;

The result is:
image

Proposed solution

Number of channels

  • Since in device config the .playback.channels is ignored for jack, then I suggest if it is default 0 to use the number of channels in the default device.
  • If .playback.channels is non-zero, then in ma_device_init__jack() simply create as many channels with (ma_jack_port_register_proc)() instead of basing it off the default device specs.

Autoconnect

  • in the context config add a .jack.autoconnect setting
  • in ma_device_start__jack() don't do calls to (ma_jack_connect_proc)() if .jack.autoconnect is false
@mackron
Copy link
Owner

mackron commented May 23, 2024

Thanks. I don't have a whole lot of experience with jack, but everything you mentioned here makes sense. I'm actually surprised it's not already doing the channel count thing. Just on the autoconnect thing, if jack.autoconnect is false, I wouldn't do any jack_connect() at all? Does that not need to be called at some point in order for audio to actually work?

@digitalsignalperson
Copy link
Author

@mackron correct, I have it working without calling jack_connect() at all. See #852

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants