有没有一种方法让音频单元主机逐步通过插件的参数并获取以下信息:
- 参数名称,例如字符串“Delay Time”
- 参数范围(最小值、最大值)
- 参数单位(例如秒)
- 参数控制(例如滑块)
#import
CAAUParameter和AUParamInfo(可以在/Developer/Extras/CoreAudio/PublicUtility中找到)。
编辑:这些文件现在可以在“Xcode音频工具”包中找到。您可以通过转到Xcode > 打开开发人员工具 > 更多开发人员工具...来获取它。theUnit
的AudioUnit,以下代码将设置您遍历theUnit
的参数: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
}
}
info.GetParamInfo(i))->ParamInfo()
将为您提供一个AudioUnitParameterInfo结构体,其定义如下:typedef struct AudioUnitParameterInfo
{
char name[52];
CFStringRef unitName;
UInt32 clumpID;
CFStringRef cfNameString;
AudioUnitParameterUnit unit;
AudioUnitParameterValue minValue;
AudioUnitParameterValue maxValue;
AudioUnitParameterValue defaultValue;
UInt32 flags;
} AudioUnitParameterInfo;