Re: Manually Changing an Audio Unit Parameter while Running
Re: Manually Changing an Audio Unit Parameter while Running
- Subject: Re: Manually Changing an Audio Unit Parameter while Running
- From: Marc Poirier <email@hidden>
- Date: Mon, 18 Apr 2005 09:00:50 -0400
PropertyChanged is for reporting property changes, not parameter
changes. To send a notification of a parameter change, this will work:
AudioUnitParameter dirtyParam;
dirtyParam.mAudioUnit = mAudioUnit->GetComponentInstance();
dirtyParam.mParameterID = kParam_One;
dirtyParam.mScope = kAudioUnitScope_Global;
dirtyParam.mElement = 0;
AUParameterListenerNotify(NULL, NULL, &dirtyParam);
Marc
On Apr 17, 2005, at 4:52 PM, mark erickson wrote:
I'm trying to manually change a parameter in my AU while it's running.
For example, if the user set the input gain too high, the AU would
automatically change the gain
to a more appropriate setting. So far, so good. However, the GUI
should update as well
reflecting the changed setting. This is the part I can't get to work.
I think I'm supposed to call 'PropertyChanged()' but this function
resides in AUBase and I can't access it from within my
Kernel::Process().
Any suggestions would be most welcome.
Thanks
Mark
//
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~~~~
void Noyz::BitsKernel::Process( const Float32 *inSourceP,
Float32 *inDestP,
UInt32 inFramesToProcess,
UInt32 inNumChannels,
bool &ioSilence )
{
UInt32 nSampleFrames = inFramesToProcess;
const Float32 *sourceP = inSourceP;
Float32 *destP = inDestP;
Float32 gain = GetParameter( kParam_Gain );
while (nSampleFrames-- > 0) {
Float32 inputSample = *sourceP;
sourceP += inNumChannels;
// Float32 outputSample = do some DSP;
Float32 newGain = 0.0;
if ( outputSample > 1 ) {
newGain = 1.0 / outputSample;
ouputSample = 1.0;
}
if ( outputSample < -1 ) {
newGain = -1.0 / outputSample;
ouputSample = -1.0;
}
if ( newGain != 0 ) {
// this call works
//mAudioUnit->SetParameter(kParam_Gain, newGain);
// these do not...
//mAudioUnit->PropertyChanged(kParam_One, kAudioUnitScope_Global,
0);
//AUBase::PropertyChanged(kAudioUnitProperty_ParameterInfo,
kAudioUnitScope_Global, 0)
}
*destP = outputSample;
destP += inNumChannels;
}
}
Mark C. Erickson
_______________________________________________
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