Re: sound advice
Re: sound advice
- Subject: Re: sound advice
- From: John Nestor <email@hidden>
- Date: Sat, 02 Feb 2002 15:54:27 -0500
I had a kick at the NSSound cat with mixed results. I was playing aiff
clips, 4 or 5 seconds duration. I inited with contents of file, by
reference. Just a few lines of code. They would load, play and stop just
fine - smooth - no choppiness. The bad news is that I was never able to
get NSSound to respond to pause and resume. Go figger.
Matt Neuburg wrote:
>
On Sat, 2 Feb 2002 20:48:16 +1030, Nathan Day <email@hidden> said:
>
>
>I've been using NSSound, initWithContentsOfFile, play, and it works fine
>
>for me using the system sounds which are just aiff. Are your sounds some
>
>weird sample rate or something.
>
>
>
>
No, it's 44.1 16-bit mono. I am now going through an elaborate
>
song-and-dance where I preload the sound when the application starts up (so
>
that I don't search for it on disk with soundNamed every time I play it)
>
and then spawn the playing of it off into a separate thread; I'm hoping
>
this will avoid the reported crash (which I've never seen personally), and
>
it has improved the playing each time, I think, except the first time which
>
is still broken up. Is there something special about the first time a sound
>
is played? Gee this is a lot of work just to go "ding". m.
>
>
>On Saturday, February 2, 2002, at 04:53 PM, Matt Neuburg wrote:
>
>
>
>>What's the recommended way to play a sound? My sound is an aiff file in
>
>>my
>
>>bundle. I've been playing it with soundNamed and play, but the sound is
>
>>usually choppy and I've had reports that the app sometimes crashes. I've
>
>>tried preloading the sound file into memory as NSData and playing from
>
>>there, but the sound is still usually choppy, even though it's a very
>
>>short
>
>>sound. Should I be playing the sound in another thread? Any advice
>
>>appreciated - m.
>
>>--
>
>>
>
>--__--__--
>
>
>
>Message: 8