On 13 February, 2012 4:38, Jens Alfke <j...@mooseyard.com> wrote:
> 
> On Feb 12, 2012, at 10:35 AM, Conrad Shultz wrote:
> 
>> The simplest (and therefore least customizable) approach would be to use 
>> NSSound. But I think it will do everything you stipulate. 
> 
> A minor issue with NSSound in games is that, the first time you play a 
> particular sound, it’ll first hang for a fraction of a second while it loads 
> the file. I’ve found this to be annoyingly distracting since it also freezes 
> animations. To work around this, at startup create the NSSound object, set 
> its volume to 0 and play it once. That will pre-load the samples into memory.

Actually I found that there is no need to play the NSSound at 0 volume to load 
the data into RAM, simply instantiating the NSSound ahead of time (with 
+soundNamed:) is enough.  I looked into using NSSound for simple game sounds in 
a blog post a while back: 
http://bleepsandpops.com/post/1431403685/using-nssound-for-simple-game-sounds-in-cocoa

As the OP was creating a simple puzzle game I think NSSound is a reasonable way 
to go for the sound effects.  Might even be reasonable for the music too, if it 
is just a looping MP3.

Jim
_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to