pub struct PluginContext { /* private fields */ }
Expand description
This represents the context which is needed to access REAPER functions from plug-ins.
Once obtained, it is supposed to be passed to Reaper::load()
.
Implementations§
Source§impl PluginContext
impl PluginContext
Sourcepub unsafe fn from_extension_plugin(
h_instance: *mut c_void,
rec: reaper_plugin_info_t,
static_context: StaticExtensionPluginContext,
) -> Result<PluginContext, ContextFromExtensionPluginError>
pub unsafe fn from_extension_plugin( h_instance: *mut c_void, rec: reaper_plugin_info_t, static_context: StaticExtensionPluginContext, ) -> Result<PluginContext, ContextFromExtensionPluginError>
Creates a plug-in context from an extension entry point plug-in info.
It requires a module handle and the pointer to a
reaper_plugin_info_t
struct. REAPER provides both when calling
the ReaperPluginEntry
function (the main entry point for
any extension plug-in).
It’s recommended to use the reaper_extension_plugin
macro in the
reaper-macros crate instead of calling
this function directly.
§Errors
Returns an error if the given plug-in info is not suitable for loading REAPER functions.
§Safety
REAPER can crash if you pass an invalid pointer.
Sourcepub fn from_vst_plugin(
host: &HostCallback,
static_context: StaticVstPluginContext,
) -> Result<PluginContext, ContextFromVstPluginError>
pub fn from_vst_plugin( host: &HostCallback, static_context: StaticVstPluginContext, ) -> Result<PluginContext, ContextFromVstPluginError>
Sourcepub unsafe fn GetFunc(&self, name: *const i8) -> *mut c_void
pub unsafe fn GetFunc(&self, name: *const i8) -> *mut c_void
Returns a generic API function by its name.
§Safety
REAPER can crash if you pass an invalid pointer.
Sourcepub fn h_instance(&self) -> *mut c_void
pub fn h_instance(&self) -> *mut c_void
On Windows, this returns the HINSTANCE
passed to DllMain
(VST
plug-ins) or ReaperPluginEntry
(extension plug-ins).
The returned HINSTANCE
represents the handle of the module (DLL)
containing the plug-in.
On Linux, this returns null
.
Sourcepub fn swell_function_provider(
&self,
) -> Option<unsafe extern "C" fn(*const i8) -> *mut c_void>
pub fn swell_function_provider( &self, ) -> Option<unsafe extern "C" fn(*const i8) -> *mut c_void>
On Linux, this returns a pointer to a function for getting a generic SWELL API function by its name.
On Windows, this returns None
.
Sourcepub fn type_specific(&self) -> &TypeSpecificPluginContext
pub fn type_specific(&self) -> &TypeSpecificPluginContext
Returns the type-specific plug-in context.
Sourcepub fn is_in_main_thread(&self) -> bool
pub fn is_in_main_thread(&self) -> bool
Returns whether we are currently in the main thread.
Trait Implementations§
Source§impl Clone for PluginContext
impl Clone for PluginContext
Source§fn clone(&self) -> PluginContext
fn clone(&self) -> PluginContext
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreSource§impl Debug for PluginContext
impl Debug for PluginContext
Source§impl PartialEq for PluginContext
impl PartialEq for PluginContext
impl Copy for PluginContext
impl Eq for PluginContext
impl Send for PluginContext
impl StructuralPartialEq for PluginContext
Auto Trait Implementations§
impl Freeze for PluginContext
impl RefUnwindSafe for PluginContext
impl !Sync for PluginContext
impl Unpin for PluginContext
impl UnwindSafe for PluginContext
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait>
(where Trait: Downcast
) to Box<dyn Any>
. Box<dyn Any>
can
then be further downcast
into Box<ConcreteType>
where ConcreteType
implements Trait
.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait>
(where Trait: Downcast
) to Rc<Any>
. Rc<Any>
can then be
further downcast
into Rc<ConcreteType>
where ConcreteType
implements Trait
.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &Any
’s vtable from &Trait
’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &mut Any
’s vtable from &mut Trait
’s.