2022-02-08 22:32:54 +01:00
|
|
|
#[macro_use]
|
|
|
|
mod util;
|
2022-01-26 18:14:54 +01:00
|
|
|
|
2022-02-06 18:51:46 +01:00
|
|
|
mod context;
|
2022-02-08 22:32:54 +01:00
|
|
|
mod factory;
|
2022-02-06 17:50:15 +01:00
|
|
|
mod inner;
|
2022-04-08 17:49:13 +02:00
|
|
|
mod note_expressions;
|
2022-03-16 20:09:38 +01:00
|
|
|
mod param_units;
|
2022-02-06 18:46:16 +01:00
|
|
|
mod view;
|
2022-02-08 22:28:18 +01:00
|
|
|
mod wrapper;
|
2022-02-06 17:40:35 +01:00
|
|
|
|
2022-01-26 19:19:20 +01:00
|
|
|
/// Re-export for the wrapper.
|
2022-02-08 22:32:54 +01:00
|
|
|
pub use factory::Factory;
|
2022-01-26 22:23:44 +01:00
|
|
|
|
2022-01-27 22:13:13 +01:00
|
|
|
/// Export a VST3 plugin from this library using the provided plugin type.
|
2022-01-26 12:37:45 +01:00
|
|
|
#[macro_export]
|
|
|
|
macro_rules! nih_export_vst3 {
|
2022-01-27 22:13:13 +01:00
|
|
|
($plugin_ty:ty) => {
|
2022-01-26 18:14:54 +01:00
|
|
|
#[no_mangle]
|
|
|
|
pub extern "system" fn GetPluginFactory() -> *mut ::std::ffi::c_void {
|
2022-01-27 22:13:13 +01:00
|
|
|
let factory = ::nih_plug::wrapper::vst3::Factory::<$plugin_ty>::new();
|
2022-01-26 18:14:54 +01:00
|
|
|
|
|
|
|
Box::into_raw(factory) as *mut ::std::ffi::c_void
|
|
|
|
}
|
|
|
|
|
2022-01-26 12:37:45 +01: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")))]
|
2022-01-26 18:14:54 +01:00
|
|
|
pub extern "C" fn ModuleEntry(_lib_handle: *mut ::std::ffi::c_void) -> bool {
|
2022-04-24 15:24:35 +02:00
|
|
|
::nih_plug::wrapper::setup_logger();
|
2022-01-26 12:37:45 +01: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")]
|
2022-01-26 18:14:54 +01:00
|
|
|
pub extern "C" fn bundleEntry(_lib_handle: *mut ::std::ffi::c_void) -> bool {
|
2022-04-24 15:24:35 +02:00
|
|
|
::nih_plug::wrapper::setup_logger();
|
2022-01-26 12:37:45 +01: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-06 23:37:40 +01:00
|
|
|
pub extern "system" fn InitDll() -> bool {
|
2022-04-24 15:24:35 +02:00
|
|
|
::nih_plug::wrapper::setup_logger();
|
2022-01-26 12:37:45 +01:00
|
|
|
true
|
|
|
|
}
|
|
|
|
|
|
|
|
#[no_mangle]
|
|
|
|
#[cfg(target_os = "windows")]
|
2022-02-06 23:37:40 +01:00
|
|
|
pub extern "system" fn ExitDll() -> bool {
|
2022-01-26 12:37:45 +01:00
|
|
|
true
|
|
|
|
}
|
|
|
|
};
|
|
|
|
}
|