Hi all,
I've removed my Kernel object from a simple AU generated from the AU effect template. In doing so, I've moved a listener for my parameters to the main AudioUnit class (derived from AUEffectBase). Unfortunately, now I'm getting errors on the calls to AUListenerAddParameter. The error is -50 (error in user parameter list).
Is it ok to make these calls from the constructor for the AudioUnit?
The AUListenerCreate returns 0 (noErr), but the calls to AUListenerAddParameter fail. Here's the relevant code (from the constructor of MyAU):
OSStatus stat = AUListenerCreate( ParameterListenerDispatcher, this, NULL, // same as CFRunLoopGetCurrent(), NULL, // same as kCFRunLoopDefaultMode, 0.100, // 100 ms ¶meterListener ); int i; for (i = 0; i < parameterCount; ++i) { AudioUnitParameter auParam; auParam.mAudioUnit = component; auParam.mParameterID = i; auParam.mScope = kAudioUnitScope_Global; auParam.mElement = 0; // TODO: is this ALWAYS correct? stat = AUListenerAddParameter( parameterListener, NULL, &auParam ); }
This code comes immediately after the loop calling SetParameter for each of my effect parameters. Here's the callback:
void ParameterListenerDispatcher( void *inRefCon, void *inObject, const AudioUnitParameter *inParameter, Float32 inValue ) { // inObject ignored
MyAU* listener = (MyAU*)inRefCon; listener->OnParamChangeNotification( inParameter, inValue ); }
This all worked fine when it was in the constructor for the Kernel object. Any thoughts as to why this is failing?
Thanks, Howard
|