AKAudioUnitManager

open class AKAudioUnitManager : NSObject

Audio Unit Manager

  • The notifications this class may generate

    See more

    Declaration

    Swift

    public enum Notification
  • Internal audio units not including the Apple ones, only the custom ones

    Declaration

    Swift

    public private(set) var internalAudioUnits: [String]
  • Callback definitions

    Declaration

    Swift

    public typealias AKComponentListCallback = ([AVAudioUnitComponent]) -> Void
  • Declaration

    Swift

    public typealias AKEffectCallback = (AVAudioUnit?) -> Void
  • Declaration

    Swift

    public typealias AKInstrumentCallback = (AVAudioUnitMIDIInstrument?) -> Void
  • Delegate that will be sent notifications

    Declaration

    Swift

    open weak var delegate: AKAudioUnitManagerDelegate?
  • first node in chain, generally a player or instrument

    Declaration

    Swift

    open var input: AKNode?
  • last node in chain, generally a mixer or some kind of output

    Declaration

    Swift

    open var output: AKNode?
  • Effects Chain

    Declaration

    Swift

    public var effectsChain: [AVAudioUnit?] { get set }
  • How many effects are active

    Declaration

    Swift

    public var effectsCount: Int { get }
  • availableEffects is accessed from multiple thread contexts. Use a dispatch queue for synchronization.

    Declaration

    Swift

    public var availableEffects: [AVAudioUnitComponent] { get set }
  • availableEffects is accessed from multiple thread contexts. Use a dispatch queue for synchronization.

    Declaration

    Swift

    public var availableInstruments: [AVAudioUnitComponent] { get set }
  • Initialize the manager with arbritary amount of inserts

    Declaration

    Swift

    public convenience init(inserts: Int)
  • Initialize the manager

    Declaration

    Swift

    public override init()
  • request a list of Effects, will be returned async

    Declaration

    Swift

    public func requestEffects(completionHandler: AKComponentListCallback? = nil)
  • request a list of Instruments, will be returned async

    Declaration

    Swift

    public func requestInstruments(completionHandler: AKComponentListCallback? = nil)
  • Asynchronously create the AU, then call the supplied completion handler when the operation is complete.

    Declaration

    Swift

    public func createEffectAudioUnit(_ componentDescription: AudioComponentDescription,
                                      completionHandler: @escaping AKEffectCallback)
  • Asynchronously create the AU, then call the supplied completion handler when the operation is complete.

    Declaration

    Swift

    public func createInstrumentAudioUnit(_ componentDescription: AudioComponentDescription,
                                          completionHandler: @escaping AKInstrumentCallback)
  • Declaration

    Swift

    public func removeEffect(at index: Int, reconnectChain: Bool = true)
  • Create the Audio Unit at the specified index of the chain

    Declaration

    Swift

    public func insertAudioUnit(name: String, at index: Int)
  • Create an instrument with a name and a completion handler

    Declaration

    Swift

    public func createInstrument(name: String, completionHandler: ((AVAudioUnitMIDIInstrument?) -> Void)? = nil)
  • Reset all effects

    Declaration

    Swift

    open func resetEffects()
  • called from client to hook the chain together firstNode would be something like a player, and last something like a mixer that’s headed to the output.

    Declaration

    Swift

    open func connectEffects(firstNode: AKNode? = nil, lastNode: AKNode? = nil)
  • resets the processing state and clears the buffers in the AUs

    Declaration

    Swift

    public func reset()