Question : procedural audio with swift
Answered by : ugliest-unicorn-6qz0lcv4rbxn
guard let soundFileURL = Bundle.main.url(forResource: "TestSound", withExtension:"wav") else { print("URL not found") return
}
do { audioPlayer = try AVAudioPlayer(contentsOf: soundFileURL)
} catch let error { print("Failed to load the sound: \(error)")
}
audioPlayer?.prepareToPlay()
Source : https://www.oreilly.com/library/view/ios-swift-game/9781491999073/ch04.html | Last Update : Sat, 09 Oct 21