blob: 6f418c8dc366cca99d92ff54bf481bd76d40705b (
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
|
/*
* Live (and stock) sampler based on LiSaX (LiSa)
* in-port: Bus.channels[0]
*/
LiSaX lisa[7];
Gain amp => Bus.out_left;
amp => Bus.out_right;
/* stock samples */
"samples/stier_loop.wav" => lisa[0].read;
for (0 => int i; i < lisa.cap(); i++) {
if (lisa[i].duration() == 0::samp) {
30::second => lisa[i].duration;
} else {
lisa[i].duration() => lisa[i].loopEnd;
lisa[i].duration() => lisa[i].loopEndRec;
}
0 => lisa[i].loop;
/* patch */
Bus.channels[0] => lisa[i];
lisa[i].chan(0) => amp;
}
lisa[0] @=> LiSaX @currentSample;
/*
* Sampler configuration
*/
"primary" => NanoEvent.init @=> NanoEvent @nanoev;
while (nanoev => now) {
if ("recordToggle" => nanoev.isControl) {
if (nanoev.getBool()) {
if (!currentSample.loop() ||
currentSample.loopEndRec() == 0::samp) {
currentSample.duration() => currentSample.loopEndRec;
currentSample.clear();
} else {
currentSample.loopEnd() => currentSample.loopEndRec;
}
0::samp => currentSample.recPos;
} else if (!currentSample.loopRec() ||
currentSample.loopEnd() == 0::samp) {
currentSample.recPos() => currentSample.loopEnd;
}
if (currentSample.loop()) {
nanoev.getBool() => currentSample.loopRec;
} else
nanoev.getBool() => currentSample.record;
} else if ("playButton" => nanoev.isControl) {
if (nanoev.getBool()) {
0::samp => currentSample.playPos;
1 => currentSample.play;
}
} else if ("stopButton" => nanoev.isControl) {
if (nanoev.getBool())
0 => currentSample.play;
} else if ("loopToggle" => nanoev.isControl) {
nanoev.getBool() => currentSample.loop;
} else if ("samplerVolumeKnob" => nanoev.isControl) {
nanoev.getFloat(10) => currentSample.gain;
} else if ("samplerPitchSlider" => nanoev.isControl) {
nanoev.getFloat(2) => currentSample.rate;
} else if (nanoev.CCId >= 23 && nanoev.CCId <= 29) {
/* chooseSampleButton#CCId pressed */
lisa[nanoev.CCId - 23] @=> currentSample;
}
}
|