Skip to content

Commit 6bff1a5

Browse files
Merge pull request #167 from NickCulbertson/iOS18SampleRate
Update Settings.samplerRate in iOS 18 and newer to 48_000
2 parents 7a14910 + 2afe50c commit 6bff1a5

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

Cookbook/Cookbook/CookbookApp.swift

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,9 @@ struct CookbookApp: App {
1212
do {
1313
Settings.bufferLength = .short
1414

15-
let deviceSampleRate = AVAudioSession.sharedInstance().sampleRate
16-
if deviceSampleRate > Settings.sampleRate {
17-
// Update sampleRate to 48_000. Default is 44_100.
18-
Settings.sampleRate = deviceSampleRate
15+
// Settings.sampleRate default is 44_100
16+
if #available(iOS 18.0, *) {
17+
Settings.sampleRate = 48_000
1918
}
2019

2120
try AVAudioSession.sharedInstance().setPreferredIOBufferDuration(Settings.bufferLength.duration)

0 commit comments

Comments
 (0)