Core Audio(iOS 5.1)Reverb2属性不存在,错误代码-10877 [英] Core Audio (iOS 5.1) Reverb2 properties do not exist, error code -10877
问题描述
我正在玩Apple的示例项目LoadPresetDemo。我已将混响音频单元 AudioUnit kAudioUnitSubType_Reverb2
添加到图表中,这是唯一可用的iOS混响。在CoreAudio头文件AudioUnitParameters.h中,它声明Reverb2应该响应这些参数:
I am playing with Apple's sample project "LoadPresetDemo". I have added the reverb audio unit AudioUnit kAudioUnitSubType_Reverb2
to the graph, which is the only iOS reverb available. In the CoreAudio header file "AudioUnitParameters.h", it states 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,
};
AUGraph初始化并启动后,所有内容都会编译,我听到声音。
After the AUGraph has been initialized and started, everything compiles, I hear sound.
接下来,我改变了kReverb2Param_DryWetMix参数(改为完全湿混合):
Next, I alter the kReverb2Param_DryWetMix parameter (changing to full wet mix):
AudioUnitSetParameter(_reverbUnit, kAudioUnitScope_Global, 0, kReverb2Param_DryWetMix, 100.0f, 0);
一切都很好,我听到完全湿混合混响的声音。
All good, I hear sound with full wet mixed reverb.
现在听到的是我遇到问题的地方。当尝试更改 kReverb2Param_DryWetMix
以外的任何参数时,我收到错误代码 -10877
。似乎头文件中列出的这些其他参数实际上并不存在。
Now hear is where I run into issues. When trying to alter any parameter other than kReverb2Param_DryWetMix
I get error code -10877
. It seems as if these other parameters listed in the header file do not actually exist.
例如,调用
AudioUnitSetParameter(_reverbUnit, kAudioUnitScope_Global, 0, kReverb2Param_DecayTimeAtNyquist, 20.0f, 0)
抛出 -10877
错误。
这是一个错误吗?我是否省略了任何音频框架?我没有导入特定的音频标题吗?
Is this a bug? Have I omitted any audio frameworks? Have I not imported specific audio headers?
包括的当前音频框架是AVFoundation和AudioToolbox。
当前的音频输入是
The current audio frameworks included are AVFoundation and AudioToolbox. The current audio imports are
#import <AudioToolbox/AudioToolbox.h>
#import <AVFoundation/AVFoundation.h>
#import <CoreAudio/CoreAudioTypes.h>
我已经搜索谷歌没有解决方案。我知道当Google路由失败时我遇到了问题。任何帮助将不胜感激。
I have scoured google with no solution. I know I have problems when the Google route fails. Any help would be greatly appreciated.
注意:我使用模拟器和iPhone 4S设备进行了测试,同样的问题。
Note: I tested with simulator and iPhone 4S device, same problem.
更新:我试过了
AudioUnitGetParameter(_reverbUnit, kReverb2Param_DecayTimeAtNyquist, kAudioUnitScope_Global, 0, &value)
并返回值 0.500000
,这意味着该财产确实存在。那么我在设置值时做错了什么?
and it returns a value of 0.500000
, which means the property does exist. So what am I doing wrong in setting the value?
推荐答案
Doh!我意识到我在 AudioUnitSetParameter
与 AudioUnitSetProperty
混淆,包括他们的参数。男人,微妙但邪恶。
Doh! I realize that I was confusing AudioUnitSetParameter
with AudioUnitSetProperty
, including their parameters. Man, subtle but evil.
这篇关于Core Audio(iOS 5.1)Reverb2属性不存在,错误代码-10877的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!