0

I am developing a cocos2d IPhone app using the SimpleAudioEngine to play some mp3 sounds. My problem is that when I resume the app after a long time it is in background some sounds are no longer played. Have you ever experienced this? Do you know if there is any way to fix it?

Thank you in advance

Andrea

Guru
  • 21,652
  • 10
  • 63
  • 102
Andrea Sindico
  • 7,358
  • 6
  • 47
  • 84

1 Answers1

1

Cocos2d retains/releases the [SimpleAudioEngine sharedEngine] and I don't think that you have control of this outside of the sharedEngine.

The key to this might be how you address in the appdelegate how your app resigns and becomes active.

It is not good to keep all your audio files in memory, especially if the app has been resigned for some time and thus, [SimpleAudioEngine sharedEngine] takes care of the memory management.

Nungster
  • 726
  • 8
  • 28
  • I do not retain the audio files (nor the SimpleAudioEngine) but prea-load them once, when the app starts. Now I understand if some of them are released after a long period they are not used. However I guess they should be (automatically) be reloaded when I try to play them again, instead they are not. Anyway I am going to preload the audio files (always through the SimpleAudioEngine) any time the app becomes active and tell you what is the final result. – Andrea Sindico Aug 25 '11 at 12:39