diff --git a/src/vst/ivsthostapplication.rs b/src/vst/ivsthostapplication.rs new file mode 100644 index 0000000..3ea35f7 --- /dev/null +++ b/src/vst/ivsthostapplication.rs @@ -0,0 +1,47 @@ +use crate::base::{tchar, tresult, TBool}; +use crate::vst::IMessage; +use vst3_com::interfaces::iunknown::IUnknown; +use vst3_com::{com_interface, IID}; + +#[com_interface("E564A636-6A8B-8CAF-DB2D-496958E595CC")] +pub trait IHostApplication: IUnknown { + unsafe fn get_name(&self, name: tchar) -> tresult; + unsafe fn create_instance( + &self, + cid: *mut IID, + _iid: *mut IID, + obj: *mut *mut c_void, + ) -> tresult; +} + +#[inline] +pub unsafe fn allocate_message(host: *mut dyn IHostApplication) -> Option<*mut dyn IMessage> { + // TODO: Impl the FUID class first for Interface::iid.to_tuid to work + let mut iid: IID = Default::default; + // IMessage::iid.to_tuid(iid); + let m: *mut IMessage = std::ptr::null_mut(); + if (host.createInstance(iid, iid, m as *mut *mut c_void /* or invoke as_mut_ptr()? */) == kResultOk) { + Some(m) + } + None +} + +#[com_interface("61AC6ED3-85BB-7BB9-1D1C-47E229633AEC")] +pub trait IVst3ToVst2Wrapper: IUnknown { } + +#[com_interface("44AA97B6-91B0-0B6F-C095-4688A3B8C6C5")] +pub trait IVst3ToAUWrapper: IUnknown { } + +#[com_interface("C6F4BE93-2CB3-1B95-60C5-62426D319DC6")] +pub trait IVst3ToAAXWrapper: IUnknown { } + +#[com_interface("E39F35F7-0088-50B7-42CF-4BF944149067")] +pub trait IVst3WrapperMPESupport: IUnknown { + unsafe fn enable_mpe_input_processing(&self, state: TBool) -> tresult; + unsafe fn set_mpe_input_device_settings( + &self, + master_channel: i32, + member_begin_channel: i32, + member_end_channel: i32 + ) -> tresult; +} diff --git a/src/vst/ivstinterappaudio.rs b/src/vst/ivstinterappaudio.rs new file mode 100644 index 0000000..24b6a5c --- /dev/null +++ b/src/vst/ivstinterappaudio.rs @@ -0,0 +1,32 @@ +use crate::base::{tresult, TBool}; +use vst3_com::com_interface; +use vst3_com::interfaces::iunknown::IUnknown; + +// Defined elsewhere +struct ViewRect {}; +struct Event {}; + +#[com_interface("FDC8CDE2-28AE-D45B-68DF-415E0CE5743D")] +pub trait IInterAppAudioHost: IUnknown { + unsafe fn get_screen_size(&self, size: *mut ViewRect, scale: *mut f32) -> tresult; + unsafe fn connected_to_host(&self) -> tresult; + unsafe fn switch_to_host(&self) -> tresult; + unsafe fn send_remote_control_event(&self, event: u32) -> tresult; + unsafe fn get_host_icon(&self, icon: *mut *mut c_void) -> tresult; + unsafe fn schedule_event_from_ui(&self, event: &mut Event) -> tresult; + unsafe fn create_preset_manager(&self, cid: *const IID) -> Option<*mut IInterAppAudioPresetManager>; + unsafe fn show_settings_view(&self) -> tresult; +} + +#[com_interface("CFD5D6D7-95B0-B50D-5FC2-4AA16020C72D")] +pub trait IInterAppAudioConnectionNotification: IUnknown { + unsafe fn on_inter_app_audio_connection_state_change(&self, new_state: TBool) -> tresult; +} + +#[com_interface("DDEF3FC9-B4B3-809A-46C9-4E1DADE6FCC4")] +pub trait IInterAppAudioPresetManager: IUnknown { + unsafe fn run_load_preset_browser(&self) -> tresult; + unsafe fn run_save_preset_browser(&self) -> tresult; + unsafe fn load_next_preset(&self) -> tresult; + unsafe fn load_previous_preset(&self) -> tresult; +} diff --git a/src/vst/ivsttestplugprovider.rs b/src/vst/ivsttestplugprovider.rs new file mode 100644 index 0000000..2f9d8ab --- /dev/null +++ b/src/vst/ivsttestplugprovider.rs @@ -0,0 +1,13 @@ +use crate::base::tresult; +use crate::vst::{IComponent, IEditController, IStringResult}; +use vst3_com::com_interface; +use vst3_com::interfaces::iunknown::IUnknown; + +#[com_interface("BAB58FD6-8F97-6E1E-4E99-430F86BE70EE")] +pub trait ITestPlugProvider: IUnknown { + unsafe fn get_component(&self) -> Option<*mut IComponent>; + unsafe fn get_controller(&self) -> Option<*mut IEditController>; + unsafe fn release_plugin(component: *mut IComponent, controller: *mut IEditController) -> tresult; + unsafe const fn get_sub_categories(&self, result: &mut IStringResult) -> tresult; + // unsafe const fn get_component_uid(uid: &mut FUID) -> tresult; TODO: FUID +} diff --git a/src/vst/mod.rs b/src/vst/mod.rs index 3f98e03..90633f8 100644 --- a/src/vst/mod.rs +++ b/src/vst/mod.rs @@ -6,6 +6,8 @@ mod ivstcomponent; mod ivstcontextmenu; mod ivsteditcontroller; mod ivstevents; +mod ivsthostapplication; +mod ivstinterappaudio; mod ivstmessage; mod ivstmidicontroller; mod ivstmidilearn; @@ -17,6 +19,7 @@ mod ivstplugview; mod ivstprefetchablesupport; mod ivstprocesscontext; mod ivstrepresentation; +mod ivsttestplugprovider; mod ivstunits; mod vsttypes; @@ -28,6 +31,8 @@ pub use ivstcomponent::*; pub use ivstcontextmenu::*; pub use ivsteditcontroller::*; pub use ivstevents::*; +pub use ivsthostapplication::*; +pub use ivstinterappaudio::*; pub use ivstmessage::*; pub use ivstmidicontroller::*; pub use ivstmidilearn::*; @@ -39,7 +44,8 @@ pub use ivstplugview::*; pub use ivstprefetchablesupport::*; pub use ivstprocesscontext::*; pub use ivstrepresentation::*; +pub use ivsttestplugprovider::*; pub use ivstunits::*; pub use vsttypes::*; -//todo: ivsttestplugprovider, test/itest vstspeaker.h, +//todo: test/itest vstspeaker.h,