aboutsummaryrefslogtreecommitdiff
path: root/ignore/scsynth_to_scsynth4F.sc
blob: ae2e9e5d1b86e3af837af9ad6c4057da80b9ffe6 (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
#!/usr/bin/env sclang

/*
 * Copyright (c) 2015 Hanspeter Portner (dev@open-music-kontrollers.ch)
 * 
 * This is free software: you can redistribute it and/or modify
 * it under the terms of the Artistic License 2.0 as published by
 * The Perl Foundation.
 * 
 * This source is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 * Artistic License 2.0 for more details.
 * 
 * You should have received a copy of the Artistic License 2.0
 * along the source as a COPYING file. If not, obtain it from
 * http://www.perlfoundation.org/artistic_license_2_0.
 */

s.options.protocol = \tcp;
s.options.blockSize = 0x10;
s.options.memSize = 0x10000;
s.latency = nil;
s.boot;

Routine.run({
	2.wait;
	s.addr.connect; // connect via TCP
}, clock:AppClock);

s.doWhenBooted({
	var chimconf, sidOffset, gidOffset, grp;

	gidOffset = 100;
	sidOffset = 200;
	grp = 0+gidOffset;

	s.sendMsg('/g_new', grp, \addToHead.asInt, 0);
	s.sync;

	chimconf = ChimaeraConf(s,
		addr:"chimaera.local", prot:\tcp, target:\serv);

	chimconf.sendMsg("/sensors/group/reset");

	chimconf.sendMsg("/sensors/group/attributes/0/min", 0.0);
	chimconf.sendMsg("/sensors/group/attributes/0/max", 1.0);
	chimconf.sendMsg("/sensors/group/attributes/0/north", false);
	chimconf.sendMsg("/sensors/group/attributes/0/south", true);
	chimconf.sendMsg("/sensors/group/attributes/0/scale", false);

	chimconf.sendMsg("/sensors/group/attributes/1/min", 0.0);
	chimconf.sendMsg("/sensors/group/attributes/1/max", 1.0);
	chimconf.sendMsg("/sensors/group/attributes/1/north", true);
	chimconf.sendMsg("/sensors/group/attributes/1/south", false);
	chimconf.sendMsg("/sensors/group/attributes/1/scale", false);

	chimconf.sendMsg("/engines/scsynth/enabled", true);
	chimconf.sendMsg("/engines/scsynth/reset");
	chimconf.sendMsg("/engines/scsynth/derivatives", true);

	chimconf.sendMsg("/engines/scsynth/attributes/0/name", \base);
	chimconf.sendMsg("/engines/scsynth/attributes/0/sid_offset", sidOffset);
	chimconf.sendMsg("/engines/scsynth/attributes/0/gid_offset", grp);
	chimconf.sendMsg("/engines/scsynth/attributes/0/out", 0);
	chimconf.sendMsg("/engines/scsynth/attributes/0/arg_offset", 0);
	chimconf.sendMsg("/engines/scsynth/attributes/0/allocate", true);
	chimconf.sendMsg("/engines/scsynth/attributes/0/gate", true);
	chimconf.sendMsg("/engines/scsynth/attributes/0/tail", \addToHead.asInt);
	chimconf.sendMsg("/engines/scsynth/attributes/0/group", false);
	
	chimconf.sendMsg("/engines/scsynth/attributes/1/name", \lead);
	chimconf.sendMsg("/engines/scsynth/attributes/1/sid_offset", sidOffset);
	chimconf.sendMsg("/engines/scsynth/attributes/1/gid_offset", grp);
	chimconf.sendMsg("/engines/scsynth/attributes/1/out", 0);
	chimconf.sendMsg("/engines/scsynth/attributes/1/arg_offset", 5);
	chimconf.sendMsg("/engines/scsynth/attributes/1/allocate", false);
	chimconf.sendMsg("/engines/scsynth/attributes/1/gate", false);
	chimconf.sendMsg("/engines/scsynth/attributes/1/tail", \addToHead.asInt);
	chimconf.sendMsg("/engines/scsynth/attributes/1/group", true);

	chimconf.sendMsg("/sensors/number", {|msg|
		var n=msg[0];
		Routine.run({
			"./instruments4F.sc".load.value(n);
		}, clock:AppClock);
	});
});