blob: 8ce2d6b8474526745457c0a0f30a60581f76ee38 (
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
|
/*
* Version of LiSa that supports reading in files (like a SndBuf)
*/
public class LiSaX extends LiSa {
fun void
read(string file)
{
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++)
/*
* BUG WORKAROUND
* 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);
}
}
|