-
Notifications
You must be signed in to change notification settings - Fork 65
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
Use const generics in graph module #152
base: master
Are you sure you want to change the base?
Conversation
Hi @mitchmindtree @est31 can we get this merged? |
Thanks for the PR @chaosprint! I do agree there could be a case for tweaking this value, though more for tweaking the latency-vs-performance trade-off. Would you mind elaborating on how this change helps to enable use with webaudio or other contexts? Note that, if the audio backend provides buffers of some other size, you can just request audio from the graph multiple times per system audio callback for example. Is there any chance we can use default values for the const generics here to retain the original behaviour by default and not break the API? Or are they not available with const generics yet? |
Hi, thanks for the reply.
I am currently using dasp_graph for my project Glicol, a graph-oriented live coding language. The idea is to convert the code string directly to an audio graph. The glicol.rs is compiled to a wasm file and runs in the browser. Previously, I used the default 64 block size in dasp_graph and called the Besides, I have been running Glicol on Bela, where 64 may be too large to get the full potential of Bela low-latency design.
Thus, I think that it may be hard to find a proper default value for block size, at least for the two cases I mentioned above. Previously I also tried to clone and change the value locally or forked it to different branches but I feel it is not so ergonomic and it may not work for some cases. For example, if a user wishes to create a modular synth project using dasp_graph, it might be good to be able to change the block size in the app (pls correct me if I am wrong here). I am not sure if there is any other way to do it, but as the const generics feature comes to the stable version, I think this graph module might be a good use case for the feature, and users of this library may also be happy and capable enough to tweak the block size. I also think that having the block size specified clear in trait implementation can be helpful for avoiding some errors, especially when we may have different block sizes in different projects.
|
From reading #133 it seems the new release is going to be 0.12, so API breakages should be ok? Am I missing something? |
The graph module uses a fixed length of 64, which limits its usage in many contexts such as web audio.
#![feature(min_const_generics)]
can solve this issue, and will become stable in Rust 1.51rust-lang/rust#79135
Currently tested successful and can be compiled using nightly version of rustc.