Re: Host callback
Re: Host callback
- Subject: Re: Host callback
- From: Marc Poirier <email@hidden>
- Date: Wed, 2 Mar 2005 23:03:00 -0500
I would just suggest modifying that to have this somewhere earlier:
static bool gIsTransportStateProcSafe = IsTransportStateProcSafe();
and then check on the value of gIsTransportStateProcSafe rather than
calling IsTransportStateProcSafe() during every render call. Not that
it's necessarily so expensive, but the call does involve some bundle
finding, plist parsing, etc. And the result is never going to change
throughout the life of the process.
Marc
On Mar 2, 2005, at 6:37 PM, Pavol Markovic wrote:
Hi Ralph,
here's example. The only relevant place/frequency to call callback
functions is in render/process thread, max once per render call (you
don't have to call it for every single frame, because the number of
frames to render are passed as parameter into render method/function)
... somewhere in render/process call stack...
bool haveSamplePos = false;
Float64 outCurrentSampleInTimeLine;
if ( IsTransportStateProcSafe() &&
mHostCallbackInfo.transportStateProc )
{
OSStatus result =
mHostCallbackInfo.transportStateProc(mHostCallbackInfo.hostUserData,
NULL, NULL, &outCurrentSampleInTimeLine, NULL, NULL, NULL);
if ( result == noErr )
{
haveSamplePos = true;
}
}
Please note, that currently very few hosts provide this info and older
versions of GarageBand and Logic may crash when tryin' to call this.
Find e-mail thread "TransportState Logic/GarageBand workaround" in
archives (8/18/2004).
Best,
Pavol Markovic
_______________________________________________
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