graphName CoexKill

; Define for CoexKillTM
[def kGroupBypassAU_prop 21]
[def kGroupBypassSwitches 1]

box CoexKill (aufx tmst appl) 1 1

; Xover
box XoverEQ (aufx tmst appl) 1 1
box XoverSplit split 1 3
box XoverJoin  join 5 1
box XoverEQSplit split 1 5
box XoverMix asum 2 1
box XoverEQJoin join 3 1


;Xover fade
box XoverUp   dbgn 1 1
box M2Down    dbgn 1 1
box Blendin   asum 2 1
box RampDown  parameter_multiply 0 0
box RampUp1   parameter_multiply 0 0
box RampUp2   parameter_add 0 0

; Logical Boxes
box gmco_not parameter_logical_not 0 0 


; I/O
in in
out out

; Formats
[def numChannelsIn 3]

format inputFormat ([sampleRate] [numChannelsIn] [blockSize])
format inputFormatFixedChannelCount1 ([sampleRate] 1 [blockSize])
format inputFormatFixedChannelCount5 ([sampleRate] 5 [blockSize])

; Wires
wire in CoexKill inputFormat

wire CoexKill XoverSplit inputFormat

wire (XoverSplit 0) (XoverJoin 0) inputFormatFixedChannelCount1
wire (XoverSplit 0) (XoverJoin 1) inputFormatFixedChannelCount1
wire (XoverSplit 1) (XoverJoin 2) inputFormatFixedChannelCount1
wire (XoverSplit 2) (XoverJoin 3) inputFormatFixedChannelCount1
wire (XoverSplit 2) (XoverJoin 4) inputFormatFixedChannelCount1

wire XoverJoin XoverEQ inputFormatFixedChannelCount5
wire XoverEQ XoverEQSplit inputFormatFixedChannelCount5

wire (XoverEQSplit 1) (XoverMix 0) inputFormatFixedChannelCount1
wire (XoverEQSplit 3) (XoverMix 1) inputFormatFixedChannelCount1

; Fading logic
wire (XoverMix)   		XoverUp   inputFormatFixedChannelCount1
wire (XoverEQSplit 4)	M2Down    inputFormatFixedChannelCount1

wire M2Down         (Blendin 0) inputFormatFixedChannelCount1
wire XoverUp        (Blendin 1) inputFormatFixedChannelCount1

wire (XoverEQSplit 0)  (XoverEQJoin 0) inputFormatFixedChannelCount1
wire (XoverEQSplit 2)  (XoverEQJoin 1) inputFormatFixedChannelCount1
wire Blendin           (XoverEQJoin 2) inputFormatFixedChannelCount1

wire XoverEQJoin out inputFormat

; Parameters and Properties Logic

param gmco 0 in

param mutp  90 in
param mutn -90 in

wireGraphParam gmco (gmco_not 0 input 0)


; GM Flag logic for Fading

wireGraphParam mutn    (RampDown 0 input 0)
wireGraphParam gmco    (RampDown 0 input 1)

wireGraphParam gmco    (RampUp1 0 input 0)
wireGraphParam mutp    (RampUp1 0 input 1)

wireParam (RampUp1 0 output 0) (RampUp2 0 input 0) true
wireGraphParam mutn   		   (RampUp2 0 input 1) true

wireParam (RampUp2 0 output 0)   (XoverUp 0) true
wireParam (RampDown 0 output 0)  (M2Down 0)  true


; GM Flag usage for Dynamic filter
wireParam (gmco_not 0 output 0) (CoexKill [kGroupBypassSwitches])