// (C) 2007, Michael Gruhn.

// NO WARRANTY IS GRANTED. THIS PLUG-IN IS PROVIDED ON AN "AS IS" BASIS, WITHOUT
// WARRANTY OF ANY KIND. NO LIABILITY IS GRANTED, INCLUDING, BUT NOT LIMITED TO,
// ANY DIRECT OR INDIRECT,  SPECIAL,  INCIDENTAL OR CONSEQUENTIAL DAMAGE ARISING
// OUT OF  THE  USE  OR INABILITY  TO  USE  THIS PLUG-IN,  COMPUTER FAILTURE  OF
// MALFUNCTION INCLUDED.  THE USE OF THE SOURCE CODE,  EITHER  PARTIALLY  OR  IN
// TOTAL, IS ONLY GRANTED,  IF USED IN THE SENSE OF THE AUTHOR'S INTENTION,  AND
// USED WITH ACKNOWLEDGEMENT OF THE AUTHOR. FURTHERMORE IS THIS PLUG-IN A  THIRD
// PARTY CONTRIBUTION,  EVEN IF INCLUDED IN REAPER(TM),  COCKOS INCORPORATED  OR
// ITS AFFILIATES HAVE NOTHING TO DO WITH IT.  LAST BUT NOT LEAST, BY USING THIS
// PLUG-IN YOU RELINQUISH YOUR CLAIM TO SUE IT'S AUTHOR, AS WELL AS THE CLAIM TO
// ENTRUST SOMEBODY ELSE WITH DOING SO.

desc:Stereo Upmix 
desc:Stereo Upmix (Left->Stereo)
//tags: processing stereo
//author: LOSER

slider1:125<0,250,.1>Delay (ms)

in_pin:input
out_pin:left output
out_pin:right output

@init
b=0;
@slider
tmp=bs;
bs=floor( min(slider1*srate/1000 , 500000) );
tmp < bs ? freembuf(bs*2+1);
@sample
b[0]=spl0;
(b+=1) >= (bs) ? b=0;

spl0_ = (spl0*2 + b[0])/2;
spl1_ = (spl0*2 - b[0])/2;

spl0 = (spl0_ + spl1_/2)/1.5;
spl1 = (spl1_ + spl0_/2)/1.5;

