desc:A/B two mono channels
//tags: utility processing routing
//author: Tale

// Copyright (C) 2011-2017 Theo Niessink
// License: LGPL - http://www.gnu.org/licenses/lgpl.html

// In "normal" mode this effect lets you switch between two mono input
// channels. In "diff" mode it will output the difference between the two
// channels. In both modes it will send the output signal to both the left
// and right channels (i.e. its output is "dual mono").

slider1:0<0,1,1{A,B}>Channel
slider2:0<0,1,1{Normal,Diff}>Mode

in_pin:A
in_pin:B

out_pin:Mono
out_pin:Mono

import rc_filter.jsfx-inc

@init

ch.a = mode.rc_sett(0.0075);

@slider

ch = slider1 >= 0.5;
mode = slider2 >= 0.5;

@sample

ch.rc_lp(ch);
mode.rc_lp(mode);

spl0 = spl1 = (1 - mode.lp) * ((1 - ch.lp) * spl0 + ch.lp * spl1) + mode.lp * ((1 - ch.lp) * (spl0 - spl1) + ch.lp * (spl1 - spl0));
