2 summary::storing objects to file
3 categories:: Collections, Files
4 related::Classes/Library, Classes/Object, Classes/LibraryBase
7 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 strong::compile string:: is usually more readable, but does not account for the internal structure of the object.
9 There is only one global instance: Archive.global, which is initialized automatically.
16 set or get the global archive instance
19 set or get the directory that the archive is written to.
20 Default: link::Classes/Platform::.userAppSupportDir.
23 write the global archive now. This is called automatically when SuperCollider quits.
24 The default filename is "/archive.sctxar"
27 read the global archive now. This is called automatically when SuperCollider recompiles or starts.
28 The default filename is "/archive.sctxar"
33 // make a storage place for various objects:
36 q[\a_long_array] = Array.rand(128, 0.0, 1.0);
37 q[\pi_squared] = pi * pi;
38 q[\favourite_sound] = { { SinOsc.ar([300, 330]).sum * LFPulse.kr(2 + [0, 0.01]) * 0.1 }.play };
39 q[\same_long_array] = q[\a_long_array]; // same objects may appear several times
41 Archive.global.put(\myData, q);
44 Archive.global.at(\myData).postcs;
49 q = Archive.global.at(\myData);
51 q[\favourite_sound].value;