Skip to content

Commit

Permalink
Merge pull request #167 from NickCulbertson/iOS18SampleRate
Browse files Browse the repository at this point in the history
Update Settings.samplerRate in iOS 18 and newer to 48_000
  • Loading branch information
NickCulbertson authored Oct 11, 2024
2 parents 7a14910 + 2afe50c commit 6bff1a5
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions Cookbook/Cookbook/CookbookApp.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,9 @@ struct CookbookApp: App {
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
// Settings.sampleRate default is 44_100
if #available(iOS 18.0, *) {
Settings.sampleRate = 48_000
}

try AVAudioSession.sharedInstance().setPreferredIOBufferDuration(Settings.bufferLength.duration)
Expand Down

0 comments on commit 6bff1a5

Please sign in to comment.