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

88 lines
No EOL
5.6 KiB
HTML

<!doctype html><html lang='en'><head><title>AppClock | 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 = 'AppClock';
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'>AppClock:</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='#*sched'>sched</a> </li>
<li class='toc3'><a href='#*clear'>clear</a> </li>
<li class='toc3'><a href='#*play'>play</a> </li>
<li class='toc3'><a href='#*tick'>tick</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></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#Scheduling'>Scheduling</a>&#8201;&gt;&#8201;<a href='./../Browse.html#Scheduling>Clocks'>Clocks</a></span>
</div><h1>AppClock<span id='superclasses'> : <a href="../Classes/Clock.html">Clock</a> : <a href="../Classes/Object.html">Object</a></span>
</h1>
<div id='summary'>Clock running on main application thread</div>
</div>
<div class='subheader'>
<div id='filename'>Source: <a href='file:///Applications/SuperCollider.app/Contents/Resources/SCClassLibrary/Common/Core/Clock.sc' title='/Applications/SuperCollider.app/Contents/Resources/SCClassLibrary/Common/Core/Clock.sc'>Clock.sc</a></div><div id='related'>See also: <a href="./../Classes/SystemClock.html">SystemClock</a>, <a href="./../Classes/TempoClock.html">TempoClock</a></div>
</div>
<h2><a class='anchor' name='description'>Description</a></h2>
<p>SystemClock is more accurate, but cannot call GUI primitives.
<p>You will need to use the <a href="./../Classes/SystemClock.html">SystemClock</a> to get accurate/musical scheduling.
<p>See <a href="./../Classes/Clock.html">Clock</a> for general explanation of how clocks operate.<h2><a class='anchor' name='classmethods'>Class Methods</a></h2>
<h3 class='method-code'><span class='method-prefix'>AppClock.</span><a class='method-name' name='*sched' href='./../Overviews/Methods.html#sched'>sched</a>(<span class='argstr'>delta</span>, <span class='argstr'>item</span>)</h3>
<div class='method'>
<p>The float you return specifies the delta to resched the function for. Returning nil will stop the task from being rescheduled.<pre class='code prettyprint lang-sc'>(
AppClock.sched(0.0,{ arg time;
["AppClock has been playing for ",time].postln;
rrand(0.1,0.9);
});
)</pre>
<p><pre class='code prettyprint lang-sc'>(
AppClock.sched(2.0,{
"2.0 seconds later".postln;
nil;
});
)</pre>
</div><h3 class='method-code'><span class='method-prefix'>AppClock.</span><a class='method-name' name='*clear' href='./../Overviews/Methods.html#clear'>clear</a></h3>
<div class='method'>
<p>Clear the AppClock's scheduler to stop it.<pre class='code prettyprint lang-sc'>AppClock.clear;</pre>
</div><h3 class='method-code'><span class='method-prefix'>AppClock.</span><a class='method-name' name='*play' href='./../Overviews/Methods.html#play'>play</a>(<span class='argstr'>task</span>)</h3>
<div class='supmethod'>From superclass: <a href='./../Classes/Clock.html'>Clock</a></div>
<div class='method'>
<p>The <a href="./../Classes/Routine.html">Routine</a> (or <a href="./../Classes/Task.html">Task</a>) yields a float value indicating the delta (secs) for the AppClock to wait until resuming the Routine.<pre class='code prettyprint lang-sc'>(
var w, r;
w = Window.new("trem", Rect(512, 256, 360, 130));
w.front;
r = Routine({ arg appClockTime;
["AppClock has been playing for secs:",appClockTime].postln;
60.do({ arg i;
0.05.yield;
w.bounds = w.bounds.moveBy(10.rand2, 10.rand2);
w.alpha = cos(i*0.1pi)*0.5+0.5;
});
1.yield;
w.close;
});
AppClock.play(r);
)</pre>
</div><h3 class='method-code'><span class='method-prefix'>AppClock.</span><a class='method-name' name='*tick' href='./../Overviews/Methods.html#tick'>tick</a></h3>
<div class='method'>
<p>AppClock.tick is called periodically by the SuperCollider language interpreter. This updates the <a href="./../Classes/Scheduler.html">Scheduler</a> and causes any scheduled tasks to be executed. You should never call this method yourself.</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><div class='doclink'>helpfile source: <a href='file:///Applications/SuperCollider.app/Contents/Resources/HelpSource/Classes/AppClock.schelp'>/Applications/SuperCollider.app/Contents/Resources/HelpSource/Classes/AppClock.schelp</a><br>link::Classes/AppClock::<br></div></div></body></html>