7

I've managed to add a reverb unit to my graph, more or less like so:

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

AUGraphAddNode(
                              processingGraph,
                              &auEffectUnitDescription,
                              &auEffectNode), 

Now how can I change some of the parameters on the reverb unit? I'd like to change the wet/dry ratio, and reduce the decay time.

morgancodes
  • 25,055
  • 38
  • 135
  • 187

1 Answers1

15

First, you have to get a reference to the actual reverb Audio Unit:

AudioUnit reverbAU = NULL;

AUGraphNodeInfo(processingGraph, auEffectNode, NULL, &reverbAU);

Now that you have the Audio Unit you can set parameters on it, like

// 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);

You can find the parameters for the reverb unit (and all Apple-supplied Audio Units) in AudioUnit/AudioUnitParameters.h (Reverb param enum is on line 521)

Art Gillespie
  • 8,747
  • 1
  • 37
  • 34