97 lines
No EOL
5.5 KiB
HTML
97 lines
No EOL
5.5 KiB
HTML
<!doctype html><html lang='en'><head><title>FreeSelfWhenDone | 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 = 'FreeSelfWhenDone';
|
|
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'>FreeSelfWhenDone:</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>
|
|
</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></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> > <a href='./../Browse.html#UGens>Synth control'>Synth control</a></span>
|
|
</div><h1>FreeSelfWhenDone<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'>Free the enclosing synth when a UGen 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/Done.html">Done</a>, <a href="./../Classes/PauseSelfWhenDone.html">PauseSelfWhenDone</a>, <a href="./../Classes/Done.html">Done</a></div>
|
|
</div>
|
|
<h2><a class='anchor' name='description'>Description</a></h2>
|
|
|
|
<p>Some UGens set a 'done' flag when they are finished playing. FreeSelfWhenDone will free the enclosing synth when this flag is set to true.
|
|
<p>See <a href="./../Classes/Done.html">Done</a> for a complete list of these UGens.
|
|
<p>Note that many of these UGens have doneActions, which are another way of accomplishing the same thing. See <a href="./../Classes/Done.html">Done</a> for more detail.<div class='note'><span class='notelabel'>NOTE:</span> One must be careful when using binary operations on UGens with done flags, as these will return a <a href="./../Classes/BinaryOpUGen.html">BinaryOpUGen</a>, and thus prevent the done flag from being accessible. See example below.</div><h2><a class='anchor' name='classmethods'>Class Methods</a></h2>
|
|
<h3 class='method-code'><span class='method-prefix'>FreeSelfWhenDone.</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 check for done.</table></div><h3><a class='anchor' name='Inherited%20class%20methods'>Inherited class methods</a></h3>
|
|
<div id='inheritedclassmets'></div><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>
|
|
<pre class='code prettyprint lang-sc'>s.boot;
|
|
|
|
// simple example
|
|
(
|
|
{ var env;
|
|
env = Line.kr(0, 1, 1);
|
|
FreeSelfWhenDone.kr(env); // free synth at end of line
|
|
SinOsc.ar(200, 0, 0.5) * env
|
|
}.play;
|
|
)
|
|
|
|
// the previous example works, because FreeSelfWhenDone operates on the Line
|
|
// this version won't work
|
|
(
|
|
{ var env, output;
|
|
env = Line.kr(0, 1, 1);
|
|
output = SinOsc.ar(200, 0, 0.5) * env;
|
|
output.postln; // output is a BinaryOpUGen, which has no 'done' flag
|
|
FreeSelfWhenDone.kr(output); // won't ever be done
|
|
output
|
|
}.play;
|
|
)
|
|
|
|
// record for four seconds
|
|
b = Buffer.alloc(s, 44100 * 4.0, 1);
|
|
(
|
|
SynthDef("help-RecordBuf",{ arg out=0,bufnum=0;
|
|
var formant, recbuf;
|
|
formant = Formant.ar(XLine.kr(400,1000, 4), 2000, 800, 0.125);
|
|
recbuf = RecordBuf.ar(formant, bufnum, recLevel: Line.kr(1, 1), loop: 0);
|
|
// The RecordBuf doesn't loop, so you can check it for 'done' status
|
|
FreeSelfWhenDone.kr(recbuf);
|
|
}).play(s,[\out, 0, \bufnum, b]);
|
|
)
|
|
|
|
// play it back
|
|
(
|
|
SynthDef("help-RecordBuf play",{ arg out=0,bufnum=0;
|
|
var playbuf;
|
|
playbuf = PlayBuf.ar(1,bufnum);
|
|
FreeSelfWhenDone.kr(playbuf); // frees the synth when the PlayBuf is finished
|
|
Out.ar(out, playbuf);
|
|
}).play(s,[\out, 0, \bufnum, b]);
|
|
)</pre>
|
|
<div class='doclink'>helpfile source: <a href='file:///Applications/SuperCollider.app/Contents/Resources/HelpSource/Classes/FreeSelfWhenDone.schelp'>/Applications/SuperCollider.app/Contents/Resources/HelpSource/Classes/FreeSelfWhenDone.schelp</a><br>link::Classes/FreeSelfWhenDone::<br></div></div></body></html> |