modular-synthesizer / frontend

The frontend for the Synple application
https://synple.app/
0 stars 0 forks source link

Add the possibility to link multiple inner nodes at once #67

Closed vincentcourtois closed 7 months ago

vincentcourtois commented 1 year ago

Context

In this bit of code, the link plug one origin node in one destination node. The goal would to find every suitable node for both origin and destination, and plug them all into one another. It would simplify the usage of generators creating multiple nodes (for example in a sequencer or in a multiple layers of oscillators VCO)

Implementation

public linkToOtherNode(nodes: InnerAudioNode[], link: InnerLink) {
    filter(nodes, {name: link.from.node}).forEach((f: InnerAudioNode) => {
        filter(nodes, {name: link.to.node}).forEach((t: InnerAudioNode) => {
           f.node.connect(t.node, f.index, t.index);
    });
    return link;
}