I've prepared an AVPlayer and AVAssetExportSession which both use the same MTAudioProcessingTap yet I cannot get either to call the process callback. I'd appreciate some help with identifying why the callback is not being called while others are.
I am simply trying to process audio with a tap so that it increases the levels by a scale to increase the volume. I am able to add the audioMix which includes the audioTapProcessor but when I run the app it only calls the init and finalize callbacks.
What is missing which is preventing the process callback from being run?
var callbacks = MTAudioProcessingTapCallbacks(
version: kMTAudioProcessingTapCallbacksVersion_0,
clientInfo: UnsafeMutableRawPointer(Unmanaged<AnyObject>.passUnretained(self as AnyObject).toOpaque()),
init: tapInit,
finalize: tapFinalize,
prepare: tapPrepare,
unprepare: tapUnprepare,
process: tapProcess)
var tap: Unmanaged<MTAudioProcessingTap>?
let status = MTAudioProcessingTapCreate(kCFAllocatorDefault, &callbacks, kMTAudioProcessingTapCreationFlag_PostEffects, &tap)
if status != noErr {
debugPrint("Failed to create audio processing tap.")
throw BoosterExporterError.failure
}
I've published code on GitHub with the full project. Linked below.
https://github.com/brennanMKE/Boosted/blob/master/BoosterKit/BoosterPlayer.swift#L153