I have a music app that uses AVAudioUnitSampler
to generate sounds.
I'm trying to make an Audio Unit Extension, so my app will be able to be used in a host apps like Garage Band.
I implement AUViewController
and return underlying AVAudioUnitSampler
's audioUnit in createAudioUnit(with:)
method like this:
public class AudioUnitViewController: AUViewController, AUAudioUnitFactory
{
var sampler: AVAudioUnitSampler!
public func createAudioUnit(with componentDescription: AudioComponentDescription) throws -> AUAudioUnit
{
//...
//sampler loading code
//...
return sampler.auAudioUnit
}
}
It somehow works (compiles and works without errors), but the sound I hear in GarageBand is very much distorted.
Is there anything I could change to use AVAudioUnitSampler
as AU v3 extension?