• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: AU Cleanup / destructor, what to do in which method?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: AU Cleanup / destructor, what to do in which method?


  • Subject: Re: AU Cleanup / destructor, what to do in which method?
  • From: William Stewart <email@hidden>
  • Date: Mon, 14 Aug 2006 12:21:23 -0700

I wouldn't make any assumptions about "only once" - if you look through the code in AUBase you'll see that it manages this for you (so a client can call AudioUnitInitialize on your AU multiple times, but you'll only have your Init... method called once.

Cleanup can be called in response to either AudioUnitUninitialize or when the AU is destroyed...

Bill

On 11/08/2006, at 2:41 PM, Chris wrote:

Thanks,

this wasn't clear in my mind because in the doc, Cleanup is not used, Uninitialize is used in place (no explicit links between the two).

and in the AUBase code, we have DoInitiaze and DoCleanup with a comment saying there purpose is to ensure Initialize/Cleanup is called only once. Should be "Only once after constructor or cleanup" for Initialize and "Only after Initialize, and only once for Cleanup".

Regards,
Chris

Cleanup is called by the AudioUnitUninitialise API call.
The Destructor is called by closing the audio unit (CloseComponent)
If a host app has to do a format change for instance, then it will Uninitialise your AU, make the change, and reinitialise your AU.
There are some things you might decide to do when you are first Initialised (that you would cleanup when you are closed for instance), but you wouldn't clean these up in the Uninit call (Cleanup)
There's some commentary about the Init/Uninit Open/Close states in the AU docs: /Developer/Examples/CoreAudio/Documentation/
Bill
On 10/08/2006, at 1:11 PM, Chris wrote:
Hi,

I'm wondering what to do in the destructor of my AU (inheriting from AUBase) versus what to do in Cleanup method.

If Cleanup is freeing everything, then we don't need to do anything in destructor.
Is Cleanup always preceding the destruction of the AU (AU lifecycle : construction/Initialize/Work/Cleanup/Destruction)?


Best regards
Chris
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Coreaudio-api mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
40apple.com


This email sent to email@hidden
--mailto:email@hidden
tel: +1 408 974 4056
_____________________________________________________________________ _____
"Much human ingenuity has gone into finding the ultimate Before.
The current state of knowledge can be summarized thus:
In the beginning, there was nothing, which exploded" - Terry Pratchett
_____________________________________________________________________ _____

_______________________________________________ Do not post admin requests to the list. They will be ignored. Coreaudio-api mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: This email sent to email@hidden

--
mailto:email@hidden
tel: +1 408 974 4056
________________________________________________________________________ __
"Much human ingenuity has gone into finding the ultimate Before.
The current state of knowledge can be summarized thus:
In the beginning, there was nothing, which exploded" - Terry Pratchett
________________________________________________________________________ __


_______________________________________________
Do not post admin requests to the list. They will be ignored.
Coreaudio-api mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


References: 
 >AU Cleanup / destructor, what to do in which method? (From: Chris <email@hidden>)
 >Re: AU Cleanup / destructor, what to do in which method? (From: William Stewart <email@hidden>)
 >Re: AU Cleanup / destructor, what to do in which method? (From: Chris <email@hidden>)

  • Prev by Date: AU incorrectly reports Dynamic Configuration capability ???
  • Next by Date: Re: AU incorrectly reports Dynamic Configuration capability ???
  • Previous by thread: Re: AU Cleanup / destructor, what to do in which method?
  • Next by thread: set buffer size for a duration?
  • Index(es):
    • Date
    • Thread