SuperCollider CLASSES (extension)

SynthSnapshot

A snapshot of the state of a synth on the server
Source: /home/egor/.local/share/SuperCollider/downloaded-quarks/NodeSnapshot/NodeSnapshot.sc
Inherits from: NodeSnapshot : Object

Description

A SynthSnapshot describes a Synth on the server.

WARNING: SynthSnapshot metadata is built using information from SynthDescLib, looked-up via name of the synth reported by the server. If the registered SynthDef differs from the one running on the server, this may be incorrect.

Class Methods

Inherited class methods

Undocumented class methods

*new

Instance Methods

-asSynth

Returns:

A Synth representing the synth described by this snapshot. It does not create the synth on the server, nor does it guarantee it is still runnung on the server.

-outputs

Returns:

An Array of IODesc's representing the outputs of the synth. These are only present if a SynthDesc can be found for the synth.

-outBusses

Returns:

An Array of Bus's representing the busses being output to by the synth. These are only present if a SynthDesc can be found for the synth.

-desc

Returns:

A SynthDesc for the synth, if one can be found.

-defName

-defName = inDefName

Returns:

The name of the SynthDef, as reported by the server.

-controls

Returns:

An Dictionary mapping NamedControl names to values of those controls at the time of the snapshot.

Inherited instance methods

Undocumented instance methods

-== (other)

-asString (indent: 0)

-controlsString (join: " ", dec: 0.01)

Examples

fork {
    SynthDef(\outputTest, { |out, freq| var sig = SinOsc.ar(freq, 0, 0.1); Out.ar(out, sig) }).add;
    ~synths = 10.collect {
        |i|
        Synth(\outputTest, [
            \out, [0, 1, 2, 3].choose,
            \freq, 400.rand
        ]);
    };

    1.wait;

    TreeSnapshot.get({
        |snap|
        var playing = snap.root.children[0].children.select {
            |node|
            node.isKindOf(SynthSnapshot) && (node.outputs[0].startingChannel == 0)
        };
        "% synths are playing to output 0: %".format(playing.size, playing.collect(_.nodeId)).postln;

        "Synth freq's are: ".postln;
        playing.do {
            |node|
            if (node.isKindOf(SynthSnapshot)) {
                "   node %: % ".format(node.nodeId, node.controls[\freq]).postln;
            }
        }
    });

    ~synths.do(_.free);
}