1
0
Fork 0
nih-plug/src/wrapper/vst3.rs
2022-02-12 16:04:46 +01:00

71 lines
2.3 KiB
Rust

#[macro_use]
mod util;
mod context;
mod factory;
mod inner;
mod view;
mod wrapper;
/// Re-export for the wrapper.
pub use factory::Factory;
/// Export a VST3 plugin from this library using the provided plugin type.
#[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
// 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 {
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 {
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")]
pub extern "system" fn InitDll() -> bool {
true
}
#[no_mangle]
#[cfg(target_os = "windows")]
pub extern "system" fn ExitDll() -> bool {
true
}
};
}