如何在kAudioUnitSubType_Reverb2上设置混响级别和时间

mor*_*des 6 audio audiounit ios

我设法在我的图表中添加了一个混响单元,或多或少如此:

AudioComponentDescription auEffectUnitDescription;
    auEffectUnitDescription.componentType = kAudioUnitType_Effect;
    auEffectUnitDescription.componentSubType = kAudioUnitSubType_Reverb2;
    auEffectUnitDescription.componentManufacturer = kAudioUnitManufacturer_Apple;

AUGraphAddNode(
                              processingGraph,
                              &auEffectUnitDescription,
                              &auEffectNode), 
Run Code Online (Sandbox Code Playgroud)

现在我如何更改混响单元上的一些参数?我想改变湿/干比,减少腐烂时间.

Art*_*pie 15

首先,您必须获得对实际混响音频单元的引用:

AudioUnit reverbAU = NULL;

AUGraphNodeInfo(processingGraph, auEffectNode, NULL, &reverbAU);
Run Code Online (Sandbox Code Playgroud)

现在你有音频单元,你可以在上面设置参数,比如

// set the decay time at 0 Hz to 5 seconds
AudioUnitSetParameter(reverbAU, kAudioUnitScope_Global, 0, kReverb2Param_DecayTimeAt0Hz, 5.f, 0);
// set the decay time at Nyquist to 2.5 seconds
AudioUnitSetParameter(reverbAU, kAudioUnitScope_Global, 0, kReverb2Param_DecayTimeAtNyquist, 5.f, 0);
Run Code Online (Sandbox Code Playgroud)

你可以找到混响单元(和所有Apple提供的音频单元)的AudioUnit/AudioUnitParameters.h参数(Reverb param enum在521行)

  • 如果那是你想要的,我可以让你接受答案吗?谢谢! (4认同)