7 |
<body> |
<body> |
8 |
<h1>wait()</h1> |
<h1>wait()</h1> |
9 |
<p> |
<p> |
10 |
Suspends / pauses the current event handler instance for the requested |
Suspends / pauses execution of the current event handler instance for the requested |
11 |
amount of microseconds. |
amount of microseconds. The paused event handler instance can also be resumed before |
12 |
|
the requested amount times elapsed by calling <code lang="nksp">stop_wait()</code> from another |
13 |
|
event handler instance. |
14 |
</p> |
</p> |
15 |
|
<note> |
16 |
|
If the even handler instance's built-in variable <code>$NKSP_IGNORE_WAIT</code> |
17 |
|
reflects <code>1</code> then all calls to <code>wait()</code> will be ignored. |
18 |
|
This might for example be the case when <code>stop_wait()</code> with |
19 |
|
<code>1</code> being passed to the 2nd argument of that function. |
20 |
|
</note> |
21 |
|
|
22 |
<h3>Function Prototype</h3> |
<h3>Function Prototype</h3> |
23 |
<p/> |
<p/> |
24 |
<code lang="nksp"> |
<code lang="nksp"> |
76 |
end on |
end on |
77 |
</code> |
</code> |
78 |
|
|
79 |
<note class="important"> |
<note> |
80 |
Using the <code>wait()</code> function can lead to concurrency issues with |
Using the <code>wait()</code> function can lead to concurrency issues with |
81 |
regular variables, which are global variables by default. You might need |
regular variables, which are global variables by default. You might need |
82 |
to use <a href="nksp.html#polyphonic_variables">polyphonic variables</a> |
to use <a href="nksp.html#polyphonic_variables">polyphonic variables</a> |
83 |
in such cases. |
in such cases. |
84 |
</note> |
</note> |
85 |
|
|
86 |
<note class="important"> |
<note> |
87 |
The <code>wait()</code> function is not fully implemented in LinuxSampler |
You need at least LinuxSampler 2.0.0.svn2 or higher for the |
88 |
yet. Currently a <code>wait()</code> function call suspends execution, |
<code>wait()</code> function to fully work as expected. Versions |
89 |
but since the respective scheduler code is yet missing in LinuxSampler, |
of LinuxSampler older than that will not resume the script at the |
90 |
the script will automatically be resumed with the next audio fragment |
requested amount of time, instead those older version will resume |
91 |
cycle. So effectively a <code>wait()</code> call will pause your script |
the script always at the beginning of the next audio fragment |
92 |
for a few miliseconds with LinuxSampler right now, no matter which |
cycle. So effectively a <code>wait()</code> call with a LinuxSampler |
93 |
function argument you provided. Hopefully this will be implemented soon |
version older than 2.0.0.svn2 will pause your script for a few |
94 |
though. |
miliseconds, no matter which function argument you provided. |
95 |
</note> |
</note> |
96 |
|
|
97 |
</body> |
</body> |