-
Notifications
You must be signed in to change notification settings - Fork 365
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #485 from MichaelHills/mike-ios
Refactor coreaudio host and add iOS support + ios-feedback example
- Loading branch information
Showing
24 changed files
with
2,241 additions
and
876 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
[package] | ||
name = "cpal-ios-example" | ||
version = "0.1.0" | ||
authors = ["Michael Hills <[email protected]>"] | ||
edition = "2018" | ||
|
||
[lib] | ||
name = "cpal_ios_example" | ||
crate-type = ["staticlib"] | ||
|
||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html | ||
|
||
[dependencies] | ||
cpal = { path = "../.." } | ||
anyhow = "1.0.12" | ||
ringbuf = "0.1.6" | ||
|
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
# iOS Feedback Example | ||
|
||
This example is an Xcode project that exercises both input and output | ||
audio streams. Audio samples are read in from your micrphone and then | ||
routed to your audio output device with a small but noticeable delay | ||
so you can verify it is working correctly. | ||
|
||
To build the example you will need to still `cargo-lipo`. While not | ||
necessary for building iOS binaries, it is used to build a universal | ||
binary (x86 for simulator and aarch64 for device.) | ||
|
||
``` | ||
cargo install cargo-lipo | ||
``` | ||
|
||
Then open the XCode project and click run. A hook in the iOS application | ||
lifecycle calls into the Rust code to start the input/output feedback | ||
loop and immediately returns back control. | ||
|
||
Before calling into Rust, the AVAudioSession category is configured. | ||
This is important for controlling how audio is shared with the rest | ||
of the system when your app is in the foreground. One example is | ||
controlling whether other apps can play music in the background. | ||
More information [here](https://developer.apple.com/library/archive/documentation/Audio/Conceptual/AudioSessionProgrammingGuide/AudioSessionCategoriesandModes/AudioSessionCategoriesandModes.html#//apple_ref/doc/uid/TP40007875-CH10). | ||
|
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
#!/bin/sh | ||
|
||
set -e | ||
|
||
PATH=$PATH:$HOME/.cargo/bin | ||
|
||
# If you want your build to run faster, add a "--targets x86_64-apple-ios" for just using the ios simulator. | ||
if [ -n ${IOS_TARGETS} ]; then | ||
cargo lipo --targets ${IOS_TARGETS} | ||
else | ||
cargo lipo | ||
fi |
Oops, something went wrong.