bbc / r-audio

A library of React components for building Web Audio graphs.
Other
180 stars 14 forks source link

Advanced channel routing + Gain matrix #1

Closed jakubfiala-bbc closed 6 years ago

jakubfiala-bbc commented 6 years ago

This patch is based on @tomjnixon's question about building a gain matrix graph. When pondering the possibility of building it in r-audio I found that the way I've implemented RSplitChannels was a bit naive, and a gain matrix couldn't be built with it.

This patch makes significant changes in how channel connections are inferred. connectFrom- and ToChannel props now trickle down from encapsulating graph components to the actual AudioNodes. The default channel routing of RSplitChannels is now configurable at the containing node level, even when more RSplits are involved.

I've also added a GainMatrix example illustrating this. Here's what the demo page looks like:

screen shot 2018-06-01 at 19 38 21

This patch also makes small changes to the Mutation example which make it a bit more sensible.