Fwd: Report level in AudioUnit to parameter
Fwd: Report level in AudioUnit to parameter
- Subject: Fwd: Report level in AudioUnit to parameter
- From: Fastepholier Philgarlic <email@hidden>
- Date: Mon, 12 May 2014 18:17:06 +0200
Hi,
To have the generic view plot a level bar, do something like this:
ComponentResult GGPitchDetectorUnit::GetParameterInfo (AudioUnitScope inScope,
AudioUnitParameterID inParameterID,
AudioUnitParameterInfo &outParameterInfo
) {
ComponentResult result = noErr;
outParameterInfo.flags = 0;
if (inScope == kAudioUnitScope_Global) {
switch (inParameterID) {
case GGPitchUnitParameterEnergy:
AUBase::FillInParameterName (
outParameterInfo,
kParamEnergyName,
false
);
outParameterInfo.unit = kAudioUnitParameterUnit_Decibels;
// Sets the unit of measurement for the Frequency parameter to Hertz.
outParameterInfo.minValue = -30;
// Sets the minimum value for the Frequency parameter.
outParameterInfo.maxValue = 1;
// Sets the maximum value for the Frequency parameter.
outParameterInfo.defaultValue = 100;
// Sets the default value for the Frequency parameter.
outParameterInfo.flags |= kAudioUnitParameterFlag_MeterReadOnly | kAudioUnitParameterFlag_IsReadable;
break;
The relevant part being the setting of the flags. kAudioUnitParameterFlag_MeterReadOnly is what you want. By the way
kAudioUnitParameterFlag_PlotHistory is worth noting also. It gives a nice history curve.
To change the parameter, you can do this from your kernel:
myUnit->SetParameter(GGPitchUnitParameterEnergy, dbVal);
You don't need to subscribe to an event unless you want to react to a parameter change (like to update your custom view in the case you want to implement the view metering yourself)
_______________________________________________
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