Skip to content

Commit

Permalink
Add a feature for MacOS' IOKit/audio/IOAudioTypes.h
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
Pehrsons committed Nov 13, 2023
1 parent ed528b3 commit d9e0a47
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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 d9e0a47

Please sign in to comment.