开发者

Polyphony with AudioRenderCallback and AudioUnitRenderFlag

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 le开发者_运维技巧ast 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.


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜