在AudioUnit子typeskAudioUnitSubType_NewTimePitch上设置速率

我试图获取/设置一个kAudioUnitSubType_NewTimePitch与子typeskAudioUnitSubType_NewTimePitch

audio单元通过AUNode添加到AUNode ,具有以下组件说明:

 acd->componentType = kAudioUnitType_Effect; acd->componentSubType = kAudioUnitSubType_NewTimePitch; acd->componentManufacturer = kAudioUnitManufacturer_Apple; 

根据AudioUnitParameters.h ,获取/设置速率应该像获取/设置audio单元上的速率参数一样简单。

 // rate control. // Global, rate, 1/32 -> 32.0, 1.0 kNewTimePitchParam_Rate = 0, 

但是,虽然设置该值似乎没有问题(没有错误返回)获取值产生值为-10878 (kAudioUnitErr_InvalidParameter)

以下是我如何设置值:

 - (void)setTempo:(float)value { OSStatus err = noErr; err = AudioUnitSetParameter(tempoUnit, kNewTimePitchParam_Rate, kAudioUnitScope_Global, 0, (Float32)value, 0); if (err != noErr) { NSLog(@"Could not set tempo unit rate: %d", err); } // no error } 

以及我如何(尝试)得到它:

 - (float)tempo { OSStatus err = noErr; Float32 value = 1.0; err = AudioUnitGetParameter(tempoUnit, kNewTimePitchParam_Rate, kAudioUnitScope_Global, 0, &value); if (err != noErr) { // -10878 NSLog(@"Could not get tempo unit rate: %d", err); } return value; } 

节点的input连接到混合器节点,并将输出连接到RemoteIO单元。

有任何想法吗 ?

事实certificate,audio单元的types是错误的。

我更改为types的kAudioUnitType_FormatConverter并保持相同的子types。

得到/设定节奏现在按预期工作。

我还不清楚为什么我没有得到任何错误,无论是设置audio设备,还是设置速率的值。