making AUEffectBase::GetSampleRate safer
making AUEffectBase::GetSampleRate safer
- Subject: making AUEffectBase::GetSampleRate safer
- From: Marc Poirier <email@hidden>
- Date: Wed, 30 Jul 2003 11:58:26 -0500 (CDT)
Hi. AUEffectBase::GetSampleRate crashes if the elements have not been
created, which in practice means: it crashes if you call it from your
plugin's constructor. How about making the method look something like
this to make it safer:
Float64 AUEffectBase::GetSampleRate()
{
if (mElementsCreated)
return GetOutput(0)->GetStreamFormat().mSampleRate;
else
return kAUDefaultSampleRate;
}
But you'll have to make mElementsCreated protected rather than private or
add an accessor or something like that. Or alternatively, I guess you
could just add a call to CreateElements() to the AUEffectBase constructor.
Just an idea...
Thanks,
Marc
_______________________________________________
coreaudio-api mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/coreaudio-api
Do not post admin requests to the list. They will be ignored.