NodeMap:
Filter:
Classes | Libraries > JITLib > NodeProxy | Server > Nodes | Server > Abstractions

NodeMap : IdentityDictionary : Dictionary : Set : Collection : Object

store control values and bus mappings
Source: NodeMap.sc
Subclasses: ProxyNodeMap

Description

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

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

Class Methods

Inherited class methods

Instance Methods

.set( ... args)

set arguments of a node

.unset( ... keys)

remove settings

.unmap( ... keys)

remove mappings

.at(key)

From superclass: IdentityDictionary

return setting at that key.

.sendToNode(node, latency)

apply a setting to a node by sending a bundle

.send(server, nodeID, latency)

apply a setting to a node by sending a bundle

.addToBundle(bundle, target)

add all my messages to the bundle

.addToEvent(event)

add all my values to the event

.asOSCArgArray

returns the arguments for an OSC message.

.unmapArgsToBundle(bundle, target, keys)

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

.setMsg(target)

returns the OSC message for setting a synth

Arguments:

target

a group, synth, or server to use as a nodeID to set.

.setn

From extension in /usr/local/share/SuperCollider/SCClassLibrary/deprecated/3.9/JITLib.sc

.map

From extension in /usr/local/share/SuperCollider/SCClassLibrary/deprecated/3.9/JITLib.sc

.mapn

From extension in /usr/local/share/SuperCollider/SCClassLibrary/deprecated/3.9/JITLib.sc

These are kept for backward compatibility. They redirect to -set.

.get(key)

Kept for backward compatibility.

.clear

Remove all settings and clear cache

Inherited instance methods

Examples

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;