cmake build system: visiblity support for clang
[supercollider.git] / SCClassLibrary / Common / Control / Module.sc
blob111366727358eed174d991023ee5301cbf1bb68a
1 Module {
2         var server, name, id, values, presets, presetIndex, <isOn = false;
4         *new { arg server, name, id;
5                 ^super.newCopyArgs(server, name, id).init
6         }
7         init {
8                 this.load;
9         }
10         store {
11                 if (presetIndex > presets.size, {
12                         presets = presets.add(values);
13                 });
14                 presets.put(presetIndex, values);
15         }
16         recall {
17                 if (presetIndex < presets.size, {
18                         values = presets.at(presetIndex).copy;
19                         // set gui elems and synth controls
20                 });
21         }
22         save {
23                 presets.writeArchive("server/presets/" ++ name ++ ".scpreset");
24         }
25         load {
26                 var filename;
27                 filename = "server/presets/" ++ name ++ ".scpreset";
28                 if (File.exists(filename), {
29                         presets = Object.readArchive(filename);
30                 });
31         }
32         start {
33                 var msg;
34                 isOn = true;
35                 msg = ["/s_new", name, id, 0];
36                 values.keysValuesDo({ arg key, value; msg = msg.addAll([key, value]); });
37                 server.addr.sendBundle(nil, msg);
38         }
39         stop {
40                 isOn = false;
41                 server.sendMsg("/n_set", id, \gate, 0);
42         }