Struct rea_rs::PluginContext
source · [−]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
sourceimpl 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 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
sourceimpl Clone for PluginContext
impl Clone for PluginContext
sourcefn clone(&self) -> PluginContext
fn clone(&self) -> PluginContext
1.0.0 · sourceconst fn clone_from(&mut self, source: &Self)
const fn clone_from(&mut self, source: &Self)
source
. Read moresourceimpl Debug for PluginContext
impl Debug for PluginContext
sourceimpl PartialEq<PluginContext> for PluginContext
impl PartialEq<PluginContext> for PluginContext
sourcefn eq(&self, other: &PluginContext) -> bool
fn eq(&self, other: &PluginContext) -> bool
impl Copy for PluginContext
impl Eq for PluginContext
impl Send for PluginContext
impl StructuralEq for PluginContext
impl StructuralPartialEq for PluginContext
Auto Trait Implementations
impl RefUnwindSafe for PluginContext
impl !Sync for PluginContext
impl Unpin for PluginContext
impl UnwindSafe for PluginContext
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
sourceimpl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
sourcefn into_any(self: Box<T, Global>) -> Box<dyn Any + 'static, Global>
fn into_any(self: Box<T, Global>) -> Box<dyn Any + 'static, Global>
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
. Read moresourcefn into_any_rc(self: Rc<T>) -> Rc<dyn Any + 'static>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any + 'static>
Rc<Trait>
(where Trait: Downcast
) to Rc<Any>
. Rc<Any>
can then be
further downcast
into Rc<ConcreteType>
where ConcreteType
implements Trait
. Read moresourcefn 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. Read moresourcefn 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. Read more