我正在建立一个新的对讲机应用程序,我想从麦克风获取数据我使用这个项目AurioTouch
我在ioData中找到了麦克风捕获的音频数据
可以将* ioData:UnsafeMutablePointer <AudioBufferList> *转换为NSData并通过WebSocket发送它
// Render callback function
func performRender(_ ioActionFlags: UnsafeMutablePointer<AudioUnitRenderActionFlags>,
inTimeStamp: UnsafePointer<AudioTimeStamp>,
inBufNumber: UInt32,
inNumberFrames: UInt32,
ioData: UnsafeMutablePointer<AudioBufferList>) -> OSStatus
{
// we are calling AudioUnitRender on the input bus of AURemoteIO
// this will store the audio data captured by the microphone in ioData
let err: OSStatus = AudioUnitRender(_rioUnit!, ioActionFlags, inTimeStamp, 1, inNumberFrames, ioData)
return err;
}