如何在Mac OS中播放声音?

时间:2011-08-17 23:07:26

标签: objective-c xcode macos

我想在专为Mac OS X Lion 10.7设计的Objective-C应用程序中播放.mp3文件,而不是iPhone。谢谢!

1 个答案:

答案 0 :(得分:20)

看一下NSSound课程:

NSSound *sound = [[NSSound alloc] initWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"mySound" ofType:@"mp3"] byReference:NO];
[sound play];
[sound release];