iOS 如何录制mixer unit 的输出

来源:互联网 发布:做淘宝客服需要交钱吗 编辑:程序博客网 时间:2024/05/20 04:12

How to record sound produced by mixer unit output (iOS Core Audio & Audio Graph)

使用mixer unit进行混音后是无法通过

kAudioUnitProperty_SetRenderCallback, kAudioUnitScope_Input 这样的设置io unit的element0是无法回调的,当不和mixer unit相连接时,io unit的element0通过kAudioUnitProperty_SetRenderCallback, kAudioUnitScope_Input 设置是会回调的,那加入混音后 如何获取混音后的数据呢?

通过

AudioUnitAddRenderNotify接口

add the callback, try this method:

AudioUnitAddRenderNotify(mMixerUnit,recordCallbackFunc, (__bridgevoid * _Nullable)(self));

但是在回调中必须要判断ioActionFlags标志 当ioActionFlagskAudioUnitRenderAction_PostRender时才是真正的数据回调

if (*ioActionFlags == kAudioUnitRenderAction_PostRender) {    // your code}


原创粉丝点击