mirror of
https://github.com/Tonejs/Tone.js
synced 2025-01-13 20:39:06 +00:00
Improve fanIn() API
This commit is contained in:
parent
fdcbea3714
commit
aca51b7026
1 changed files with 5 additions and 4 deletions
|
@ -257,7 +257,6 @@ export abstract class ToneAudioNode<Options extends ToneAudioNodeOptions = ToneA
|
|||
return this;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Dispose and disconnect
|
||||
*/
|
||||
|
@ -379,7 +378,8 @@ export function disconnect(
|
|||
}
|
||||
|
||||
/**
|
||||
* connect the output of this node to the rest of the nodes in parallel.
|
||||
* Connect the output of this node to the rest of the nodes in parallel.
|
||||
* @param nodes One or more source nodes followed by one destination node
|
||||
* @example
|
||||
* const player = new Tone.Player("https://tonejs.github.io/audio/drum-samples/conga-rhythm.mp3");
|
||||
* const player1 = new Tone.Player("https://tonejs.github.io/audio/drum-samples/conga-rhythm.mp3");
|
||||
|
@ -387,6 +387,7 @@ export function disconnect(
|
|||
* // connect nodes to a common destination
|
||||
* fanIn(filter, player, player1);
|
||||
*/
|
||||
export function fanIn(dstNode: InputNode, ...srcNodes: OutputNode[]): void {
|
||||
srcNodes.forEach(srcNode => connect(srcNode, dstNode));
|
||||
export function fanIn(...nodes: any[]): void {
|
||||
const dstNode = nodes.pop();
|
||||
nodes.forEach(node => connect(node, dstNode));
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue