mod-audio / mod-plugin-builder

MOD Plugin Builder
79 stars 50 forks source link

Add new dm plugins #184

Closed davemollen closed 1 month ago

davemollen commented 3 months ago

Within this pull request I would like to add a set of 14 plugins. If you prefer to handle them in separate pull requests that would be fine too. Just let me know.

The plugins are written in Rust and some of them depend on the nightly Rust version. (Because generic simd instructions are only available on nightly.) I decided to build the plugins that don't need the nightly version with the stable version. The nightly version is pinned to a specific date for predictability. I'm not sure if that's needed, we could also change this to the latest version. And we could also build everything with nightly instead of stable. I'm open to suggestions on this matter.

falkTX commented 1 month ago

Very nice, so many new plugins.

But I am not liking depending on nightly releases, you only need it for the simd functions or is there more to it?

In my view a way to proceed would be to assume the stable toolchain, and only deal with nightly for the plugins that need it. The mk for such plugins would need to have a pre-build step that picks the nightly version, then post-build that reverts the local toolchain changes, instead of each mk file picking the toolchain version. I checked buildroot documentation and while there is a configure step, there is no post-build cleanup step. So my recommendation would be to do it all within the build command, give it a empty line as separator to be clean.

Since these plugins are written in rust I dont have to worry about random crashes so much, so they get an exception for going faster on the store. If you handle the changes I request above I can quickly push them to beta so we get more testers. Then just let me know once a specific plugin is deemed stable in your opinion, I can do some final testing and push it to stable on the store.

PS: do you know if your plugins should be able to be built for windows and macos too? wondering about adding them to MOD Desktop...

davemollen commented 1 month ago

Hi, thanks for the suggestions! The last two commits implement the changes you requested. Please have a look if this looks correct.

About builds for MOD Desktop, it looks like it can't compile on macOS. I'll check the rust audio discord for some more info on this.

davemollen commented 1 month ago

I can build lv2 plugins on my mac machine now. I had to add some C bindings to the rust-lv2 package for macOS specifically. But the plugin won't load on MOD Desktop yet. I remember that for the MOD device builds you had to build with the custom glibc toolchain instead of the precompiled rust toolchain. Is something like that required for Desktop too?

I'm willing to help with the desktop builds. But I understand if you don't want to give this attention now.

falkTX commented 1 month ago

Hi, thanks for the suggestions! The last two commits implement the changes you requested. Please have a look if this looks correct.

Looks good to me! Should I push these to beta then?

I need to add the nightly toolchain to the cloud builders, so I can't add the plugins that need that just yet. But should happen fairly soon, 1.13.5 is coming soon which needs some updates, I can throw this in together with it.

I can build lv2 plugins on my mac machine now. I had to add some C bindings to the rust-lv2 package for macOS specifically. But the plugin won't load on MOD Desktop yet. I remember that for the MOD device builds you had to build with the custom glibc toolchain instead of the precompiled rust toolchain. Is something like that required for Desktop too?

No special toolchain needed on macOS builds, but mod-desktop is built with 10.15 compatibility in mind. Can you describe the steps you took?

falkTX commented 1 month ago

I pushed the plugins that dont need nightly toolchain into stable

davemollen commented 1 month ago

That's great, thanks!

I got the desktop plugin build working on my mac machine. The problem was that I forgot to change the lv2 binary extension to dylib in the manifest.ttl file. For all plugins I need to update the rust-lv2 dependency to a fork that includes the macOS bindings to make them buildable on macOS. I can do that, no problem.

And... does the mac binary need to be a universal binary? Not sure if it's of any use to you, but here's how I created the universal mac binary:

#!/bin/bash
binary_name="libdm_space_echo.dylib"

cd lv2
rustup target add aarch64-apple-darwin
MACOSX_DEPLOYMENT_TARGET=10.15 cargo build --release --target x86_64-apple-darwin
MACOSX_DEPLOYMENT_TARGET=10.15 cargo build --release --target aarch64-apple-darwin
lipo -create target/x86_64-apple-darwin/release/$binary_name target/aarch64-apple-darwin/release/$binary_name -output target/release/$binary_name
file target/release/$binary_name

If you could use more work on this. I'd be happy to help. Surely I'm available if you need more information.

falkTX commented 1 month ago

that is very useful! and yes for macOS the builds are meant to be arm+intel universal. I need to see how to build the plugins for windows and linux too, but those are likely simpler. hopefully the rust compiler works under wine...

what is the state of the rust-lv2 stuff? is it a PR to be merged soon or not submitted yet? maybe not possible?

davemollen commented 1 month ago

Well, it doesn't look great. I'm afraid there's no active maintainer anymore. So forking isn't such a bad choice. It seems the largest part of the community gravitates to other plugin formats.

I'm gonna try and garner some more interest and hopefully get some other collaborators from the community to keep that crate going.