How to process the audio bufferList with AVAudioEngine?

I have an AVMutableAudioMix and use MTAudioProcessingTap to process the audio data.But After I pass the buffer to AVAudioEngine and to render it with renderOffline,the audio has no any effects...How can I do it? Any idea?

Here is the code for MTAudioProcessingTapProcessCallback

var callback = MTAudioProcessingTapCallbacks(version: kMTAudioProcessingTapCallbacksVersion_0, clientInfo:UnsafeMutableRawPointer(Unmanaged.passUnretained(self.engine).toOpaque()), init: tapInit, finalize: tapFinalize, prepare: tapPrepare, unprepare: tapUnprepare) { tap, numberFrames, flags, bufferListInOut, numberFramesOut, flagsOut in
       
       
      guard MTAudioProcessingTapGetSourceAudio(tap, numberFrames, bufferListInOut, flagsOut, nil, numberFramesOut) == noErr else {
        preconditionFailure()
      }
      let storage = MTAudioProcessingTapGetStorage(tap)
      let engine = Unmanaged<Engine>.fromOpaque(storage).takeUnretainedValue()
      // render the audio with effect
      engine.render(bufferPtr: bufferListInOut,numberOfFrames: numberFrames)
    }

And here is the Engine code

class Engine {
  let engine = AVAudioEngine()
   
  let player = AVAudioPlayerNode()
  let pitchEffect = AVAudioUnitTimePitch()
  let reverbEffect = AVAudioUnitReverb()
  let rateEffect = AVAudioUnitVarispeed()
  let volumeEffect = AVAudioUnitEQ()
  let format = AVAudioFormat(commonFormat: .pcmFormatFloat32, sampleRate: 44100, channels: 2, interleaved: false)!
  init() {
    engine.attach(player)
    engine.attach(pitchEffect)
    engine.attach(reverbEffect)
    engine.attach(rateEffect)
    engine.attach(volumeEffect)
     
    engine.connect(player, to: pitchEffect, format: format)
    engine.connect(pitchEffect, to: reverbEffect, format: format)
    engine.connect(reverbEffect, to: rateEffect, format: format)
    engine.connect(rateEffect, to: volumeEffect, format: format)
    engine.connect(volumeEffect, to: engine.mainMixerNode, format: format)
     
    try! engine.enableManualRenderingMode(.offline, format: format, maximumFrameCount: 4096)
     
    reverbEffect.loadFactoryPreset(AVAudioUnitReverbPreset.largeRoom2)
    reverbEffect.wetDryMix = 100
    pitchEffect.pitch = 2100
     
    try! engine.start()
    player.play()
  }
   
  func render(bufferPtr:UnsafeMutablePointer<AudioBufferList>,numberOfFrames:CMItemCount) {
    let buffer = AVAudioPCMBuffer(pcmFormat: format, frameCapacity: 4096)!
    buffer.frameLength = AVAudioFrameCount(numberOfFrames)
    buffer.mutableAudioBufferList.pointee = bufferPtr.pointee
    self.player.scheduleBuffer(buffer) {
      try! self.engine.renderOffline(AVAudioFrameCount(numberOfFrames), to: buffer)
    }
  }
}
How to process the audio bufferList with AVAudioEngine?
 
 
Q