Use multiple IO audio devices for speech processing in iOS

I am working on a VOIP project on iOS. As suggested by Apple, I am using VoiceProcessingIO audio component to get echo cancellation support.

Since my application needs separate operations on the sides of rendering and capture (for example, turning off the speaker, but continuing the microphone), so I create two audio devices, one of which disables the capture port, and the other disables the port port.

The current code works well until I find out how echo cancellation works: for this you need to compare the signals from both the microphone and the speaker. So I worry: is it safe to use two audio devices for speech processing, for example, my approach? In addition, since sound cancellation works mainly on the capture side, is it possible to use the RemoteIO audio device for playback (connecting to the speaker)?

I am not 100% sure, as I just enter this area for a short time. I also tried on developer.apple.com, but all the examples I found on developer.apple.com usually use only one audio setup.

Can anyone give any hints? Can my approach affect the functions of the VoiceProcessingIO module?

Thanks Fuzhou

+5
source share
1

-, VoiceProcessingIO ( , ) , . , , . , , , VOIP . , .

"shutdown speaker". :

OSStatus output_callback(
    void *inRefCon,
    AudioUnitRenderActionFlags  *ioActionFlags,
    const AudioTimeStamp        *inTimeStamp,
    UInt32                      inInputBusNumber,
    UInt32                      inNumberFrames,
    AudioBufferList             *ioData)
{
  my_context_t *context = inRefCon;
  audio_sample_t *dst = (audio_sample_t *)ioData->mBuffers[0].mData;

  if (context->muted) {
    memset(dst, 0, inNumberFrames * sizeof(audio_sample_t));
  } else {
    get_output_samples(context, dst, inNumberFrames);
  }
  return noErr;
}

.

+1

All Articles