我正在尝试实现类似于长笛的东西,当你吹麦克风时,它将开始播放扬声器中的一个音符。出于这个原因,我试图使用VoiceProcessingIO
从输入麦克风中减去重放的音符(输出音箱)。
出于某种原因,我注意到VoiceProcessingIO
与AUSampler
无法一起使用。我修改了Apple Sampled“ LoadPresetDemo ”,只是更改了行:
cd.componentSubType = kAudioUnitSubType_RemoteIO
与
cd.componentSubType = kAudioUnitSubType_VoiceProcessingIO;
然后你听不到任何播放
当我使用下面的audiounits方案时,我有同样的效果(没有声音):
VoiceProcessingIO (input mic) --> processing function (if audio level > thrs
then feed MusicDeviceMIDIEvent)
AUSampler --> VoiceProcessingIO (output speaker)
但是当我使用下面的方案时:
VoiceProcessingIO (input mic) --> processing function (if audio level > thrs
then feed MusicDeviceMIDIEvent)
AUSampler --> RemoteIO (output speaker)
输出扬声器音量大大降低。问题它的接缝与此有关: Is it safe to use two audio units for simultaneous I/O in iOS?
我也从这里测试了例子: https://code.google.com/p/ios-coreaudio-example/downloads/detail?name=Aruts.zip&can=2&q=
如果没有AUSampler,它可以使用以下方案:
VoiceProcessingIO (input mic) --> processing function --> VoiceProcessingIO (output speaker)
问题是:
有没有办法VoiceProcessingIO
和AUSampler
一起使用?或者是提供一些数据的唯一方法
VoiceProcessing
通过渲染回调输出?