Replace coreaudio-sys with objc2-audio-toolbox - #26
Merged
Merged
Conversation
coreaudio-sys runs bindgen on the macOS SDK headers at build time, which needs libclang and breaks when cross-compiling, e.g. with cargo-zigbuild. objc2-audio-toolbox ships pregenerated bindings for the same AudioQueue API.
Owner
|
I'm not a huge fan of AI-generated code, but this one looks ok and fixes real problem. |
It looks quite similar to what a human would have done by hand. So likely no complaints from a technical pov. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
coreaudio-sysgenerates its bindings with bindgen at build time. That makes every macOS/iOS build oftinyaudiodepend on libclang and the full SDK headers, and it breaks when cross-compiling.For example, with
cargo-zigbuildon Linux,AudioToolbox.hfails to parse ('AudioToolbox/CASpatialAudioExperience.h' file not found) becauseTARGET_OS_OSXends up unset.This switches the CoreAudio backend to
objc2-audio-toolboxandobjc2-core-audio-types, which ship pregenerated bindings for the same AudioQueue API.The backend logic is unchanged; only the types and signatures differ (
NonNullout-pointers,boolinstead ofBoolean,extern "C-unwind"callback).The dependency tree no longer contains
bindgen, and builds are faster.Tested on macOS (Apple Silicon): the
sineexample plays, and the data callback fires about 47 times per second at 48 kHz with 1024-frame buffers, as expected.Not tested on iOS.
Disclosure: this PR was written by Claude, an AI coding assistant, working for @emilk.