Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update Settings.sampleRate for iOS 18 #165

Merged
merged 3 commits into from
Sep 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions Cookbook/Cookbook/CookbookApp.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,13 @@ struct CookbookApp: App {
#if os(iOS)
do {
Settings.bufferLength = .short

let deviceSampleRate = AVAudioSession.sharedInstance().sampleRate
if deviceSampleRate > Settings.sampleRate {
// Update sampleRate to 48_000. Default is 44_100.
Settings.sampleRate = deviceSampleRate
}

try AVAudioSession.sharedInstance().setPreferredIOBufferDuration(Settings.bufferLength.duration)
try AVAudioSession.sharedInstance().setCategory(.playAndRecord,
options: [.defaultToSpeaker, .mixWithOthers, .allowBluetoothA2DP])
Expand Down
2 changes: 1 addition & 1 deletion Cookbook/CookbookCommon/Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ let package = Package(
.package(url: "https://github.com/AudioKit/Waveform", branch: "visionos"),
.package(url: "https://github.com/AudioKit/Flow", from: "1.0.0"),
.package(url: "https://github.com/AudioKit/PianoRoll", from: "1.0.0"),
.package(url: "https://github.com/orchetect/MIDIKit", from: "0.9.4"),
.package(url: "https://github.com/orchetect/MIDIKit", from: "0.9.7"),
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comma Spacing Violation: There should be no space before and one after any comma. (comma)
Trailing Comma Violation: Collection literals should not have trailing commas. (trailing_comma)

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comma Spacing Violation: There should be no space before and one after any comma. (comma)
Trailing Comma Violation: Collection literals should not have trailing commas. (trailing_comma)

],
targets: [
.target(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@ struct DrumSequencerView: View {
conductor.start()
}
.onDisappear {
conductor.isPlaying = false
conductor.drums.destroyEndpoint()
conductor.stop()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ struct DrumSynthesizersView: View {
conductor.start()
}
.onDisappear {
conductor.isRunning = false
conductor.stop()
}
}
Expand Down
Loading