Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to set the reverb level and time on kAudioUnitSubType_Reverb2

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.

like image 321
morgancodes Avatar asked Mar 01 '12 16:03

morgancodes


1 Answers

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)

like image 145
Art Gillespie Avatar answered Sep 28 '22 01:09

Art Gillespie