File: NodeMap.schelp

package info (click to toggle)
supercollider 1%3A3.13.0%2Brepack-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 80,292 kB
  • sloc: cpp: 476,363; lisp: 84,680; ansic: 77,685; sh: 25,509; python: 7,909; makefile: 3,440; perl: 1,964; javascript: 974; xml: 826; java: 677; yacc: 314; lex: 175; objc: 152; ruby: 136
file content (110 lines) | stat: -rw-r--r-- 1,913 bytes parent folder | download | duplicates (3)
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
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
class:: NodeMap
summary:: store control values and bus mappings
categories:: JITLib>NodeProxy, Server>Nodes, Server>Abstractions
related:: Classes/Bus

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

code::
a = NodeMap.new;
a.set(\freq, [446, 662], \amp, 0.2, \out, Bus.audio(s));
a.asOSCArgArray;
::

InstanceMethods::

method::set
set arguments of a node

method::unset
remove settings

method::unmap
remove mappings

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

method::addToEvent
add all my values to the event

method::asOSCArgArray
returns the arguments for an OSC message.

method::unmapArgsToBundle
returns the arguments for an OSC message to unmap any mapped controls.

method::setMsg
returns the OSC message for setting a synth
argument:: target
a group, synth, or server to use as a nodeID to set.

method::get
Kept for backward compatibility.

method::clear
Remove all settings and clear cache


private::updateArgs, upToDate

Examples::

code::

s.boot;

(
SynthDef("modsine",
	{ | out, freq=320, amp=0.2 |
		Out.ar(out, SinOsc.ar(freq, 0, amp));
	}).add;
SynthDef("lfo",
	{ | out, rate=2 |
		Out.kr(out, LFPulse.kr(rate, 0, 0.1, 0.2))
	}).add;
)

// start nodes
(
b = Bus.control(s,1);
x = Synth("modsine");
y = Synth.before(x, "lfo", [\out, 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;
::