Re: AUKernel Lifecycle ?
Re: AUKernel Lifecycle ?
- Subject: Re: AUKernel Lifecycle ?
- From: Marc Poirier <email@hidden>
- Date: Wed, 2 Nov 2005 13:34:29 -0500
Hmmm, good question... There doesn't seem to be an obvious
solution. Here's one idea that I came up with, though:
You could override Initialize() like this:
ComponentResult YourPlugin::Initialize()
{
ComponentResult result = AUEffectBase::Initialize();
if (result == noErr)
result = Reset(kAudioUnitScope_Global, 0);
return result;
}
AUEffectBase::Reset() will call Reset() on all of your kernels, so
then what you could do is check for MaxFramePerSlice changes (or
whatever other changes) during your kernel's Reset() method and react
to resource changes accordingly there.
Marc
On Nov 2, 2005, at 1:25 PM, Robert Abernathy wrote:
O.K. Thanks for the info.
But, this leaves me confused as to how a kernel is supposed to
interact in the Initialize/Uninitialize cycle. In particular, how/
when should the kernel react to changing resource requirements
(like buffers and such)?
Rob
On 2 Nov 2005, at 18:07, Marc Poirier wrote:
The way it's currently implemented in AUEffectBase is that kernels
are created as needed and deleted when not needed. So I guess
that is to say, so far as what the lifespan of one is, it
depends. During Initialize(), AUEffectBase checks how many
channels are set for the current stream format. If there are not
enough kernels instantiated at that point (and during the first
Initialize(), that is definitely true, since none have been
created yet at that point), then more kernel instances are
created. On the other hand, if, at that point, there are too many
kernels, then the extra instances are deleted. If there is the
right amount, then nothing changes. Then, at the end of the AU
instance's life, whatever kernel instances are still around will
be deleted.
So, in other words: no, they are not bound to a single Initialize/
Uninitialize cycle. They are created and deleted only as needed.
Marc
On Nov 2, 2005, at 11:13 AM, Robert Abernathy wrote:
Hopefully, this will be an easy one.
I'm a bit confused about the AU construction/initialization/reset
life cycle and how it manifests itself in the case where the AU
uses the AUKernel path.
Do a new kernels get created for each Initialization on the AU.
I have no reason to think this other than I can't see how it
would work otherwise.
If so, can I then trust that mAudioUnit->GetMaxFramesPerSlice()
will be correct for the life of the Kernel?
Thanks for the help.
Rob
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Coreaudio-api mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
40musicunfolding.com
This email sent to email@hidden
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Coreaudio-api mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
40smartelectronix.com
This email sent to email@hidden
_______________________________________________
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