blob: b2a325272861529fc0992baaa9e271c620a77fd1 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
|
<refentry id="timeinstk">
<indexterm id="IndexTimeinstk"><primary>timeinstk</primary></indexterm>
<refentryinfo><title>Instrument Control:Time Reading</title></refentryinfo>
<refmeta>
<refentrytitle>timeinstk</refentrytitle>
</refmeta>
<refnamediv>
<refname>timeinstk</refname>
<refpurpose>
Read absolute time in k-rate cycles.
</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<para>
Read absolute time, in k-rate cycles, since the start of an
instance of an instrument. Called at both i-time as well as
k-time.
</para>
</refsect1>
<refsect1>
<title>Syntax</title>
<synopsis>kres <command>timeinstk</command></synopsis>
<synopsis>kres <command>timeinsts</command></synopsis>
</refsect1>
<refsect1>
<title>Performance</title>
<para>
<emphasis>timeinstk</emphasis> is for time in k-rate cycles. So with:
<informalexample>
<programlisting>
<emphasis>sr</emphasis> = 44100
<emphasis>kr</emphasis> = 6300
<emphasis>ksmps</emphasis> = 7
</programlisting>
</informalexample>
then after half a second, the <emphasis>timek</emphasis> opcode would report 3150. It will always report an integer.
</para>
<para>
<emphasis>timeinstk</emphasis> produces a k-rate variable for output. There are no input parameters.
</para>
<para>
<emphasis>timeinstk</emphasis> is similar to <link linkend="timek"><citetitle>timek</citetitle></link> except it returns the time since the start of this instance of the instrument.
</para>
</refsect1>
<refsect1>
<title>Examples</title>
<para>
Here is an example of the timeinstk opcode. It uses the file <ulink url="examples/timeinstk.csd"><citetitle>timeinstk.csd</citetitle></ulink>.
<example>
<title>Example of the timeinstk opcode.</title>
<para>See the sections <link linkend="UsingRealTime"><citetitle>Real-time Audio</citetitle></link> and <link linkend="CommandFlags"><citetitle>Command Line Flags</citetitle></link> for more information on using command line flags.</para>
<xi:include href="examples-xml/timeinstk.csd.xml" xmlns:xi="http://www.w3.org/2001/XInclude"/>
</example>
Its output should include lines like this:
<screen>
k1 = 1.000000 samples
k1 = 2205.000000 samples
k1 = 4410.000000 samples
k1 = 6615.000000 samples
k1 = 8820.000000 samples
</screen>
</para>
</refsect1>
<refsect1>
<title>See Also</title>
<para>
<link linkend="timeinsts"><citetitle>timeinsts</citetitle></link>, <link linkend="timek"><citetitle>timek</citetitle></link>, <link linkend="times"><citetitle>times</citetitle></link>
</para>
</refsect1>
<refsect1>
<title>Credits</title>
<para>
<simplelist>
<member>Author: Robin Whittle</member>
<member>Australia</member>
<member>May 1997</member>
</simplelist>
</para>
<para>Example written by &namekevin;.</para>
</refsect1>
</refentry>
|