Reputation: 3327
Lets say I use a moog filter for lowpass like the following, but also wat to switch mode to some highpass filter, too.
class FilterSection: AKNode, AKInput {
...
init(_ input: AKNode) {
output = AKOperationEffect(input) { input, parameters in
return input.moogLadderFilter(
cutoffFrequency: parameters[0],
resonance: parameters[1]
)
}
super.init()
self.initFilterParameters()
output.parameters = parameters
self.avAudioNode = output.avAudioNode
}
...
}
How could I add the feature to switch between this and another filter type within the same class?
Is it possible, or do I have to use some construct like
filterSection1 = FilterSection1(generators)
filterSection2 = FilterSection2(filterSection1)
filterSection1.output.start()
filterSection2.output.stop()
and the switch between types like
filterSection1.output.stop()
filterSection2.output.start()
which I want to avoid? thnx!
Upvotes: 1
Views: 124
Reputation: 4573
You can't switch filter types, but you can run them in parallel, mix them, and then change the mix from one to the other, with the added benefit of being able to blend or morph between the two.
Upvotes: 2