Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I play a sound in Mac OS?

I want to play a .mp3 file in an Objective-C app being designed for use on Mac OS X Lion 10.7, not for the iPhone. Thanks!

like image 301
please delete me Avatar asked Aug 17 '11 23:08

please delete me


1 Answers

Take a look at the NSSound class:

NSSound *sound = [[NSSound alloc] initWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"mySound" ofType:@"mp3"] byReference:NO];
[sound play];
[sound release];
like image 114
Macmade Avatar answered Nov 17 '22 20:11

Macmade