File: NodeMap.schelp

package info (click to toggle)
supercollider 1%3A3.6.6~repack-2-1
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 23,792 kB
  • ctags: 25,269
  • sloc: cpp: 177,129; lisp: 63,421; ansic: 11,297; python: 1,787; perl: 766; yacc: 311; sh: 286; lex: 181; ruby: 173; makefile: 168; xml: 13
file content (90 lines) | stat: -rw-r--r-- 1,445 bytes parent folder | download
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
89
90
class:: NodeMap
summary:: store control values and bus mappings
categories:: Libraries>JITLib>NodeProxy
related:: Classes/Bus

description::
Object to store control values and bus mappings independant of of a specific node.

InstanceMethods::

method::set
set arguments of a node

method::map
set bus mappings of a node

method::unset
remove settings

method::unmap
remove mappings

method::setn
set ranges of controls

method::mapn
map num busses mappings to node

method::at
return setting at that key.

method::sendToNode
apply a setting to a node by sending a bundle

method::send
apply a setting to a node by sending a bundle

method::addToBundle
add all my messages to the bundle

Examples::

code::

s.boot;

(
SynthDef("modsine",
	{ arg freq=320, amp=0.2;
		Out.ar(0, SinOsc.ar(freq, 0, amp));
	}).send(s);
SynthDef("lfo",
	{ arg rate=2, busNum=0;
		Out.kr(busNum, LFPulse.kr(rate, 0, 0.1, 0.2))
	}).send(s);
)

//start nodes
(
b = Bus.control(s,1);
x = Synth("modsine");
y = Synth.before(x, "lfo", [\busNum, b]);
)

//create some node maps
(
h = NodeMap.new;
h.set(\freq, 800);
h.map(\amp, b);

k = NodeMap.new;
k.set(\freq, 400);
k.unmap(\amp);
)

//apply the maps

h.sendToNode(x); //the first time a new bundle is made
k.sendToNode(x);

h.sendToNode(x); //the second time the cache is used
k.sendToNode(x);

h.set(\freq, 600);

h.sendToNode(x); //when a value was changed, a new bundle is made

//free all
x.free; b.free; y.free;
::