Search code examples
iosswiftswift4audiokit

Connecting different AudioKit Effects in array


I have an array of AudioKit effect to have the flexibility to add/remove or change the order of them, storing them as AKNode

var effects : [AKNode] = []

effects.append(AKCompressor())
effects.append(AKDelay())
effects.append(AKAutoWah())
... ...

The problem is doing the connections:

effects[0].connect(to: effects[1])

It doesn't work : Cannot invoke 'connect' with an argument list of type '(to: AKNode)'

Maybe I should store other class than AKNode. What's the best way to do it ?


Solution

  • Use an array of AKInputs. The connection functions use the AKInput and AKOutput protocols. AKInput inherits from AKOutput so they're outputs too.