In my effect plugin, I have one instrument perpetually running that continually receives an external audio stream and applies however many effects I wish. However, toggling effects makes clicks and I would like to get rid of that. I initially looked into setting up an ADSR envelope, but since the instrument is always running, it only applies the envelope once at the beginning of the runtime.
I’m not sure how to change the instrument from a perpetual to a triggerable one to have the option of using envelopes. I would like to have the option of either having clean audio, one effect, or multiple chained effects. The way I have the instrument working is below:
instr effect
a1 inch 1
a2 inch 2
if kEffect1 == 1 then
; a1 & a2 are manipulated
endif
if kEffect2 == 1 then
; a1 & a2 are manipulated
endif
if kEffect3 == 1 then
; a1 & a2 are manipulated
endif
if kEffect4 == 1 then
; a1 & a2 are manipulated
endif
outs a1, a2
endin
how do I fix this to keep my effect chaining and remove the clicking? If I need to make a triggerable instrument for each effect, how do I chain the effects to the same a-rate?