-
Notifications
You must be signed in to change notification settings - Fork 358
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
Duplex Stream Support #349
Comments
CoreAudio has a notion of "aggregate" device that allows to combine several inputs/outputs in a single device, that will 1) deal with audio clock synchronization 2) provide a single full duplex callback to deal with. This aggregate device can be built with an API (not only the system Audio Midi Setup tool). Possible code to look at, Rust here at : https://github.com/padenot/cubeb-coreaudio-rs or C++ here from JACK project here : |
+1 for this feature. It would allow me to move from portaudio and to cpal. |
In JACK duplex streams are the generally the default. Or rather, all ports opened by a single client will be handled by a single callback regardless of their type:
Hope we can find an abstraction that works well for all Hosts that support duplex streams! |
Hey guys, I'm considering the complexity of this feature and whether it's something I could feasibly tackle. Is it possible for someone more experienced with the code to make a rundown of what would need to be coded/refactored for this to land? Anyone started to work on it that I could join / support? |
I've made a stab at it for ASIO. It compiles and runs without crashing, but I'm remotely controlling my test windows machine so I don't know if it actually works (reads and outputs samples). The code is in this branch: There is a new method |
Thanks for making progress on this @baadc0de! If there is agreement on the interface for creating/using duplex streams I can do the JACK implementation (very small changes needed). Are we following the structure in #116? Maybe a first implementation could just have all hosts that don't support duplex streams (yet) not return any default device/valid formats for duplex and we can then implement them one by one instead of one huge PR for every host to keep it from being too great of an undertaking? |
Oops I did not check #116 for the proposed API. It seems good, much better than what I added. I'll see if I can rework my end to conform. It also seems better to return empty iterators for duplex formats / devices when duplex is not supported. My current implementation has a blanket |
Does a duplex device always have one input and one output or can there be more of them (like merger, mixer, splitter, etc.)? Maybe I can help to develop and implement a proper API if I learn more about the use cases. |
I've never experienced a duplex stream with buffer sizes that are different for input vs output. |
Thanks. What about the remaining aspects:
|
Only speaking for JACK, don't know about the other backends:
* f32 only
* I'm not aware of any manual endianness handling, and this doc page suggests all platforms have the sam endianness for f32: https://doc.rust-lang.org/std/primitive.f32.html
* channels are separate buffers accessed through port handles, not interleaved
* number of in-/outputs is completely user controlled, you can open any number of input or output ports from a single JACK client
Kai Giebeler ***@***.***> skrev: (20 september 2022 22:10:30 CEST)
…Thanks. What about the remaining aspects:
* mixed types (`i32, `f32`, …`)
* mixed endianness
* channel interleaving
* number of in-/outputs
-- >
Reply to this email directly or view it on GitHub:
#349 (comment)
You are receiving this because you commented.
Message ID: ***@***.***>
|
Thanks for the explanation. Just to get my vocabulary right: is a single JACK-port mono or can it be multi-channel? |
A JACK port is always mono. A JACK client is a node within the JACK audio graph with any configuration of ports. There is no distinction between duplex/non duplex within JACK except the ports we choose to open.
Kai Giebeler ***@***.***> skrev: (21 september 2022 00:37:32 CEST)
…Thanks for the explanation. Just to get my vocabulary right: is a single JACK-port mono or can it be multi-channel?
--
Reply to this email directly or view it on GitHub:
#349 (comment)
You are receiving this because you commented.
Message ID: ***@***.***>
|
I've never experienced mixed |
I would love this features as well, I can't get the latency low enough with the strategy from the feedback example. |
I think trying to support multi-device full duplex would be a longer-term effort (maybe even impossible in some cases) but I'd like this to work in the single device with single driver case at a minimum. In some cases you can have multiple devices with clock inputs that will keep everything sync'd. There would need to be a mechanism to discover that or explicitly indicate it. |
yeah it would already be worth a lot when it only works for the same device. |
This is a tracking issue for supporting duplex streams. Duplex streams are streams that have device-synchronised input and output, an essential requirement for many real-time and pro-audio applications.
This is a follow-up to #116 but focused specifically on duplex support.
The text was updated successfully, but these errors were encountered: