How to accomplish audio effect processing with AUGraph and AudioUnit on iOS

First of all, we used an AudioUnit(SubTypeVoiceProcessingIO) to record the sound captured by device's microphone(iPhone or iPad). The problem is that when we spoke loudly and got too close to the microphone, due to the build-in AGC, the volume of the sound would decrease very quickly. And if we turned off the build-in AGC, the sound would crack. We just want the volume to be normal and stable. But we had not found any way to change the parameter of the build-in AGC. This is troubling us for a long time because there is no such phenomenon on Android device.

Then we discover that we can use AUGraph to accomplish audio effect processing and maybe solve this problem. So we tried this way. Due to the specific format required by DynamicsProcessor(an AudioUnit subType, belong to the main type of kAudioUnitType
Effect), we use an AudioUnit(SubTypeVoiceProcessingIO) for sound recording, two AudioUnits(SubTypeAUConverter) for format convertion, an AudioUnit(SubTypeDynamicsProcessor) for volume control. At last, we use AUGraph to connect all these AudioUnits.

The data flows like this:
AudioUnit instance1(VoiceProcessingIO) -> AudioUnit instance2(AUConverter) -> AudioUnit instance3(DynamicsProcessor) -> AudioUnit instance4(AUConverter).
But the result is that we could not get the data processed by the AudioUnit instance4(AUConverter) through its callback function, the function was never called.

Here are some questions
  1. Are there any easier ways to solve this problem ?

  2. How to get the data processed by the last AudioUnit instance4(AUConverter) ? We need to write the data into a localFile for analysis.

  3. Are there some implicit things that we should know about kAudioUnitSubType

AUConverter or kAudioUnitType_FormatConverter ?
How to accomplish audio effect processing with AUGraph and AudioUnit on iOS
 
 
Q