-
Notifications
You must be signed in to change notification settings - Fork 18
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
Other user-friendly API ideas. #49
Comments
I like this idea. |
👍 |
Ok, so one issue that I'm finding hard to avoid with this is approach is performance. Most DSP types will have to mutate/update some internal state (i.e. phase, ringbuffer, etc) during the audio loop. The simplest way of handling this that I've been able to come up with so far is to simply make the Rust's bit-shift operator takes self as an immutable reference, meaning we'd have to at some point separate the immutable state from the mutable state. As mentioned above, I'm not sure if there is a solution to this that is practical, ergonomic or even possible while retaining the same performance (I'm open to ideas though). However, since this issue was originally posted, a The
Here's the old Node example and here's the new Graph example if you're interested. Another area for API design that I think is definitely worth exploring is rust's awesome Finally, I'd like to mention that the more I use Rust, the more I feel it is impractical to try and opt for either a purely OOP or a purely FP approach in terms of design. If anything, the style would probably be more accurately be described as "Ownership Oriented Programming" which dips into the benefits of both of the previously mentioned paradigms:
Edit: It seems the ops::{shl,shr} have changed since last time I checked and now take |
My take would be to go with build-time approach with a syntax extension of this kind of shape: let chain: Chain = chain!(
mixer: params,
channels: {
nameA: [effectA1 << effectA2 << synthA],
nameB: [effectB1 << effectB2 << synthB],
nameC: [effectC1 << mic_input],
nameD: subChainD,
}
); |
One idea is using declarative syntax and then feed it to a "black box" that is free to optimize or represent it other ways. |
@errordeveloper I just remembered your comments about taking a compile-time approach to signal graph building - you might be interested in the latest changes to the RustAudio/sample - in particular, the Edit: oh yeah, I forgot to mention that perhaps the |
Currently the trait-based node graph approach is very fast, efficient, and quite user friendly. However, it has the tendency to lead toward a slightly more OOP design, which can often feel like a bit of an up-hill battle with Rust.
I'm interested in coming up with some ideas for a more user-friendly, perhaps functional-esque way of describing the node graph.
One idea I was considering was to implement the bitshift operators for describing a series of inputs in a sort of
Chain
. I.e.where each element in the chain can be either
T
Vec<T>
orChain
where T: Node.
I'll keep thinking on this and try come up with some better examples.
The text was updated successfully, but these errors were encountered: