mackron / miniaudio

Audio playback and capture library written in C, in a single source file.
https://miniaud.io
Other
3.75k stars 324 forks source link

jack: only open as many channels as requested, option to not autoconnect to default device #851

Open digitalsignalperson opened 1 month ago

digitalsignalperson commented 1 month ago

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:

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

Autoconnect

mackron commented 1 month ago

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 commented 1 month ago

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