File: NodeMap.schelp

package info (click to toggle)
supercollider 1%3A3.7.0~repack-4%2Bdeb9u1
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 34,364 kB
  • sloc: cpp: 197,140; ansic: 72,013; lisp: 63,505; sh: 14,009; python: 1,992; perl: 766; makefile: 679; java: 677; xml: 326; yacc: 309; lex: 175; ruby: 173; objc: 65
file content (113 lines) | stat: -rw-r--r-- 2,032 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
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
class:: NodeMap
summary:: store control values and bus mappings
categories:: Libraries>JITLib>NodeProxy, Server>Nodes, Server>Abstractions
related:: Classes/Bus

description::
Object to store control values and bus mappings independantly 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::setn, map, mapn
These are kept for backward compatibility. They redirect to link::#-set::.

method::get
Kept for backward compatibility.

method::clear
Remove all settings and clear cache


private::updateArgs, upToDate

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;
::