Re: [Bug 17793] New: AudioNode.disconnect() needs to be able to disconnect only one connection

> That said, I don't think multiple inputs and outputs will be used very heavily, even with support for them in JSNodes, outside of the obvious case of multi-channel (stereo, 5.1, etc) audio, *most* of which is handled by the native nodes automatically (or should be).

I would definitely use inputs/outputs *a lot*, and more than just for channel mixing/splitting, although mixers are indeed the most obvious example. But my flash synth has numerous other modules that have more than 1 in/out.

- clock multiplier: 1 in, 8 out. Creates x2, x3, etc mutiplications of an incoming clock pulse
- delay module: 2 in, 1 out. Additional input for syncing the delaytime with a clock (or lfo)
- ring modulator (multiplies two signals): 2 in 1 out
- envelope with combined gaincontrol (you can apply the envelope directly on a signal): 2 in (trigger and signal) 2 out (the envelope itself and the enveloped signal)
- stepsequencers send a gate out whenever they've reached the end

I must add that some of can be done with parameters in the api (which act like inputs), but that's just for the inputs.

> Sorry, I overspoke there a bit.  node.disconnect() will still remove all outbound connections from a particular output.  It defaults to output 0, which is of course the only output any node but a Splitter has, so in general, it will disconnect a "normal" (i.e. non-splitter) node completely in one go, but you're right that it won't work on a splitter.
> 
> To generically completely disconnect all of a node's outputs, though, you can just do this:
> 
> for (var i=0; i<node.numberOfOutputs; i++)
>     node.disconnect(i);
> 

Ah, the first parameter is optional as in it defaults to output 0. Got it. Still, i find it a strange one... I must admit that i'm very fond of precise and descriptive functionnames, and node.disconnect() (without params) would imply to me that it disconnects the node. But actually it means: disconnect merely output 0. I find that confusing.

Anyhow, if that method works like that (with the addition for supplying additional params for the destionationnode and destinationinput) i can work with it. Can i still suggest a context.removeNode(node) which completely removes a node and its connections?

Received on Wednesday, 18 July 2012 17:30:48 UTC