I'm finding an example of simple play-thru application using built-in mic/speaker with kAudioUnitSubType_VoiceProcessingIO subtype(not kAudioUnitSubType_HALOutput) in macosx. The comments on the core audio api says that kAudioUnitSubType_VoiceProcessingIO is available on the desktop and with iPhone 3.0 or greater, so I think that there must be an example somewhere for macos.
Do you have any idea where the sample is? or Is there anyone who know how to use the kAudioUnitSubType_VoiceProcessingIO subtype in macos? I already tried the same way that I did in iOS, but it didn't work.
I had two different kAudioUnitProperty_StreamFormat setup based on the number of the channels.
and
with this audio stream formats when using the I/O unit as a kAudioUnitSubType_VoiceProcessingIO
I can clearly see a interruption in the audio output, as the buffer size was smaller than the one from this AudioUnit.
Switching back to the kAudioUnitSubType_RemoteIO
iOUnitDescription.componentSubType = kAudioUnitSubType_RemoteIO;
That interruption disappear.
I'm processing audio input from microphone and applying some real time calculations on the audio buffers.
In the methods the graphSampleRate is the AVSession sample rate
and maybe here I'm wrong.
At the end the configuration parameters values are the following:
The stereo stream format:
The mono stream format:
Thanks to SO post here I realized I should have used this flag:
I discovered a few things enabling this IO unit.
As with other core audio work, you just need to check the error status of every single function call, determine what the errors are and make little changes at each step until you finally get it to work.