Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

neil.b

macrumors member
Original poster
Nov 20, 2008
65
0
I've got the AudioQueue stuff working to play sound in my application but I'm wondering what happens to all the opened audio files if the user quits the app using the home button, for example.

Do the open files get automatically closed?

What about audio buffers etc?

If I have to do manual cleaning up on exit, where do you do the cleaning up? I set a breakpoint in the dealloc method in my sound class but it doesn't seem to get called when the app is forced to quit (via the home button).
 

dejo

Moderator emeritus
Sep 2, 2004
15,982
452
The Centennial State
If I have to do manual cleaning up on exit, where do you do the cleaning up? I set a breakpoint in the dealloc method in my sound class but it doesn't seem to get called when the app is forced to quit (via the home button).
Normally this is done in applicationWillTerminate: in your application delegate.
 

firewood

macrumors G3
Jul 29, 2003
8,141
1,384
Silicon Valley
The OS mops up everything on termination, but it's often cleaner for your app to clean up the way you want in the applicationWillTerminate delegate.

It's also better for writing clean code and for debugging if you can account for everything in your termination delegate. e.g. if there's something you haven't closed or deallocated, it's a potential leak, etc.

.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.