-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathreverse.jsfx
More file actions
43 lines (33 loc) · 941 Bytes
/
reverse.jsfx
File metadata and controls
43 lines (33 loc) · 941 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
desc:G: Reverse
slider1:0<0,30000,1>Length (ms)
slider2:0<-120,6,1>Wet Mix (dB)
slider3:-120<-120,6,1>Dry Mix (dB)
slider4:0<0,1>Edge Overlap
slider5:0<0,1,1{Off,On}>Old Compatible And Clicky Mode
in_pin:left input
in_pin:right input
out_pin:left output
out_pin:right output
@init
pos=0;
@slider
len = srate * slider1 * 2 / 1000;
wet = 2 ^ (slider2 / 6);
dry = 2 ^ (slider3 / 6);
nonclickymode = slider5 != 1;
fadelen = len * min(slider4, nonclickymode ? 0.5 : 1.0 ) * 0.5;
freembuf(len * 2);
@sample
s0 = ((len - pos) * 2)[0];
s1 = ((len - pos) * 2)[1];
(pos * 2)[0] = spl0;
(pos * 2)[1] = spl1;
pp = len - pos;
w2 = pp < fadelen ? pp/fadelen : (pp > len - fadelen ? (len - pp) / fadelen : 1);
nonclickymode && w2 == 1 ? (
pp = abs(len * 0.5 - pos);
w2 = pp < fadelen ? pp / fadelen : 1;
);
spl0 = s0 * wet * w2 + spl0 * (dry + 1 - w2);
spl1 = s1 * wet * w2 + spl1 * (dry + 1 - w2);
(pos += 1) >= len ? pos = 0;