Skip to content

Commit

Permalink
Add a feature for MacOS' IOKit/audio/IOAudioTypes.h (#92)
Browse files Browse the repository at this point in the history
* Add a feature for MacOS' IOKit/audio/IOAudioTypes.h

When querying an AudioStream for its terminal type
(kAudioStreamPropertyTerminalType) it will often return a value defined
in IOAudioTypes.h (the ranges [INPUT_UNDEFINED, INPUT_MODEM_AUDIO] and
[OUTPUT_UNDEFINED, OUTPUT_LOW_FREQUENCY_EFFECTS_SPEAKER]).

This commit adds a feature io_kit_audio that will generate rust bindings
for IOAudioTypes.h, so these enum values can be used in rust directly.

* Bump the version for io_kit_audio
  • Loading branch information
Pehrsons authored Nov 15, 2023
1 parent ed528b3 commit 412f4f1
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
3 changes: 2 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "coreaudio-sys"
version = "0.2.13"
version = "0.2.14"
authors = ["Mitchell Nordine <[email protected]>"]
description = "Bindings for Apple's CoreAudio frameworks generated via rust-bindgen"
license = "MIT"
Expand All @@ -20,6 +20,7 @@ default = ["audio_toolbox", "audio_unit", "core_audio", "open_al", "core_midi"]
audio_toolbox = []
audio_unit = []
core_audio = []
io_kit_audio = []
open_al = []
core_midi = []

Expand Down
7 changes: 7 additions & 0 deletions build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,13 @@ fn build(sdk_path: Option<&str>, target: &str) {
}
}

#[cfg(feature = "io_kit_audio")]
{
assert!(target.contains("apple-darwin"));
println!("cargo:rustc-link-lib=framework=IOKit");
headers.push("IOKit/audio/IOAudioTypes.h");
}

#[cfg(feature = "open_al")]
{
println!("cargo:rustc-link-lib=framework=OpenAL");
Expand Down

0 comments on commit 412f4f1

Please sign in to comment.