1 <!DOCTYPE html PUBLIC
"-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
4 <meta http-equiv=
"Content-Type" content=
"text/html; charset=UTF-8">
5 <meta http-equiv=
"Content-Style-Type" content=
"text/css">
7 <meta name=
"Generator" content=
"Cocoa HTML Writer">
8 <meta name=
"CocoaVersion" content=
"824.47">
9 <style type=
"text/css">
10 p
.p1
{margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica
}
11 p
.p2
{margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco
; min-height: 12.0px}
12 p
.p3
{margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica
; min-height: 14.0px}
13 p
.p4
{margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco
; color: #79331d}
14 p
.p5
{margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco
; color: #606060}
15 p
.p6
{margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco
}
16 span
.s1
{font: 18.0px Helvetica
}
17 span
.s2
{font: 9.0px Monaco
}
18 span
.s3
{color: #000000}
19 span
.s4
{color: #0f2caa}
20 span
.Apple-tab-span
{white-space:pre
}
24 <p class=
"p1"><span class=
"s1"><b>BufSamples
</b></span><span class=
"s2"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></span><b>current number of samples allocated in the buffer
</b></p>
25 <p class=
"p2"><br></p>
26 <p class=
"p1">superclass: BufInfoUGenBase
</p>
27 <p class=
"p3"><br></p>
28 <p class=
"p1">Returns the current number of allocated samples. A sample is not the same as a frame (compare with BufFrames); a frame includes the samples in each channel of the buffer. Only for a mono buffer are samples the same as frames.
<span class=
"Apple-converted-space"> </span></p>
29 <p class=
"p1">samples = frames * numChannels
</p>
30 <p class=
"p3"><br></p>
31 <p class=
"p1"><b><span class=
"Apple-tab-span"> </span>*kr(bufnum)
</b></p>
32 <p class=
"p1"><b><span class=
"Apple-tab-span"> </span>*ir(bufnum)
</b></p>
33 <p class=
"p1"><b><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></b>the .ir method is not the safest choice. Since a buffer can be reallocated at any time,
</p>
34 <p class=
"p1"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>using .ir will not track the changes.
</p>
35 <p class=
"p3"><br></p>
36 <p class=
"p2"><span class=
"Apple-tab-span"> </span></p>
37 <p class=
"p4">// example; this buffer is mono, so the number of samples matches the number of frames
</p>
38 <p class=
"p5"><span class=
"s3">s.sendMsg(
</span>"/b_allocRead"<span class=
"s3">,
0,
</span>"sounds/a11wlk01.wav"<span class=
"s3">);
</span></p>
39 <p class=
"p2"><br></p>
40 <p class=
"p2"><br></p>
41 <p class=
"p4">// indexing with a phasor
</p>
42 <p class=
"p6">{
<span class=
"s4">BufRd
</span>.ar(
1,
0,
<span class=
"s4">Phasor
</span>.ar(
0,
<span class=
"s4">BufRateScale
</span>.kr(
0),
0,
<span class=
"s4">BufSamples
</span>.kr(
0))) }.play;
</p>
43 <p class=
"p2"><br></p>
44 <p class=
"p2"><br></p>
45 <p class=
"p4">// indexing by hand
</p>
46 <p class=
"p6">{
<span class=
"s4">BufRd
</span>.ar(
1,
0,
<span class=
"s4">K2A
</span>.ar(
<span class=
"s4">MouseX
</span>.kr(
0,
<span class=
"s4">BufSamples
</span>.kr(
0)))) }.play;
</p>