RustAudio / coreaudio-rs

A friendly rust interface to Apple's Core Audio API.
Apache License 2.0
203 stars 38 forks source link

What is the aim of this library? #81

Closed HEnquist closed 2 years ago

HEnquist commented 3 years ago

In my project I need mode direct access to the CoreAudio api that CPAL provides, so I'm considering using this crate. But after looking closer I'm not so sure. There are several open PRs that look useful, but haven't gotten any response despite being open for a very long time. The changes that do happen appear to be closely coupled to the needs of CPAL. There are also the common task of switching sample rate, where the low-level stuff is in CPAL rather than here (https://github.com/RustAudio/coreaudio-rs/issues/80).

My question then is this, sorry if it's a bit blunt. Is this library meant to cover the needs for general CoreAudio use, or is it just the CoreAudio backend for CPAL?

mitchmindtree commented 2 years ago

Thanks for the issue, apologies for the delayed repsonse!

As the README mentions, "this crate aims to expose and wrap the functionality of the original C API in a zero-cost, safe, Rust-esque manner" - this goal is the same today. cpal is certainly the largest dependent user I know of and in turn a lot of work there drives progress in this crate. That said, this crate should be suitable for general CoreAudio use.

As you mentioned, there are several open PRs lacking some love. Unfortunately these days I no longer have access to a macOS device myself, and as a result rarely get the chance to properly test coreaudio PRs myself. That said, these days RustAudio has 25+ members, each of whom have the ability to review and merge PRs here and I don't think we're lacking folks who are interested in seeing the repo improved. One thing that would help a lot with landing PRs is if interested macos users could help with testing them and report their results. I think this would make it a little easier for the RustAudio folks who don't have access to macOS themselves to have the confidence to land those PRs.

HEnquist commented 2 years ago

Thanks for the reply! In the meanwhile I started implementing the functionality I'm missing, see https://github.com/RustAudio/coreaudio-rs/pull/82 Some of the added things are borrowed from cpal, some are new.

The main idea the changes is that I think it should be possible to do all common tasks without needing to type stuff like extern "C". And preferably without unsafe blocks too. I think this really goes well with the first line of the readme: "A friendly rust interface for Apple's Core Audio API."

What do you think, is this a reasonable way forward for coreaudio-rs? I realize the PR is a bit large, but I didn't see any way of splitting things up without becoming blocked.

I'm working on this on an old macbook, but macOS isn't the platform I normally use. I also don't have any iOS devices (and know absolutely nothing about iOS), so I may well have broken iOS support.