Event listeners callbacks for kAudioUnitEvent_ParameterValueChange is different 
than AudioUnitSetParameter calls, and any automation should be driven from the 
latter not the former.  The listener notifications cannot be immediate given 
that you register for them on a given run loop, whereas AudioUnitSetParameter 
calls can be made from any thread.  It does not surprise me that the 
notifications are more sporadic in an offline render because it likely is going 
faster than realtime, and so essentially periodically batched delivery of the 
notifications will have fewer firing event times.  The bottom line is that 
those event notifications are not something to rely upon for driving your 
actual audio state, there're intended for listeners, as the API indicates, not 
actors.

- Sophia


> On Mar 5, 2019, at 10:56 AM, Nuno Santos wrote:
> 
> Hi everyone,
> 
> I’m having a really tricky problem with kAudioUnitEvent_ParameterValueChange 
> on AudioUnit V2 implementation of my plugin.
> 
> While automating a parameter from 0 to 1 along 2 bars with tempo set at 120 
> bpm’s I get around 38 kAudioUnitEvent_ParameterValueChange calls (I have 
> timestamped the events):
> 
> #1 10:28:32.576 - 0
> #2 10:28:33.136 - 0.04
> #3 10:28:33.205 - 0.07
> …
> #36 10:28:35.805 - 0.94
> #37 10:28:35.876 - 0.97
> #38 10:28:35.990 - 1
> 
> The problem is that when bouncing or exporting the very same bar with Logic 
> Pro (10.4.0) I only get the following three events and they arrive at the 
> same time:
> 
> #1 - 10:41:21.355 - 0
> #2 - 10:41:21.355 - 1
> #3 - 10:41:21.355 - 0.88
> 
> This behaviour renders the parameter automation completely useless and my 
> clients are complaining. Curiously, the problem doesn’t manifest itself with 
> the very same code and plugin on Ableton Live. 
> 
> I’m registering the listener for events with the following call:
> 
> AUEventListenerCreate(IAUEventListenerDispatcher, _controller, 
> CFRunLoopGetMain(), kCFRunLoopDefaultMode, 0.05, 0.05, &_eventListener);
> 
> And the code for the listener is the following:
> 
> void IAUEventListenerDispatcher(void *inRefCon, void *inObject, const 
> AudioUnitEvent *inEvent, UInt64 inHostTime, Float32 value)
> {
>    IController* controller = (IController*) inObject;
> 
>    switch (inEvent->mEventType)
>    {
>        case kAudioUnitEvent_BeginParameterChangeGesture:
>        {
>            break;
>        }
>        case kAudioUnitEvent_EndParameterChangeGesture:
>        {
>            break;
>        }
>        case kAudioUnitEvent_ParameterValueChange:
>        {
>            
> controller->kernel()->setParameter(inEvent->mArgument.mParameter.mParameterID,
>  QVariant(value), false);
>            break;
>        }
>        case kAudioUnitEvent_PropertyChange:
>        {
>            break;
>        }
>    }
> }
> 
> Does anyone has an idea of why this happens in Logic Pro?
> 
> Thanks in advance!
> 
> Best regards,
> 
> Nuno Santos
 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Coreaudio-api mailing list      ([email protected])
Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/coreaudio-api/archive%40mail-archive.com

This email sent to [email protected]

Reply via email to