渲染回调函数和输入回调函数有什么区别?

6

虽然我在互联网上搜索了,但仍然找不到我的问题的答案。 我发现有两种回调函数,并且根据音频单元属性的描述,一种称为输入回调函数,另一种称为渲染回调函数。

@constant       kAudioOutputUnitProperty_SetInputCallback
@discussion         Scope: Global
                    Value Type: AURenderCallbackStruct
                    Access: read/write


@constant       kAudioUnitProperty_SetRenderCallback
                    Scope:          Input
                    Value Type:     AURenderCallbackStruct
                    Access:         Write

我不知道这两者之间有什么区别,以及在何时或何种情况下应该选择其中的每一个。如果有人了解,请帮助我。

也许这不是一个困难的问题,但我已经几天解决不了。非常感谢。

2个回答

5

kAudioOutputUnitProperty_SetInputCallback被用于麦克风输入数据时,它允许您决定如何处理这些数据。在此回调中,您可以编写要将数据放置在哪里。

kAudioUnitProperty_SetRenderCallback,通常会使用术语“pull”。当扬声器需要更多数据以输出到扬声器时,就会使用它。因此,在该回调中,它会拉入您提供的音频数据。


1

我在苹果网站上找到了这段引述。

//Note: Some old V1 examples may use
//"kAudioUnitProperty_SetInputCallback" which existed in
//the old API, instead of "kAudioUnitProperty_SetRenderCallback".
//"kAudioUnitProperty_SetRenderCallback" should
//be used from now on.

更多细节请参考: https://developer.apple.com/library/content/technotes/tn2097/_index.html


1
问题是关于 kAudioOutputUnitProperty_SetInputCallback,而不是 kAudioUnitProperty_SetInputCallback - Maxim Pavlov

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接