[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [sc-users] trouble with consecutive buffers
The root of the problem is this:
b = Buffer.allocConsecutive(8, s, 256, 1, { |buf, i|
b_tmp.copy(buf, 0, i*256, 256) }, 1);
This is a very common misunderstanding about completion functions for Buffer. The function must not perform the action -- it must construct the message to perform the action.
b = Buffer.allocConsecutive(8, s, 256, 1, { |buf, i|
b_tmp.copyMsg(buf, 0, i*256, 256) }, 1);
What's happening in your case is that the server is trying to copy the data before the buffer is allocated. So the b[0..7] buffers are all 0.
a = { VOsc.ar(SinOsc.kr(0.5, 0, 3.4, 3.5), [400], 0,
0.2) }.play;
The synthdef assumes that the consecutive buffers are numbered 0-7, but if you inspect the contents of the b array, you will see that the buffer indices are something else (1-8).
If you are allocating Buffer objects, you must check the object for the index.
The synthdef needs to take the actual buffer indices into account. That's a mistake in the help file which I'll fix.
a = { VOsc.ar(SinOsc.kr(0.5, 0).range(b.first.bufnum + 0.1, b.last.bufnum - 0.1), 400, 0,
0.2) }.play;
//b.query; //not ok, gives error
b is an array of Buffers, not a buffer, so of course you can't query the array. This should work though.
b.first.query;
b[3].query;
hjh
On Aug 26, 2005, at 6:28 PM, George Tourtellot wrote:
hello,
I'm having difficulty getting consectively-alloced
buffers to behave.
: H. James Harkins
: jamshark70@xxxxxxxxxxxxxxxxx
: http://www.dewdrop-world.net
.::!:.:.......:.::........:..!.::.::...:..:...:.:.:.:..:
"Come said the Muse,
Sing me a song no poet has yet chanted,
Sing me the universal." -- Whitman