Reputation: 5296
Is there a way for an Audio Unit host to step through a plugin's parameters and gain such information as:
AFAICT this information is available in the plugin, but I can't figure out how to query it from the host side.
Upvotes: 4
Views: 1007
Reputation: 1461
You'll first need to #import
CAAUParameter and AUParamInfo (which can be found in /Developer/Extras/CoreAudio/PublicUtility).
EDIT: These files are now found in the "Audio Tools For Xcode" package. You can get it by going to Xcode > Open Developer Tool > More Developer Tools...
Assuming you have an AudioUnit called theUnit
The following code will set you up to iterate through theUnit
's parameters:
bool includeExpert = false;
bool includeReadOnly = false;
AUParamInfo info (theUnit, includeExpert, includeReadOnly);
for(int i = 0; i < info.NumParams(); i++)
{
if(NULL != info.GetParamInfo(i))
{
// Do things with info here
}
}
For example, info.GetParamInfo(i))->ParamInfo()
will give you an AudioUnitParameterInfo struct which is defined as follows:
typedef struct AudioUnitParameterInfo
{
char name[52];
CFStringRef unitName;
UInt32 clumpID;
CFStringRef cfNameString;
AudioUnitParameterUnit unit;
AudioUnitParameterValue minValue;
AudioUnitParameterValue maxValue;
AudioUnitParameterValue defaultValue;
UInt32 flags;
} AudioUnitParameterInfo;
Note that you'll need to open the AudioUnit first (eg. by calling AUGraphOpen() on the Graph which contains the unit).
Upvotes: 8