I play with the Apple Project sample "LoadPresetDemo". I added the AudioUnit kAudioUnitSubType_Reverb2
reverb sound block to the graph, which is the only iOS reverb available. The CoreAudio header file "AudioUnitParameters.h" indicates that Reverb2 should respond to these parameters:
enum { // Global, CrossFade, 0->100, 100 kReverb2Param_DryWetMix = 0, // Global, Decibels, -20->20, 0 kReverb2Param_Gain = 1, // Global, Secs, 0.0001->1.0, 0.008 kReverb2Param_MinDelayTime = 2, // Global, Secs, 0.0001->1.0, 0.050 kReverb2Param_MaxDelayTime = 3, // Global, Secs, 0.001->20.0, 1.0 kReverb2Param_DecayTimeAt0Hz = 4, // Global, Secs, 0.001->20.0, 0.5 kReverb2Param_DecayTimeAtNyquist = 5, // Global, Integer, 1->1000 kReverb2Param_RandomizeReflections = 6, };
After initializing and starting AUGraph everything compiles, I hear a sound.
Then I change the kReverb2Param_DryWetMix parameter (changing it to a full wet mix):
AudioUnitSetParameter(_reverbUnit, kAudioUnitScope_Global, 0, kReverb2Param_DryWetMix, 100.0f, 0);
All is well, I hear a sound with a full wet mixed reverb.
Now listen to where I run into problems. When I try to change any parameter other than kReverb2Param_DryWetMix
, I get error code -10877
. It seems that these other parameters listed in the header file do not actually exist.
For example, a call
AudioUnitSetParameter(_reverbUnit, kAudioUnitScope_Global, 0, kReverb2Param_DecayTimeAtNyquist, 20.0f, 0)
Throws error -10877
.
This is mistake? Did I miss any sound frames? I did not import specific audio headers?
Current audio cards include AVFoundation and AudioToolbox. Current audio import
#import <AudioToolbox/AudioToolbox.h> #import <AVFoundation/AVFoundation.h> #import <CoreAudio/CoreAudioTypes.h>
I looked at google without a solution. I know that I have problems when the Google route fails. Any help would be greatly appreciated.
Note. I tested the simulator and the iPhone 4S device, the same problem.
UPDATE: I tried
AudioUnitGetParameter(_reverbUnit, kReverb2Param_DecayTimeAtNyquist, kAudioUnitScope_Global, 0, &value)
and returns the value 0.500000
, which means that the property exists. So what am I doing wrong when setting the value?