summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobin Haberkorn <robin.haberkorn@googlemail.com>2012-06-28 21:48:59 +0200
committerRobin Haberkorn <robin.haberkorn@googlemail.com>2012-06-28 21:48:59 +0200
commit899033e19b308b7a76f8c694f178994c5918361d (patch)
treefc876af1e2c7bcd3ff73c26b750afcab710adc0b
parent44858d0385a04afb015359371527c83398b92a8f (diff)
downloaddigitale-debutanten-899033e19b308b7a76f8c694f178994c5918361d.tar.gz
fixed live-sampler for stereo sound files (well actually it's still broken but I do know about the issue now)
-rw-r--r--lib/LiSaX.ck9
-rw-r--r--live_sampler.ck9
2 files changed, 15 insertions, 3 deletions
diff --git a/lib/LiSaX.ck b/lib/LiSaX.ck
index 7881c78..63627c9 100644
--- a/lib/LiSaX.ck
+++ b/lib/LiSaX.ck
@@ -8,9 +8,16 @@ public class LiSaX extends LiSa {
SndBuf buf;
file => buf.read;
+ /* buf.samples() returns number of frames (or samples in one channel) */
buf.samples()::samp => duration;
for (0 => int i; i < buf.samples(); i++)
- valueAt(i => buf.valueAt, i::samp);
+ /*
+ * Only get the first channel's data.
+ * Still broken for stereo files probably because a
+ * ChucK bug prevents buf.valueAt(i) to work for
+ * i > buf.samples()
+ */
+ valueAt(i * buf.channels() => buf.valueAt, i::samp);
}
}
diff --git a/live_sampler.ck b/live_sampler.ck
index 74fda43..b75bfe7 100644
--- a/live_sampler.ck
+++ b/live_sampler.ck
@@ -3,11 +3,16 @@
*/
LiSaX lisa[7];
+/* stock samples */
+"samples/stier_loop.wav" => lisa[0].read;
+
for (0 => int i; i < lisa.cap(); i++) {
- 10::second => lisa[i].duration;
+ if (lisa[i].duration() == 0::samp)
+ 10::second => lisa[i].duration;
+ lisa[i].duration() => lisa[i].loopEnd;
lisa[i].duration() => lisa[i].loopEndRec;
+ 0 => lisa[i].loop;
}
-"samples/stier_loop.wav" => lisa[0].read;
for (0 => int i; i < lisa.cap(); i++) {
Bus.channels[0] => lisa[i] => Bus.out_left;