quantumpotato
quantumpotato

Reputation: 9767

NSSound undeclared on iPhone?

sound = [[NSSound alloc] initWithContentsOfFile:@"staticbeam09.wav" byReference:YES];

Code referenced from Apple docs. Getting an error when I put this in viewDidLoad. If I put

NSSound *sound;

in the header file, I get the specifier-qualifier error at the top of my implementation file. What do I have to do to make this work? I was just pasting the code from Apple's documentation - has this been deprecated? Thanks for your help!

Upvotes: 3

Views: 3143

Answers (3)

Sj.
Sj.

Reputation: 592

http://icodeblog.com/2009/05/04/iphone-game-programming-tutorial-part-4-basic-game-audio/

that is how i did the audio bg music and sound effects at the end for iconquer

Upvotes: 0

zoul
zoul

Reputation: 104065

Oxigen’s right. If you want to play sounds on iPhone, there are several options. Probably the easiest one is using Audio Services (example wrapper), then there is AVAudioPlayer and then you can also use OpenAL (I’ve written a very basic OpenAL sound effect engine called Finch). Depends on what you need to do.

Upvotes: 3

oxigen
oxigen

Reputation: 6263

There is no NSSound class in iPhone SDK It's only for MacOS

Upvotes: 6

Related Questions