Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Is there a way to choose which nodes you want disconnect? #44

Closed
lukephills opened this issue Dec 10, 2014 · 1 comment
Closed

Is there a way to choose which nodes you want disconnect? #44

lukephills opened this issue Dec 10, 2014 · 1 comment

Comments

@lukephills
Copy link
Contributor

Hey Yotam,

Is there a way to disconnect a specific node?

At the moment, when you use the disconnect method it disconnects all the nodes which can be a bit problematic. If you want to only disconnect one node, you then have to reconnect up everything else. Sometimes this can be difficult, especially if you don't know all of the nodes currently connected.

Do you know a way of getting round this?

Really great work on the new release!

@tambien
Copy link
Contributor

tambien commented Dec 10, 2014

This is a product of how the Web Audio API is set up (spec). You cannot choose which node to disconnect from only which outlet of the node you want to disconnect.

One way to get around this would be to keep track of all of the nodes an object is connected to so that you can disconnect from a specific one. It would be a matter of disconnecting all of the nodes with disconnect and then reconnecting the ones that you still want to be attached. It's pretty ugly.

If you know you might need to disconnect a node from whatever it's connected to, you can route it through an intermediate GainNode and just disconnect that GainNode instead of all of the attached nodes. The send method (example) will create a GainNode for you which is connected through a named bus to whatever node receives it. send returns that GainNode so you can change the level of the routed signal or disconnect from the receiving node altogether.

I hope that helps.

Thanks Luke. Keep the questions/comments coming.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants