BufThreadDemo and BufMultiThreading: updated the helpfiles

nix
Pierre Alexandre Tremblay 5 years ago
parent 4f45f2545c
commit c1d51b3943

@ -42,8 +42,11 @@ ARGUMENT:: result
ARGUMENT:: time ARGUMENT:: time
The duration of the delay that the background thread will wait for before yielding the value to the destination buffer. The duration of the delay that the background thread will wait for before yielding the value to the destination buffer.
ARGUMENT:: doneAction ARGUMENT:: trig
An integer representing an action to be executed when the process is finished. This can be used to free the enclosing synth, etc. See link::Classes/Done:: for more detail. The trigger to start the job.
ARGUMENT:: blocking
The thread on which the job is processed.
returns::It report the approximate job progress, from 0 to 1. returns::It report the approximate job progress, from 0 to 1.
@ -64,5 +67,5 @@ c = FluidBufThreadDemo.process(s, b, 100000, action: {|x|x.get(0,{|y|y.postln});
c.cancel; c.cancel;
// if a simple call to the UGen is used, the progress can be monitored. The usual cmd-period will cancel the job by freeing the synth. // if a simple call to the UGen is used, the progress can be monitored. The usual cmd-period will cancel the job by freeing the synth.
{c = FluidBufThreadDemo.kr(b,10000, Done.freeSelf); Poll.kr(Impulse.kr(2),c);}.scope; {c = FluidBufThreadDemo.kr(b,10000); Poll.kr(Impulse.kr(2),c);}.scope;
:: ::

@ -25,7 +25,7 @@ CODE::
b=Buffer.alloc(s,1); b=Buffer.alloc(s,1);
// a simple call, where we query the destination buffer upon completion with the action message. // a simple call, where we query the destination buffer upon completion with the action message.
FluidBufThreadDemo.process(s, b, 1000, {|x|x.get(0,{|y|y.postln});}); FluidBufThreadDemo.process(s, b, 1000, action: {|x|x.get(0,{|y|y.postln});});
:: ::
What is happening: What is happening:
@ -49,7 +49,7 @@ CODE::
b=Buffer.alloc(s,1); b=Buffer.alloc(s,1);
//start a long process, capturing the instance of the process //start a long process, capturing the instance of the process
c = FluidBufThreadDemo.process(s, b, 100000, {|x|x.get(0,{|y|y.postln});}); c = FluidBufThreadDemo.process(s, b, 100000, action: {|x|x.get(0,{|y|y.postln});});
//cancel the job. Look at the Post Window //cancel the job. Look at the Post Window
c.cancel; c.cancel;
@ -61,7 +61,7 @@ section:: .kr Usage
CODE:: CODE::
// if a simple call to the UGen is used, the progress can be monitored // if a simple call to the UGen is used, the progress can be monitored
{FluidBufThreadDemo.kr(b,10000, Done.freeSelf);}.scope; {FluidBufThreadDemo.kr(b,10000);}.scope;
//or polled within a synth //or polled within a synth
a = {FluidBufThreadDemo.kr(b,3000).poll}.play; a = {FluidBufThreadDemo.kr(b,3000).poll}.play;
@ -112,7 +112,7 @@ CODE::
b=Buffer.alloc(s,1); b=Buffer.alloc(s,1);
//start a long job //start a long job
a = {FluidBufThreadDemo.kr(b,10000,doneAction: 2).poll}.play; a = {FluidBufThreadDemo.kr(b,10000).poll}.play;
// set a OSC receiver function // set a OSC receiver function
( (
@ -143,7 +143,7 @@ You can compare these behaviours here. The blocking will run slightly faster tha
Routine{ Routine{
var startTime = Main.elapsedTime; var startTime = Main.elapsedTime;
100.do{|x,i| 100.do{|x,i|
FluidBufThreadDemo.process(s,b,10); FluidBufThreadDemo.process(s,b,10).wait;
}; };
"Threaded Processes 100 iterations in % seconds.\n".postf((Main.elapsedTime - startTime).round(0.01)); "Threaded Processes 100 iterations in % seconds.\n".postf((Main.elapsedTime - startTime).round(0.01));
}.play; }.play;
@ -154,7 +154,7 @@ Routine{
Routine{ Routine{
var startTime = Main.elapsedTime; var startTime = Main.elapsedTime;
100.do{|x,i| 100.do{|x,i|
FluidBufThreadDemo.processBlocking(s,b,10); FluidBufThreadDemo.processBlocking(s,b,10).wait;
}; };
"Blocking Processes 100 iterations in % seconds.\n".postf((Main.elapsedTime - startTime).round(0.01)); "Blocking Processes 100 iterations in % seconds.\n".postf((Main.elapsedTime - startTime).round(0.01));
}.play; }.play;

Loading…
Cancel
Save