2 var server, name, id, values, presets, presetIndex, <isOn = false;
4 *new { arg server, name, id;
5 ^super.newCopyArgs(server, name, id).init
11 if (presetIndex > presets.size, {
12 presets = presets.add(values);
14 presets.put(presetIndex, values);
17 if (presetIndex < presets.size, {
18 values = presets.at(presetIndex).copy;
19 // set gui elems and synth controls
23 presets.writeArchive("server/presets/" ++ name ++ ".scpreset");
27 filename = "server/presets/" ++ name ++ ".scpreset";
28 if (File.exists(filename), {
29 presets = Object.readArchive(filename);
35 msg = ["/s_new", name, id, 0];
36 values.keysValuesDo({ arg key, value; msg = msg.addAll([key, value]); });
37 server.addr.sendBundle(nil, msg);
41 server.sendMsg("/n_set", id, \gate, 0);