RustAudio / cpal

Cross-platform audio I/O library in pure Rust
Apache License 2.0
2.62k stars 347 forks source link

add port name to StreamConfig #557

Open Be-ing opened 3 years ago

Be-ing commented 3 years ago

For usability with JACK and PipeWire routing applications like Catia or QJackCtl as well as session managers, it is important that applications can choose their port names. I think this could easily fit into the API of StreamConfig. For backends besides JACK and PipeWire the name would simply be ignored.

As far as I can tell CPAL is the only crossplatform audio library in any language that could do this well because Stream creation is decoupled from stream usage, so the application can create all its ports for other applications to connect to without the CPAL application needing to use every port at the time of creating them. As a comparison refer to this Mixxx bug report about the problems using JACK through the limitations of PortAudio's API. RtAudio has an API to set the JACK port name but it couples port creation with port usage.

Be-ing commented 3 years ago

I think there will be a bit more to this to really get it working. Processing the stream needs to be started automatically when another application connects to the CPAL application's port. I am not sure if that is something CPAL can take care of itself or if the application needs to implement some logic to handle that.

Furthermore, the CPAL application should be able to determine the port name of what each Stream is connected to. This is required for the CPAL application to present a UI for configuring audio I/O and keeping it synchronized with the state of the sound server processing graph.

SGauvin commented 1 year ago

Bumping this! Is there currently a way to name clients also?

microfx commented 8 months ago

Hello? Is there a way? 👍