VST3 C API
-
- KVRer
- Topic Starter
- 9 posts since 13 Nov, 2022
Hey all, currently messing around with writing a plugin using Zig (https://ziglang.org/), so far I've just been using CLAP because the API is really clean and easy to implement, but I'd like to also be able to compile the plugin as a VST3 for compatibility reasons. I was wondering if anyone has actually tried implementing the VST3 C API Steinberg put out last year (https://github.com/steinbergmedia/vst3_ ... ree/master), it seems to be a pretty heinous mess of manual vtable setups and stuff. I'd really like to have my whole codebase just in Zig, and having to write a C++ wrapper that just consumes my CLAP plugin seems overkill. Anyways any resources/advice on this welcome. Feel free to tell me this is a horrible miserable idea as well
- KVRist
- 91 posts since 24 Dec, 2015 from Bristol, UK
It looks like it would be cumbersome. Given that the VST3 SDK has been annotated so that a tool can process the C++ API and produce the single file C API. It should be possible to write a similar tool to create a cleaner single file C++ API based on the source code for the C generator. That could lead to a good outcome and possibly within the VST3 licensing terms...
- KVRian
- 1260 posts since 31 Dec, 2008
There is a clap wrapper: https://github.com/free-audio/clap-wrapper
www.solostuff.net
Advice is heavy. So don’t send it like a mountain.
Advice is heavy. So don’t send it like a mountain.
-
- KVRer
- Topic Starter
- 9 posts since 13 Nov, 2022
I'm not sure I follow? Are suggesting that it would be easier to generate my own C API than to use the one generated by Steinberg? Also what licensing benefits would that have?keithwood wrote: ↑Fri Dec 22, 2023 11:19 am It looks like it would be cumbersome. Given that the VST3 SDK has been annotated so that a tool can process the C++ API and produce the single file C API. It should be possible to write a similar tool to create a cleaner single file C++ API based on the source code for the C generator. That could lead to a good outcome and possibly within the VST3 licensing terms...
Yeah I'm familiar with this although there's no documentation right now on how to get it to spit out a fully packaged up VST3, the only option with documentation is creating a VST3 that dynamically loads the CLAP shared library. Also the bigger reason for avoiding this is adding a C++ dependency in my codebase, although frankly it seems like that might be unavoidable given how poorly documented the C API is.S0lo wrote: ↑Fri Dec 22, 2023 11:28 am There is a clap wrapper: https://github.com/free-audio/clap-wrapper
- KVRist
- 91 posts since 24 Dec, 2015 from Bristol, UK
I was assuming that you don't really want to write everything in C but are yearning for a simple VST3 interface. If you do want to write everything in C, ignore mesuperelectric wrote: ↑Fri Dec 22, 2023 1:25 pmI'm not sure I follow? Are suggesting that it would be easier to generate my own C API than to use the one generated by Steinberg? Also what licensing benefits would that have?keithwood wrote: ↑Fri Dec 22, 2023 11:19 am It looks like it would be cumbersome. Given that the VST3 SDK has been annotated so that a tool can process the C++ API and produce the single file C API. It should be possible to write a similar tool to create a cleaner single file C++ API based on the source code for the C generator. That could lead to a good outcome and possibly within the VST3 licensing terms...
-
- KVRer
- Topic Starter
- 9 posts since 13 Nov, 2022
You're correct that I'm not planning on writing it in C . The plan is to write it in Zig, which has really good C interop. It means that with something like CLAP (which is just a C API), I can do:
Code: Select all
const c = @cImport({
@cInclude("clap.h");
});
- KVRAF
- 15313 posts since 8 Mar, 2005 from Utrecht, Holland
-
- KVRer
- Topic Starter
- 9 posts since 13 Nov, 2022
I don't think there's Zig bindings for JUCE, and even so I don't love taking on such a big dependency. I might wrap the CLAP plugin in a JUCE app for the time being, just so that I can test in DAWs that don't support CLAP yet. But long term I'd like to be providing my own backends for whatever plugin formats I choose to support (this is less of a business decision and more because it appeals to the hacker within me ).
- KVRist
- 91 posts since 24 Dec, 2015 from Bristol, UK
Gotcha. A useful reference might be the port of the VST3 API in Rust: https://github.com/RustAudio/vst3-syssuperelectric wrote: ↑Fri Dec 22, 2023 6:18 pm You're correct that I'm not planning on writing it in C . The plan is to write it in Zig, which has really good C interop. It means that with something like CLAP (which is just a C API), I can do:Code: Select all
const c = @cImport({ @cInclude("clap.h"); });
There's a good example of how a plugin is put together from the COM interfaces:https://github.com/RustAudio/vst3-sys/b ... src/lib.rs
-
- KVRer
- Topic Starter
- 9 posts since 13 Nov, 2022
That's super helpful, looking forward to digging in. Thanks so much!keithwood wrote: ↑Fri Dec 22, 2023 8:52 pmGotcha. A useful reference might be the port of the VST3 API in Rust: https://github.com/RustAudio/vst3-syssuperelectric wrote: ↑Fri Dec 22, 2023 6:18 pm You're correct that I'm not planning on writing it in C . The plan is to write it in Zig, which has really good C interop. It means that with something like CLAP (which is just a C API), I can do:Code: Select all
const c = @cImport({ @cInclude("clap.h"); });
There's a good example of how a plugin is put together from the COM interfaces:https://github.com/RustAudio/vst3-sys/b ... src/lib.rs