如何在 iOS 设备上播放 .mid 文件
我尝试了 AVAudioPlayer 它不起作用。
url= [NSURL fileURLWithPath:[NSString stringWithFormat:@"%@/test.mid", [[NSBundle mainBundle] resourcePath]]];
NSLog(@"URL Description is %@",[url description]);
NSError *error=nil;
AVAudioPlayer *audioPlayer = [[AVAudioPlayer alloc] initWithContentsOfURL:url error:&error];
if (error!=nil) {
NSLog(@"Error is %@",[error localizedDescription]);
}
[audioPlayer play];
我收到此错误
Error is The operation couldn’t be completed. (OSStatus error 1954115647.)
我应该使用其他方法来执行此操作吗?有什么建议吗?
谢谢
I tried AVAudioPlayer it doesnt work.
url= [NSURL fileURLWithPath:[NSString stringWithFormat:@"%@/test.mid", [[NSBundle mainBundle] resourcePath]]];
NSLog(@"URL Description is %@",[url description]);
NSError *error=nil;
AVAudioPlayer *audioPlayer = [[AVAudioPlayer alloc] initWithContentsOfURL:url error:&error];
if (error!=nil) {
NSLog(@"Error is %@",[error localizedDescription]);
}
[audioPlayer play];
I get this error
Error is The operation couldn’t be completed. (OSStatus error 1954115647.)
Should I be using another method to do this? Any suggestions?
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
iOS 5 上的音乐播放器+音乐序列
MusicPlayer+MusicSequence on ios 5
您可以使用内置的 CoreMIDI 框架。此处的文档:
http://developer.apple .com/library/mac/#documentation/MusicAudio/Reference/CACoreMIDIRef/MIDISetup/index.html
http://www.slideshare.net/invalidname/core-midi-and-friends
http://goodliffe.blogspot.com/2010/10/using-coremidi-in-ios-example.html
希望有帮助。
You can make use of the built-in CoreMIDI framework. Docs here:
http://developer.apple.com/library/mac/#documentation/MusicAudio/Reference/CACoreMIDIRef/MIDISetup/index.html
http://www.slideshare.net/invalidname/core-midi-and-friends
http://goodliffe.blogspot.com/2010/10/using-coremidi-in-ios-example.html
Hope it helps.