rsc3/doc-schelp/Help-3.12.2/Classes/Done.html

118 lines
12 KiB
HTML
Raw Normal View History

2022-08-24 13:53:18 +00:00
<!doctype html><html lang='en'><head><title>Done | SuperCollider 3.9.3 Help</title>
<link rel='stylesheet' href='./../scdoc.css' type='text/css' />
<link rel='stylesheet' href='./../frontend.css' type='text/css' />
<link rel='stylesheet' href='./../custom.css' type='text/css' />
<meta http-equiv='Content-Type' content='text/html; charset=UTF-8' />
<script>
var helpRoot = './..';
var scdoc_title = 'Done';
var scdoc_sc_version = '3.9.3';
</script>
<script src='./../scdoc.js' type='text/javascript'></script>
<script src='./../docmap.js' type='text/javascript'></script>
<script src='./../prettify.js' type='text/javascript'></script>
<script src='./../lang-sc.js' type='text/javascript'></script>
</head>
<body onload='fixTOC();prettyPrint()'>
<div id='toc'>
<div id='toctitle'>Done:</div>
<span class='toc_search'>Filter: <input id='toc_search'></span><ul class='toc'><li class='toc1'><a href='#description'>Description</a></li>
<ul class='toc'></ul><li class='toc1'><a href='#classmethods'>Class methods</a></li>
<ul class='toc'><li class='toc3'><a href='#*kr'>kr</a> </li>
<li class='toc2'><a href='#Inherited%20class%20methods'>Inherited class methods</a></li>
<li class='toc2'><a href='#Undocumented%20class%20methods'>Undocumented class methods</a></li>
<ul class='toc'><li class='toc3'><a href='#*freeAllInGroup'>freeAllInGroup</a> </li>
<li class='toc3'><a href='#*freeGroup'>freeGroup</a> </li>
<li class='toc3'><a href='#*freeSelf'>freeSelf</a> </li>
<li class='toc3'><a href='#*freeSelfAndDeepFreeNext'>freeSelfAndDeepFreeNext</a> </li>
<li class='toc3'><a href='#*freeSelfAndDeepFreePrev'>freeSelfAndDeepFreePrev</a> </li>
<li class='toc3'><a href='#*freeSelfAndFreeAllInNext'>freeSelfAndFreeAllInNext</a> </li>
<li class='toc3'><a href='#*freeSelfAndFreeAllInPrev'>freeSelfAndFreeAllInPrev</a> </li>
<li class='toc3'><a href='#*freeSelfAndNext'>freeSelfAndNext</a> </li>
<li class='toc3'><a href='#*freeSelfAndPrev'>freeSelfAndPrev</a> </li>
<li class='toc3'><a href='#*freeSelfPauseNext'>freeSelfPauseNext</a> </li>
<li class='toc3'><a href='#*freeSelfPausePrev'>freeSelfPausePrev</a> </li>
<li class='toc3'><a href='#*freeSelfToHead'>freeSelfToHead</a> </li>
<li class='toc3'><a href='#*freeSelfToTail'>freeSelfToTail</a> </li>
<li class='toc3'><a href='#*none'>none</a> </li>
<li class='toc3'><a href='#*pauseSelf'>pauseSelf</a> </li>
</ul></ul><li class='toc1'><a href='#instancemethods'>Instance methods</a></li>
<ul class='toc'><li class='toc2'><a href='#Inherited%20instance%20methods'>Inherited instance methods</a></li>
</ul><li class='toc1'><a href='#examples'>Examples</a></li>
<ul class='toc'></ul><li class='toc1'><a href='#Actions'>Actions</a></li>
<ul class='toc'></ul><li class='toc1'><a href='#Alternatives'>Alternatives</a></li>
<ul class='toc'></ul></ul></div><div class='contents'>
<div id='menubar'></div>
<div class='header'>
<div id='label'>
<span id='folder'>Classes</span>
| <span id='categories'><a href='./../Browse.html#UGens'>UGens</a>&#8201;&gt;&#8201;<a href='./../Browse.html#UGens>Synth control'>Synth control</a> | <a href='./../Browse.html#Server'>Server</a>&#8201;&gt;&#8201;<a href='./../Browse.html#Server>Nodes'>Nodes</a></span>
</div><h1>Done<span id='superclasses'> : <a href="../Classes/UGen.html">UGen</a> : <a href="../Classes/AbstractFunction.html">AbstractFunction</a> : <a href="../Classes/Object.html">Object</a></span>
</h1>
<div id='summary'>Monitors another UGen to see when it is finished</div>
</div>
<div class='subheader'>
<div id='filename'>Source: <a href='file:///Applications/SuperCollider.app/Contents/Resources/SCClassLibrary/Common/Audio/EnvGen.sc' title='/Applications/SuperCollider.app/Contents/Resources/SCClassLibrary/Common/Audio/EnvGen.sc'>EnvGen.sc</a></div><div id='related'>See also: <a href="./../Classes/UGen.html">UGen</a>, <a href="./../Classes/FreeSelfWhenDone.html">FreeSelfWhenDone</a>, <a href="./../Classes/PauseSelfWhenDone.html">PauseSelfWhenDone</a></div>
</div>
<h2><a class='anchor' name='description'>Description</a></h2>
<p>Some UGens set a 'done' flag when they are finished playing. This UGen echoes that flag when it is set to track a particular UGen.
<p>The UGens trackable by Done are:<ul>
<li><a href="./../Classes/PlayBuf.html">PlayBuf</a><li><a href="./../Classes/RecordBuf.html">RecordBuf</a><li><a href="./../Classes/Line.html">Line</a><li><a href="./../Classes/XLine.html">XLine</a><li><a href="./../Classes/EnvGen.html">EnvGen</a><li><a href="./../Classes/Linen.html">Linen</a><li><a href="./../Classes/BufRd.html">BufRd</a><li><a href="./../Classes/BufWr.html">BufWr</a><li><a href="./../Classes/Dbufrd.html">Dbufrd</a><li><a href="./../Classes/Dbufwr.html">Dbufwr</a><li><a href="./../Classes/DiskIn.html">DiskIn</a><li><a href="./../Classes/VDiskIn.html">VDiskIn</a><li><a href="./../Classes/Demand.html">Demand</a></ul>
<h2><a class='anchor' name='classmethods'>Class Methods</a></h2>
<h3 class='method-code'><span class='method-prefix'>Done.</span><a class='method-name' name='*kr' href='./../Overviews/Methods.html#kr'>kr</a>(<span class='argstr'>src</span>)</h3>
<div class='method'>
<p><h4>Arguments:</h4>
<table class='arguments'>
<tr><td class='argumentname'>src<td class='argumentdesc'>
<p>The UGen to monitor</table></div><h3><a class='anchor' name='Inherited%20class%20methods'>Inherited class methods</a></h3>
<div id='inheritedclassmets'></div><h3><a class='anchor' name='Undocumented%20class%20methods'>Undocumented class methods</a></h3>
<h3 class='method-code'><span class='method-prefix'>Done.</span><a class='method-name' name='*freeAllInGroup' href='./../Overviews/Methods.html#freeAllInGroup'>freeAllInGroup</a></h3>
<h3 class='method-code'><span class='method-prefix'>Done.</span><a class='method-name' name='*freeGroup' href='./../Overviews/Methods.html#freeGroup'>freeGroup</a></h3>
<h3 class='method-code'><span class='method-prefix'>Done.</span><a class='method-name' name='*freeSelf' href='./../Overviews/Methods.html#freeSelf'>freeSelf</a></h3>
<h3 class='method-code'><span class='method-prefix'>Done.</span><a class='method-name' name='*freeSelfAndDeepFreeNext' href='./../Overviews/Methods.html#freeSelfAndDeepFreeNext'>freeSelfAndDeepFreeNext</a></h3>
<h3 class='method-code'><span class='method-prefix'>Done.</span><a class='method-name' name='*freeSelfAndDeepFreePrev' href='./../Overviews/Methods.html#freeSelfAndDeepFreePrev'>freeSelfAndDeepFreePrev</a></h3>
<h3 class='method-code'><span class='method-prefix'>Done.</span><a class='method-name' name='*freeSelfAndFreeAllInNext' href='./../Overviews/Methods.html#freeSelfAndFreeAllInNext'>freeSelfAndFreeAllInNext</a></h3>
<h3 class='method-code'><span class='method-prefix'>Done.</span><a class='method-name' name='*freeSelfAndFreeAllInPrev' href='./../Overviews/Methods.html#freeSelfAndFreeAllInPrev'>freeSelfAndFreeAllInPrev</a></h3>
<h3 class='method-code'><span class='method-prefix'>Done.</span><a class='method-name' name='*freeSelfAndNext' href='./../Overviews/Methods.html#freeSelfAndNext'>freeSelfAndNext</a></h3>
<h3 class='method-code'><span class='method-prefix'>Done.</span><a class='method-name' name='*freeSelfAndPrev' href='./../Overviews/Methods.html#freeSelfAndPrev'>freeSelfAndPrev</a></h3>
<h3 class='method-code'><span class='method-prefix'>Done.</span><a class='method-name' name='*freeSelfPauseNext' href='./../Overviews/Methods.html#freeSelfPauseNext'>freeSelfPauseNext</a></h3>
<h3 class='method-code'><span class='method-prefix'>Done.</span><a class='method-name' name='*freeSelfPausePrev' href='./../Overviews/Methods.html#freeSelfPausePrev'>freeSelfPausePrev</a></h3>
<h3 class='method-code'><span class='method-prefix'>Done.</span><a class='method-name' name='*freeSelfToHead' href='./../Overviews/Methods.html#freeSelfToHead'>freeSelfToHead</a></h3>
<h3 class='method-code'><span class='method-prefix'>Done.</span><a class='method-name' name='*freeSelfToTail' href='./../Overviews/Methods.html#freeSelfToTail'>freeSelfToTail</a></h3>
<h3 class='method-code'><span class='method-prefix'>Done.</span><a class='method-name' name='*none' href='./../Overviews/Methods.html#none'>none</a></h3>
<h3 class='method-code'><span class='method-prefix'>Done.</span><a class='method-name' name='*pauseSelf' href='./../Overviews/Methods.html#pauseSelf'>pauseSelf</a></h3>
<h2><a class='anchor' name='instancemethods'>Instance Methods</a></h2>
<h3><a class='anchor' name='Inherited%20instance%20methods'>Inherited instance methods</a></h3>
<div id='inheritedinstmets'></div><h2><a class='anchor' name='examples'>Examples</a></h2>
<p>The 'done' flag can be used to trigger other things in the same synth:<pre class='code prettyprint lang-sc'>(
SynthDef("Done-help", { arg out, t_trig;
var line, a, b;
line= Line.kr(1,0,1);
a= SinOsc.ar(440,0,0.1*line); //sound fading out
b= WhiteNoise.ar(Done.kr(line)*0.1); //noise starts at end of line
Out.ar(out, Pan2.ar(a+b));
}).add;
)
Synth("Done-help"); //note that this synth doesn't have it's own doneAction, so you'll need to manually deallocate it</pre>
<p>The 'done' flag can be used to trigger a delayed freeing of the current synth, which is not possible by using doneActions alone:<pre class='code prettyprint lang-sc'>play {
var env = Line.kr(1,0,2);
var sig = PinkNoise.ar(env);
FreeSelf.kr(TDelay.kr(Done.kr(env),3));
GVerb.ar(sig,70,7);
}</pre>
<p><h2><a class='anchor' name='Actions'>Actions</a></h2>
<p>A number of UGens implement doneActions. These allow one to optionally free or pause the enclosing synth and other related nodes when the UGen is finished. You can use the constants in this class to name doneActions, which can be clearer than using the number codes alone. The available doneActions are as follows:<table>
<tr><td>name<td>value<td>description<tr><td>none<td>0<td>do nothing when the UGen is finished<tr><td>pauseSelf<td>1<td>pause the enclosing synth, but do not free it<tr><td>freeSelf<td>2<td>free the enclosing synth<tr><td>freeSelfAndPrev<td>3<td>free both this synth and the preceding node<tr><td>freeSelfAndNext<td>4<td>free both this synth and the following node<tr><td>freeSelfAndFreeAllInPrev<td>5<td>free this synth; if the preceding node is a group then do g_freeAll on it, else free it<tr><td>freeSelfAndFreeAllInNext<td>6<td>free this synth; if the following node is a group then do g_freeAll on it, else free it<tr><td>freeSelfToHead<td>7<td>free this synth and all preceding nodes in this group<tr><td>freeSelfToTail<td>8<td>free this synth and all following nodes in this group<tr><td>freeSelfPausePrev<td>9<td>free this synth and pause the preceding node<tr><td>freeSelfPauseNext<td>10<td>free this synth and pause the following node<tr><td>freeSelfAndDeepFreePrev<td>11<td>free this synth and if the preceding node is a group then do g_deepFree on it, else free it<tr><td>freeSelfAndDeepFreeNext<td>12<td>free this synth and if the following node is a group then do g_deepFree on it, else free it<tr><td>freeAllInGroup<td>13<td>free this synth and all other nodes in this group (before and after)<tr><td>freeGroup<td>14<td>free the enclosing group and all nodes within it (including this synth)</table>
<p>For information on <code class='code prettyprint lang-sc'>freeAll</code> and <code class='code prettyprint lang-sc'>deepFree</code>, see <a href="./../Classes/Group.html">Group</a> and <a href="./../Reference/Server-Command-Reference.html">Server Command Reference</a>.<h2><a class='anchor' name='Alternatives'>Alternatives</a></h2>
<p>Another way to free a synth when some UGen is done playing is to use <a href="./../Classes/FreeSelfWhenDone.html">FreeSelfWhenDone</a>, or <a href="./../Classes/FreeSelf.html">FreeSelf</a> in combination with <a href="./../Classes/Done.html">Done</a>. For example, this can be used to delay the freeing to let reverb tails fade out, etc.<div class='doclink'>helpfile source: <a href='file:///Applications/SuperCollider.app/Contents/Resources/HelpSource/Classes/Done.schelp'>/Applications/SuperCollider.app/Contents/Resources/HelpSource/Classes/Done.schelp</a><br>link::Classes/Done::<br></div></div></body></html>