我需要在我的mac应用程序中实现音频录制功能。我正在使用Apple示例
http://developer.apple.com/library/mac/samplecode/AudioDataOutputToAudioUnit/清单/main_m.html。一切都很好。唯一的问题是创建的音频文件在播放时有回声。请帮助!后来我查了一下,苹果样品也有同样的问题
从示例代码的描述:
从CaptureSessionController.m:构建的应用程序使用QTCaptureSession和QTCaptureDecompressedAudioOutput从默认的系统输入设备捕获音频,使用简单的效果AudioUnit对该音频应用效果,并使用CoreAudio ExtAudioFile API将修改后的音频写入文件。
/* Create an effect audio unit to add an effect to the audio before it is written to a file. */
OSStatus err = noErr;
AudioComponentDescription effectAudioUnitComponentDescription;
effectAudioUnitComponentDescription.componentType = kAudioUnitType_Effect;
effectAudioUnitComponentDescription.componentSubType = kAudioUnitSubType_Delay;
看起来这个延迟是故意的,作为演示的一部分。
我自己找到了答案。只需要注释
effectAudioUnitComponentDescription.componentSubType = kAudioUnitSubType_Delay;
从CaptureSessionController.m: