具有 AudioRenderCallback 和 AudioUnitRenderFlag 的复调音乐
我正在了解核心音频/音频单元,所以如果这是不言而喻的,请原谅我。
如果我想允许五个声音,那么如果我想要 5 种不同的声音,我需要混音器上的 5 个总线和至少 5 个缓冲区。我已经找到了通过检查时间并使用开始时间来安排笔记的基本方法。我认为我应该使用 ioActionFlags 来指示何时呈现静音,但我不太明白如何操作。
我问这个问题是因为,有两辆巴士,当其中一辆安静一段时间而另一辆在播放时,我会感到嗡嗡声。
I am getting my bearings in core audio / audio units, so please forgive me if this should be self evident.
If i want to allow for five voices, I need 5 buses on the mixer and at least 5 buffers if i want 5 different sounds. I have figured out a basic way to schedule a note by checking the time and using a start time. I think i should use ioActionFlags to indicate when I am rendering silence, but I don't quite get how.
I ask because, with 2 buses, I get buzzing when one is silent for a while but the other one plays.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果您听到嗡嗡声,这可能是所谓的“撒旦锯”,这是一种由未清理的缓冲区在通道中一遍又一遍地播放而产生的锯齿状噪音。以这种方式重复的除静音之外的任何声音听起来都有点像锯齿波。
当您渲染静音时,您只需将给定语音的输出缓冲区中的所有样本清除为
0.0f
即可。我认为没有办法阻止回调尝试获取样本,无论如何,这是比摆弄系统渲染设置更容易(也更便携)的解决方案。If you are getting buzzing, it is probably what is known as the "satan saw", which is a sawtooth-sounding noise created by an uncleared buffer playing over and over again out of a channel. Any sound other than silence repeated in this manner will sound a bit like a sawtooth wave.
When you are rendering silence, you should simply clear out all of the samples in your output buffer to
0.0f
for the given voice. I don't think that there is a way to stop the callback from trying to fetch your samples, and anyways, this is a much easier (and more portable) solution than fiddling around with the system's rendering setup.