DataSetWr - corrected the help, with examples pointing at the 3 unexpected behaviours.

nix
Pierre Alexandre Tremblay 5 years ago
parent fbd6dd7154
commit ed86083b99

@ -6,10 +6,10 @@ related:: Classes/FLuidDataSet
DESCRIPTION:: DESCRIPTION::
A UGen that adds labelled points to a link::Classes/FluidDataSet:: Internally, this calls code::setPoint::, so IDs that already exist will be overwritten, and new IDs will be added. The actual work is done on the server's command queue, rather than the real-thread. A UGen that adds labelled points to a link::Classes/FluidDataSet:: Internally, this calls code::setPoint::, so IDs that already exist will be overwritten, and new IDs will be added. The actual work is done on the server's command queue, rather than the real-thread.
By default the object generates a numerical index that gets used for the point labels. This index starts counting from link::#offset#labelOffset:: and increments each time the Ugen is re-triggered with a zero to non-zero transition. The label is then concatenated with the code::idPrefix:: symbol, which is fixed at instantiation. In this way, one can make custom, incrementing labels, e.g. By default the object takes a control input (code::idNumber::) as a numerical index that gets used for the point labels. This index is used to write each time the Ugen is re-triggered with a zero to non-zero transition. The label is then concatenated with the code::idPrefix:: symbol, which is fixed at instantiation. In this way, one can make custom, incrementing labels, e.g.
code:: code::
FluidDataSetWr.kr(~somedataset,"my_data",0,~somebuffer,trig) FluidDataSetWr.kr(~somedataset,"my_data",PulseCount.kr(trig),~somebuffer,trig)
:: ::
would add points like code::my_data0, mydata1, mydata2...:: if successively retriggered. would add points like code::my_data0, mydata1, mydata2...:: if successively retriggered.
@ -27,11 +27,11 @@ ARGUMENT:: dataset
An instance of link::Classes/FluidDataSet:: or an instance's name. An instance of link::Classes/FluidDataSet:: or an instance's name.
ARGUMENT:: idPrefix ARGUMENT:: idPrefix
A string or symbol with a prefix for generated labels A string or symbol with a prefix for generated labels.
ARGUMENT:: idNumber ARGUMENT:: idNumber
ANCHOR::offset:: ANCHOR::offset::
An integer with the offset to start labeling from. If the UGen is run in a server-side loop (i.e. repeatedly re-triggered), the generated labels will count upwards from this offset. If < 0, then no numerical index will be applied to the generated label (i.e. only the labelPrefix is used). An integer with the offset to start labeling from. If the UGen is run in a server-side loop (i.e. repeatedly re-triggered), the generated labels will count upwards from this offset. If nil, then no numerical index will be applied to the generated label (i.e. only the labelPrefix is used).
ARGUMENT:: buf ARGUMENT:: buf
The link::Classes/Buffer:: containing the data point. The link::Classes/Buffer:: containing the data point.
@ -48,11 +48,20 @@ EXAMPLES::
code:: code::
s.reboot; s.reboot;
(
~ds = FluidDataSet(s); ~ds = FluidDataSet(s);
// write a single point, no counting
(
{
var b = LocalBuf.newFrom([0,1,2,3]);
FreeSelfWhenDone.kr(FluidDataSetWr.kr(~ds,"help_data_point", idNumber: nil, buf:b));
}.play(s);
) )
//Write a 100 points whose values increase ~ds.print;
~ds.clear
//Write a 100 points as fast as possible - NOT WORKING (not getting 0, then 1 2 3 4 are the same values)
( (
~ds.clear; ~ds.clear;
OSCFunc({ OSCFunc({
@ -68,8 +77,48 @@ OSCFunc({
FluidDataSetWr.kr(~ds,idNumber:idx,buf:b,trig:trig); FluidDataSetWr.kr(~ds,idNumber:idx,buf:b,trig:trig);
SendReply.kr(idx >= n, '/datasetwrdone'); SendReply.kr(idx >= n, '/datasetwrdone');
FreeSelf.kr(idx >= n); FreeSelf.kr(idx >= n);
}.play(s,args:[n:100]); }.play(s,args:[n:100]);
) )
~ds.print;
~ds.clear
// incremental buffer writing
(
{
var buf = LocalBuf.newFrom([0,1,2,3]);
var noise = 4.collect{WhiteNoise.kr()};
var trig = Impulse.kr(2);
var count = PulseCount.kr(trig);
4.do{|i|
BufWr.kr(noise[i], buf, DC.kr(i));
};
FluidDataSetWr.kr(~ds, idNumber: count, trig: trig, buf:buf);
}.play(s);
)
//print a few times (NOT WORKING - not getting the 0)
~ds.print;
//clear before flushing the writing synth to enjoy the behaviour
~ds.clear
~ds.print;
// circular writing
(
{
var buf = LocalBuf.newFrom([0,1,2,3]);
var noise = 4.collect{WhiteNoise.kr()};
var trig = Impulse.kr(2);
var count = Stepper.kr(trig, max: 10).poll;
4.do{|i|
BufWr.kr(noise[i], buf, DC.kr(i));
};
FluidDataSetWr.kr(~ds, idNumber: count, trig: trig, buf:buf);
}.play(s);
)
~ds.print; //NOT WORKING - after one run around, sidNumber is multiplied buy 10!
~ds.clear
:: ::

Loading…
Cancel
Save