Re: Playing Music in Objective C
Re: Playing Music in Objective C
- Subject: Re: Playing Music in Objective C
- From: Alex Zavatone <email@hidden>
- Date: Sun, 12 Feb 2012 16:21:46 -0600
Back in the Director/Shockwave days, we had to write our own sound management routines.
Preloading the sound, or set of sounds was one of the important things we had to do before playing them or they will be fetched off the disk and loaded into memory when they are needed.
On Feb 12, 2012, at 2:38 PM, Jens Alfke 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.
>
> If you find yourself needing a more powerful API, AVFoundation might be a good bet now; I haven’t tried it myself. Beyond that you quickly end up falling down a rabbit-hole of ever more complex APIs, culminating in CoreAudio.
>
> —Jens_______________________________________________
>
> Cocoa-dev mailing list (email@hidden)
>
> 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:
>
> This email sent to email@hidden
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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:
This email sent to email@hidden