如何在 Xcode 4.2 的 Mac 应用程序中播放 mp3
我正在尝试在 Xcode 4.2 中的 Mac 应用程序中播放 mp3。我该怎么做?
I'm trying to play an mp3 in a Mac Application in Xcode 4.2. How would I do this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您没有给我们太多的帮助...
如果您只想要简单的声音,请使用 NSSound:
使用 NSSound,声音会与您的代码同时播放。一个常见的错误是在声音或资源仍在播放时释放它。不要那样做。
您还可以使用 QTMovie in QTKit:
对于要求更高的声音,请使用 <一个href="http://developer.apple.com/library/mac/#documentation/MusicAudio/Conceptual/CoreAudioOverview/Introduction/Introduction.html" rel="nofollow noreferrer">CoreAudio
You are not giving us much to work with...
If you just want a simple sound, use NSSound:
With NSSound, the sound plays concurrently with your code. A common mistake is to release the sound or resource while it is still playing. Don't do that.
You can also use QTMovie in QTKit:
For more demanding sounds, use CoreAudio
您应该使用 QTKit 框架和 QTMovie 类。
You should use QTKit framework and the QTMovie class.