1
0
Fork 0
nih-plug/src/wrapper/vst3.rs

71 lines
2.3 KiB
Rust
Raw Normal View History

#[macro_use]
mod util;
mod context;
mod factory;
mod inner;
2022-02-07 04:46:16 +11:00
mod view;
2022-02-09 08:28:18 +11:00
mod wrapper;
/// Re-export for the wrapper.
pub use factory::Factory;
/// Export a VST3 plugin from this library using the provided plugin type.
2022-01-26 22:37:45 +11:00
#[macro_export]
macro_rules! nih_export_vst3 {
($plugin_ty:ty) => {
#[no_mangle]
pub extern "system" fn GetPluginFactory() -> *mut ::std::ffi::c_void {
let factory = ::nih_plug::wrapper::vst3::Factory::<$plugin_ty>::new();
Box::into_raw(factory) as *mut ::std::ffi::c_void
}
// We don't need any special initialization logic, so all of these module entry point
// functions just return true all the time
2022-01-26 22:37:45 +11:00
// These two entry points are used on Linux, and they would theoretically also be used on
// the BSDs:
// https://github.com/steinbergmedia/vst3_public_sdk/blob/c3948deb407bdbff89de8fb6ab8500ea4df9d6d9/source/main/linuxmain.cpp#L47-L52
#[no_mangle]
#[cfg(all(target_family = "unix", not(target_os = "macos")))]
pub extern "C" fn ModuleEntry(_lib_handle: *mut ::std::ffi::c_void) -> bool {
2022-01-26 22:37:45 +11:00
true
}
#[no_mangle]
#[cfg(all(target_family = "unix", not(target_os = "macos")))]
pub extern "C" fn ModuleExit() -> bool {
true
}
// These two entry points are used on macOS:
// https://github.com/steinbergmedia/vst3_public_sdk/blob/bc459feee68803346737901471441fd4829ec3f9/source/main/macmain.cpp#L60-L61
#[no_mangle]
#[cfg(target_os = "macos")]
pub extern "C" fn bundleEntry(_lib_handle: *mut ::std::ffi::c_void) -> bool {
2022-01-26 22:37:45 +11:00
true
}
#[no_mangle]
#[cfg(target_os = "macos")]
pub extern "C" fn bundleExit() -> bool {
true
}
// And these two entry points are used on Windows:
// https://github.com/steinbergmedia/vst3_public_sdk/blob/bc459feee68803346737901471441fd4829ec3f9/source/main/dllmain.cpp#L59-L60
#[no_mangle]
#[cfg(target_os = "windows")]
2022-02-07 09:37:40 +11:00
pub extern "system" fn InitDll() -> bool {
2022-01-26 22:37:45 +11:00
true
}
#[no_mangle]
#[cfg(target_os = "windows")]
2022-02-07 09:37:40 +11:00
pub extern "system" fn ExitDll() -> bool {
2022-01-26 22:37:45 +11:00
true
}
};
}