Ios 如何使用带Swift的MazingAudioEngine播放音频文件?
我需要用mazingaudioengineIos 如何使用带Swift的MazingAudioEngine播放音频文件?,ios,swift,audio,the-amazing-audio-engine,Ios,Swift,Audio,The Amazing Audio Engine,我需要用mazingaudioengine框架和Swift播放单个音频文件。 我是这个框架的新手,尝试了下面的代码,但是音频没有播放。怎么了?如何播放音频文件 do { var audioController = AEAudioController(audioDescription: AEAudioController.nonInterleavedFloatStereoAudioDescription()) let file = NSBundle.mainBundle().URL
框架和Swift
播放单个音频文件。
我是这个框架的新手,尝试了下面的代码,但是音频没有播放。怎么了?如何播放音频文件
do {
var audioController = AEAudioController(audioDescription: AEAudioController.nonInterleavedFloatStereoAudioDescription())
let file = NSBundle.mainBundle().URLForResource("myaudiofile", withExtension: "wav")!
let channel = try AEAudioFilePlayer(URL: file)
audioController?.addChannels([channel])
channel.playAtTime(0)
} catch {
print("Failure")
}
我没有启动音频控制器
:
do {
var audioController = AEAudioController(audioDescription: AEAudioController.nonInterleavedFloatStereoAudioDescription())
let file = NSBundle.mainBundle().URLForResource("myaudiofile", withExtension: "wav")!
let channel = try AEAudioFilePlayer(URL: file)
audioController?.addChannels([channel])
try audioController!.start()
} catch {
print("Failure")
}