blob: 34fa77b124ba19df352bb717ccd449095cb3970f (
plain)
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
|
import java.lang.reflect.Method;
import com.cycling74.max.*;
import com.cycling74.msp.*;
public class panner extends MSPObject {
float left = 1, right = 1;
public panner() {
declareInlets( new int[] { SIGNAL, DataTypes.ANYTHING } );
declareOutlets( new int[] { SIGNAL, SIGNAL } );
}
/**
* From 0..127
*/
public void inlet(float val) {
if ( val > 64 ) {
right = 1;
left = ((127-val) / 64);
} else {
left = 1;
right = val / 64;
}
}
public Method dsp(MSPSignal[] ins, MSPSignal[] outs) {
return getPerformMethod("perform");
}
public void perform(MSPSignal[] ins, MSPSignal[] outs) {
for (int i=0;i<ins[0].n;i++) {
outs[0].vec[i] = ins[0].vec[i] * left;
outs[1].vec[i] = ins[0].vec[i] * right;
}
}
}
|