Re: Help needed for Audio Unit Parameter Change Notification
Re: Help needed for Audio Unit Parameter Change Notification
- Subject: Re: Help needed for Audio Unit Parameter Change Notification
- From: William Stewart <email@hidden>
- Date: Thu, 25 Oct 2007 11:41:53 -0700
Hi Rémi
You can do it using the listener notify API - it is declared in
<AudioToolbox/AudioUnitUtilities.h>
The process function however, is not the best place to put this - as
this is called for each channel. The best thing to do is to overide
the render call and then make that call after you have done the
processing:
ComponentResult YourEffectClass::Render( AudioUnitRenderActionFlags
&ioActionFlags,
const AudioTimeStamp & inTimeStamp,
UInt32 nFrames)
{
mNoteHasChanged = false;
ComponentResult result = AUEffectBase::Render (ioActionFlags,
inTimeStamp, nFrames);
if (result) return result; // if you have an error here, there is
nothing to do
if (mNoteHasChanged) {
... call the param listener notify as you list below
// presumably mNoteFreq is valid because mNoteHasChanged is true
}
return result;
}
Your mNoteHasChanged member should only be true if your processing
call has determined there is a new note number to display - if you
can't detect any, then this would remain false - so you only send this
when you have something useful and different to display. If it is
true, then of course you have a valid mNoteFreq
Bill
On Oct 25, 2007, at 8:13 AM, Rémi Thébault wrote:
Hello Everybody
I'm Newbie in Audio Unit development (and non-professionnal). I intend
to make a passthru effect unit that indicates the main frequency of
the sound going through it (using fft).
So I just need one parameter for the moment : named kParam_NoteFreq.
So at the end of the process function (right after the frequency
calculation) i have :
mAudioUnit->SetParameter(kParam_NoteFreq, mNoteFreq);
But it doesn't work. The AU Programming Guide says that this function
change the value of the parameter and notifies the listeners of the
change. But I didn't set up any listener and I don't know how to do it
and how it works.
I've also seen a thread like "Calling SetParameter() from within
Process()" where I found this code :
AudioUnitParameter param;
param.mAudioUnit = mAudioUnit->GetComponentInstance();
param.mScope = kAudioUnitScope_Global;
param.mParameterID = kParam_NoteFreq;
AUParameterListenerNotify(NULL, NULL, ¶m);
XCode raise an error during building saying that
AUParameterListenerNotify is not declared in this scope.
Any help would be appeciable.
Thanks in advance
Rémi Thébault
_______________________________________________
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