home *** CD-ROM | disk | FTP | other *** search
/ PC World 2006 October / PCWorld_2006-10_cd.bin / audio-video / reaper / reaper105-install.exe / Effects / Delay / delay_varlen < prev    next >
Text File  |  2005-06-24  |  1KB  |  48 lines

  1. // This effect Copyright (C) 2004 and later Cockos Incorporated
  2. // License: GPL - http://www.gnu.org/licenses/gpl.html
  3. desc: variable length delay
  4. slider1:300<0,4000,20>delay (ms)
  5. slider2:-6<-120,6,1>upd wet (dB)
  6. slider3:-6<-120,6,1>upd dry (dB)
  7. slider4:-6<-120,6,1>out wet (dB)
  8. slider5:-6<-120,6,1>out dry (dB)
  9. slider6:1<0.001,30,0.1>period (seconds)
  10. slider7:0.3<0.001,1.0,0.01>amplitude (ratio)
  11.  
  12. @init
  13. delaypos=0;
  14.  
  15. @slider
  16. odelay=delaylen;
  17. delaylen=min(slider1 * srate / 1000,500000);
  18. odelay != delaylen ? freembuf(delaylen*2);
  19.  
  20. wetmix = 2 ^ (slider2/6);
  21. drymix = 2 ^ (slider3/6);
  22. wetmix2 = 2 ^ (slider4/6);
  23. drymix2 = 2 ^ (slider5/6);
  24. dppossc = $pi/(slider6 * srate);
  25. dpbacksc = min(max(slider7,0),1)*delaylen*0.5 - 1;
  26.  
  27.  
  28. @sample
  29.  
  30. dppos = dppos+dppossc;
  31. dpback = (sin(dppos)+1)*dpbacksc;
  32. dpint = delaypos-dpback-1;
  33. dpint < 0 ? dpint += delaylen;
  34. dpint *= 2;
  35.  
  36. os1=dpint[0];
  37. os2=dpint[1];
  38.  
  39. dpint = delaypos*2;
  40.  
  41. dpint[0]=min(max(spl0*drymix + os1*wetmix,-4),4);
  42. dpint[1]=min(max(spl1*drymix + os2*wetmix,-4),4);
  43.  
  44. (delaypos+=1) >= delaylen ? delaypos=0;
  45.  
  46. spl0=spl0*drymix2 + os1*wetmix2;
  47. spl1=spl1*drymix2 + os2*wetmix2;
  48.