Re: AUEventListenerCreate / AUEventListenerAddEventType
Re: AUEventListenerCreate / AUEventListenerAddEventType
- Subject: Re: AUEventListenerCreate / AUEventListenerAddEventType
- From: William Stewart <email@hidden>
- Date: Fri, 26 Sep 2008 12:51:00 -0700
Ethan
kCFRunLoopDefaultMode is correct; the listening run loop is
definitely listening in that mode.
What is the AU / parameter? Who is changing it? Is AUParameterSet or
AUParameterListenerNotify definitely being called?
Also - for the dispose, yes you can just call the dispose call and it
will remove the listeners for you
Bill
From: William Stewart <email@hidden>
Date: September 25, 2008 7:31:28 PM PDT
To: Ethan Funk <email@hidden>
Cc: CoreAudio API <email@hidden>
Subject: Re: AUEventListenerCreate / AUEventListenerAddEventType
I think you have to use the:
kCFRunLoopCommonModes
not the default one for the creation of the listener
Otherwise, I can't see anything obviously wrong
On Sep 25, 2008, at 5:39 PM, Ethan Funk wrote:
I'm having a bit of trouble with AUEventListener.
Here is what I am trying to do:
create a pthread and run a runloop in it which will receive
notifications of parameter changes on a particular audio unit
running with in my program. I am interested only in parameters
with display flags - level meters and such. My pthread will
then pass the new value along to a client through a custom
notification mechanism.
I create the run loop in my thread:
auNotifyLoop = CFRunLoopGetCurrent();
CFRetain(auNotifyLoop);
while(run)
// Run loop for capturing AudioUnit parameter changes
CFRunLoopRunInMode(kCFRunLoopDefaultMode, 1.0, false);
CFRelease(auNotifyLoop);
pthread_exit(0);
Elsewhere in the code I create a a listener:
...
err = AUEventListenerCreate(auEventListenerProc, NULL,
auNotifyLoop, kCFRunLoopDefaultMode, 0.100, 0.100, &listener);
...
were auEventListenerProc is my callback procedure. There is no
error here.
Then I Add events to listen for by iterating through the audio
unit's parameters:
...
err = AudioUnitGetProperty(instance,
kAudioUnitProperty_ParameterInfo, kAudioUnitScope_Global,
parameterArray[index], ¶mInfo, &size);
if(paramInfo.flags & kAudioUnitParameterFlag_DisplayMask){
propertyEvent.mEventType = kAudioUnitEvent_ParameterValueChange;
propertyEvent.mArgument.mParameter.mAudioUnit = instance; //
the AudioUnit instance
propertyEvent.mArgument.mParameter.mParameterID =
parameterArray[index]; // parameter ID
propertyEvent.mArgument.mParameter.mScope =
kAudioUnitScope_Global;
propertyEvent.mArgument.mParameter.mElement = 0;
OSStatus err = AUEventListenerAddEventType(listener, NULL,
&propertyEvent);
...
Again, no errors, but my call back never gets called when the
parameters change. What am I missing?
Also, I was wondering if I can call AUListenerDispose on my
listener when I am done without calling
AUEventListenerRemoveEventType for each event I added?
Ethan...
_______________________________________________
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
_______________________________________________
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