Chris is doing this correctly.
It might also be worth pointing out that there is no way to get finer resolution than once per Render() call, because after the Host calls your AU with a buffer, it has no way of determining how far along the buffer you have progressed in your own looping. Even when scheduled parameter-slicing breaks up the buffer into multiple chunks, the CallHostBeatAndTempo() cannot tell the Host which slice is being processed. Slicing in this way is handled by the AU-inherited code, not by the Host.
As Chris said, we can't know if this will solve your problem, though. I just wanted to point out that you have nothing to gain by calling from Process().
Brian Willoughby Sound Consulting
On Mar 22, 2008, at 18:25, Chris Bennett wrote: Well, I am using CallHostBeatAndTempo() in one of my projects, and I override Render() and make the call from there -- this is a member function, so you should have access to all of your private variables in your AU with no problem. There is also the added advantage that it is called every slice, rather than every frame or sample, so the computational load is trivial, but you still have accuracy within a few ms normally to potential changes in tempo made by the host. I am not sure if this would solve your problems, but maybe :-)
Best ~cb
On Mar 22, 2008, at 3:02 PM: I'm writing an 'aufx' AU subclassed from AUEffectBase. Thus, I am also subclassing AUKernelBase and implementing my own Process() method.
I'm able to get information from the host such as sample rate (by using GetSampleRate(), defined in the AUKernelBase class), but I am unable to get the host's tempo by using CallHostBeatAndTempo(), defined in the AUBase class.
I am calling both of these methods from within my AUKernelBase subclass, inside the Process() method. The actual code being used for CallHostBeatAndTemp() is as follows:
Float64 beat, tempo; OSResult result = mAudioUnit->CallHostBeatAndTempo(&beat, &tempo);
Where mAudioUnit is defined in AUKernelBase as the AUEffectBase object which contains the kernel. Unfortunately, this operation always returns a value of -1, which (according to AUBase.h) indicates that no callback exists in the host application for retrieving this specific information (tempo, etc). As such, the values stored in the variables "beat" and "tempo" ending up being 0.0.
I have tried this AU inside two hosts: AU Lab, and Logic Pro 8. Both situations yield the same result.
Any help on this matter would be greatly appreciated!
--JT
|