Re: Preloading sounds
Re: Preloading sounds
- Subject: Re: Preloading sounds
- From: Jörn Salewski <email@hidden>
- Date: Wed, 21 Jan 2004 21:09:26 +0100
Hello,
>
I wrote a simple Tic Tac Toe game in Cocoa, and it works pretty well for the
>
most part. The only real problem I'm encountering is that the first time I
>
play a sound, there is a brief delay.
>
I've noticed this too and, if I remember correctly, I think I have found in
the archives (
http://cocoa.mamasam.com/) one or two mails questioning the
very same problem, but alas no solution was ever given.
I'd call it a bug.
Actually, I don't have this delay problem anymore, but, thinking about it,
I'm not really sure why. Possible reasons:
a) Now I'm developing under Panther and it this bug has been fixed in that
version. Can't say for sure. No Jaguar at hand anymore.
b) Now I'm instantiating the NSSound in the +initialize method of the class
beeing the owner of the sound. Maybe this very early instantiation has some
influence. I admit, I'm too lazy to check this out now, but maybe you give
it a try and tell us your observations.
>
Somebody suggested to load all of the sounds into a dictionary, so I tried
>
this:
>
...
>
I still get a delay. Have I made a mistake in my approach with the
>
NSDictionary? Also, should I release win, lose & draw since they are now
>
part of the dictionary?
You have to release them sometime. Either immediately after you handed over
the responsibility to the dictionary or later when your owning class
deallocates (not absulutely neccessary if you keep your sounds around until
your application terminates.)
However, if the dictionary doesn't help with your problem, why using it
further?
Cheers,
Joern Salewski
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.