RustAudio / dasp

The fundamentals for Digital Audio Signal Processing. Formerly `sample`.
Other
883 stars 64 forks source link

dasp_graph: Pass edge weights to Node::process #182

Open Smona opened 8 months ago

Smona commented 8 months ago

This PR makes Node and Input generic by edge weight, and passes the edge weight to process on each Input, resolving a TODO in the docs.

This is only implemented for weights that implement Clone, because I could not figure out a good way to store a reference to the weight in the Input structs due to how the processor's inputs field is reused. But I think this will be sufficient for the majority of use cases, where we usually just need to distinguish inputs by simple types.

I think this change is backwards compatible, because the W type parameter used to refer to the weight defaults to (), and I didn't have to make any changes to my (small) project after switching to this branch.

Documentation is also updated.