Frando / rust-faust

Easily use FAUST DSPs in Rust
Apache License 2.0
56 stars 12 forks source link

libfaust (LLVM) support? #22

Open YPares opened 8 months ago

YPares commented 8 months ago

Hi! I'm working on a plugin that loads DSPs using the llvm backend ( https://github.com/YPares/nih-faust-jit ). I knew about rust-faust from the start, but given my specific needs (and also as a learning process) I ended up rewriting an ad-hoc wrapper for libfaust myself (based on bindgen), both for loading DSPs and creating their GUIs. Now that I have a better idea of how to use libfaust as part of a Rust project, would you be interested in a PR to rust-faust to add support for the llvm backend?

obsoleszenz commented 8 months ago

I think it would be nice! Also for hot reloading this could be quite cool. I myself stopped using faust-state but having faust-llvm parallel to faust-build and a maybe a layer on top if needed could be nice.

Do you have an idea how this could be integrated or how this could look like?

YPares commented 8 months ago

@obsoleszenz faust-states is for representing in Rust datastructures the internal state of a DSP, right?

I think implementing faust-types with llvm-based DSPs should be the way to go, and it shouldn't be too hard to it for any dsp (the abstract faust class). The wrappers in my project are a bit higher-level for now (because the fewer functions to bind, the easier). The major question is the build. I link with a system-installed libfaust, maybe building it as part of a new faust-llvm crate might be simpler and more OS-agnostic.

obsoleszenz commented 8 months ago

Hmmm i think for building it would be nice to statically link against faust + llvm. But not exactly sure how to do it.

sletz commented 8 months ago

faust-llvm @YPares do you mean this system level crate that would embed the libfaust binaries themselves ?

YPares commented 8 months ago

@sletz That's what I meant, yes. libfaust is not super heavy, so it may be worth it, in order to make the build process simpler (at least on some OSs with no decent package managers...).

YPares commented 7 months ago

I've split the faust llvm logic on https://github.com/YPares/nih-faust-jit in a separate faust_jit crate (which would be roughly equivalent to that sys crate we were talking about, though the API isn't changed yet to be more aligned with what rust-faust expects). But that makes it reusable already. Drawing the DSP widgets with egui is also done by a separate faust_jit_egui crate.