Manually Changing an Audio Unit Parameter while Running
Manually Changing an Audio Unit Parameter while Running
- Subject: Manually Changing an Audio Unit Parameter while Running
- From: mark erickson <email@hidden>
- Date: Sun, 17 Apr 2005 15:52:23 -0500
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
Director of Recording Arts
Texas State University - San Marcos
224 N. Guadalupe St.
San Marcos, TX 78666
(512) 245-8451
email@hidden
http://www.txstate.edu/music/srt/
_______________________________________________
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