common: more pathscale compile fixes
[supercollider.git] / Help / Collections / Archive.html
blob43e7b7e23f899c4add4a30fc5bbb4ad1c23d3e16
1 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
2 <html>
3 <head>
4 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
5 <meta http-equiv="Content-Style-Type" content="text/css">
6 <title></title>
7 <meta name="Generator" content="Cocoa HTML Writer">
8 <meta name="CocoaVersion" content="949.43">
9 <style type="text/css">
10 p.p1 {margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica}
11 p.p2 {margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica; min-height: 14.0px}
12 p.p3 {margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica; color: #0021e7}
13 p.p4 {margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco; min-height: 12.0px}
14 p.p5 {margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica; color: #0024f8}
15 p.p6 {margin: 0.0px 0.0px 0.0px 0.0px; font: 14.0px Helvetica}
16 p.p7 {margin: 0.0px 0.0px 0.0px 57.0px; text-indent: -57.0px; font: 9.0px Monaco; min-height: 12.0px}
17 p.p8 {margin: 0.0px 0.0px 0.0px 57.0px; text-indent: -57.0px; font: 12.0px Helvetica}
18 p.p9 {margin: 0.0px 0.0px 0.0px 57.0px; text-indent: -57.0px; font: 12.0px Helvetica; min-height: 14.0px}
19 p.p10 {margin: 0.0px 0.0px 0.0px 57.0px; text-indent: -57.0px; font: 14.0px Helvetica}
20 p.p11 {margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco; color: #8f2116}
21 p.p12 {margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco}
22 p.p13 {margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco; color: #486b24}
23 span.s1 {font: 18.0px Helvetica}
24 span.s2 {color: #000000}
25 span.s3 {color: #002eaf}
26 span.s4 {color: #0024f8}
27 span.s5 {color: #0033f1}
28 span.s6 {color: #0000ff}
29 span.s7 {color: #8f2116}
30 span.s8 {color: #486b24}
31 span.Apple-tab-span {white-space:pre}
32 </style>
33 </head>
34 <body>
35 <p class="p1"><span class="s1"><b>Archive<span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span></b></span><b>storing objects to file</b><span class="s1"><b><span class="Apple-tab-span"> </span></b></span></p>
36 <p class="p2"><br></p>
37 <p class="p3"><span class="s2"><b>Inherits from: </b><a href="../Core/Object.html"><span class="s3"><b>Object</b></span></a><b> : </b><a href="Collection.html"><b>Collection</b></a><b> : </b><a href="MultiLevelIdentityDictionary.html"><b>MultiLevelIdentityDictionary</b></a><b> : </b><a href="LibraryBase.html"><span class="s4"><b>LibraryBase</b></span></a></span></p>
38 <p class="p4"><br></p>
39 <p class="p1">Archives can write any object to disk and read from file again. Compex structures of objects can thus be restored. Writing an object to file as a<b> compile string</b> is usually more readable, but does not account for the internal structure of the object.</p>
40 <p class="p2"><br></p>
41 <p class="p5"><span class="s2"><b>See also:</b> <a href="Library.html"><span class="s3">Library</span></a></span><span class="s3">, <a href="../Core/Object.html"><span class="s5">Object</span></a></span><span class="s5">, <a href="LibraryBase.html"><span class="s4">LibraryBase</span></a></span>, <a href="../OSX/writeAsPlist.html"><span class="s6">writeAsPlist</span></a></p>
42 <p class="p2"><br></p>
43 <p class="p1">There is only one global instance: Archive.global, which is initialized automatically.</p>
44 <p class="p2"><br></p>
45 <p class="p6"><b>Class Methods (see superclass for more)</b></p>
46 <p class="p7"><br></p>
47 <p class="p8"><b><span class="Apple-tab-span"> </span>*global</b></p>
48 <p class="p8"><b><span class="Apple-tab-span"> </span>*global_(obj)</b></p>
49 <p class="p8"><b><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span></b>return / set the global archive instance</p>
50 <p class="p9"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span></p>
51 <p class="p8"><span class="Apple-tab-span"> </span><b>*archiveDir</b></p>
52 <p class="p8"><b><span class="Apple-tab-span"> </span>*archiveDir_(string)</b></p>
53 <p class="p8"><b><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span></b>set or get the directory that the archive is written to.<span class="Apple-converted-space"> </span></p>
54 <p class="p8"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>Default: <a href="../Platform/Platform.html"><span class="s3">Platform</span></a>.userAppSupportDir.</p>
55 <p class="p9"><b><span class="Apple-tab-span"> </span></b></p>
56 <p class="p8"><b><span class="Apple-tab-span"> </span>*write(filename)</b></p>
57 <p class="p8"><b><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span></b>write the global archive now. This is called automatically when SuperCollider quits.</p>
58 <p class="p8"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>The default filename is "/archive.sctxar"</p>
59 <p class="p9"><span class="Apple-tab-span"> </span></p>
60 <p class="p8"><span class="Apple-tab-span"> </span><b>*read(filename)</b></p>
61 <p class="p8"><b><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span></b>read the global archive now. This is called automatically when SuperCollider recompiles or starts.</p>
62 <p class="p8"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>The default filename is "/archive.sctxar"</p>
63 <p class="p9"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span></p>
64 <p class="p2"><br></p>
65 <p class="p10"><b>Examples</b></p>
66 <p class="p4"><br></p>
67 <p class="p11">// make a storage place for various objects:</p>
68 <p class="p12">q = (); <span class="s7">// Event</span></p>
69 <p class="p4"><br></p>
70 <p class="p12">q[<span class="s8">\a_long_array</span>] = <span class="s3">Array</span>.rand(128, 0.0, 1.0);</p>
71 <p class="p12">q[<span class="s8">\pi_squared</span>] = pi * pi;</p>
72 <p class="p12">q[<span class="s8">\favourite_sound</span>] = { { <span class="s3">SinOsc</span>.ar([300, 330]).sum * <span class="s3">LFPulse</span>.kr(2 + [0, 0.01]) * 0.1 }.play };</p>
73 <p class="p11"><span class="s2">q[</span><span class="s8">\same_long_array</span><span class="s2">] = q[</span><span class="s8">\a_long_array</span><span class="s2">]; </span>// same objects may appear several times</p>
74 <p class="p4"><br></p>
75 <p class="p12"><span class="s3">Archive</span>.global.put(<span class="s8">\myData</span>, q);</p>
76 <p class="p4"><br></p>
77 <p class="p4"><br></p>
78 <p class="p12"><span class="s3">Archive</span>.global.at(<span class="s8">\myData</span>).postcs;</p>
79 <p class="p4"><br></p>
80 <p class="p11">// after a recompile:</p>
81 <p class="p12">s.boot;</p>
82 <p class="p4"><br></p>
83 <p class="p12">q = <span class="s3">Archive</span>.global.at(<span class="s8">\myData</span>);</p>
84 <p class="p12">q.postcs;</p>
85 <p class="p13"><span class="s2">q[</span>\favourite_sound<span class="s2">].value;</span></p>
86 <p class="p4"><br></p>
87 <p class="p4"><br></p>
88 <p class="p4"><br></p>
89 </body>
90 </html>