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: Rémi Thébault <email@hidden>
- Date: Fri, 26 Oct 2007 01:00:46 +0200
Thank you for your tip Bill
I still have an issue : I've declared mNoteFreq and mNoteHasChanged
as private in MyEffectClass::MyEffectClassKernel, so the compiler
raise an error when it find them in MyEffectClass::Render().
How should I declare those variable so that I can easily use them
both in the Render () and in the Process() functions (and if possible
in a nice programmation style)
Sorry for this kind of foolish question
Thanks in advance
Rémi
Le 25 oct. 07 à 20:41, William Stewart a écrit :
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:
40apple.com
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