Disable input/output AGC from RemoteIO and VPIO on iOS

CoreAudio is always a mystery due to lack of documentations. Recently I hit some stone again:

--- edited to provide more clarification ---

In my program, I invoke a RemoteIO first, then destroyed it, use another VoiceProcessingIO (VPIO) I created. I set AGC off using the follwing code:

if (desc.componentSubType == kAudioUnitSubType_VoiceProcessingIO) {
    UInt32 turnOff = 0;
    status = AudioUnitSetProperty(_myAudioUnit,
    NSAssert1(status == noErr, @"Error setting AGC status: %d", (int)status);

First of all, not sure if this disables the AGC on the microphone side or the speaker side, but anyways, let's continue.

in between the RemoteIO and VPIO usage, there's AVAudioSession adjustments to switch between playback only and playAndRecord etc.

So ever since the uesage of VPIO, when I log what's recorded on the microphone, the singal behaves like it has been heavily porcessed by an AGC, i.e. loud and sometimes pops. This caused the later analysis algorithms to fail.

Wonder if it's some kind of AudioUnit bug, or there's ways to get away from these? Thanks!

1 answer