How to divide UnsafeMutablePointer<AudioBufferList> to several segment to process

18 Views Asked by At

I'm doing some realtime audio processing using MTAudioProcessingTapProcessCallback.

let tapProcess:MTAudioProcessingTapProcessCallback = {
            tap, numberFrames, flags, bufferListInOut, numberFramesOut, flagsOut in
      let storage = MTAudioProcessingTapGetStorage(tap)
      let context = Unmanaged<MTAudioProcessorContext>.fromOpaque(storage).takeUnretainedValue()
            
      /// Do some process to bufferListInOut
      process(bufferListInOut)

      numberFramesOut.pointee = numberFrames
}

And now the numberFrames passed in is 4096 (I don't know why is 4096), and every call will process 4096 frames one time. So now I want to process only 1024 frames one time instead of 4096. How to implement that? Maybe need some way to divide bufferListInOut to severval segments.. But I don't know how to implement that.

Divide bufferListInOut to some segments to process.

0

There are 0 best solutions below