Enum reaper_medium::RegistrationObject
source · [−]pub enum RegistrationObject<'a> {
Show 15 variants
Api(Cow<'a, ReaperStr>, *mut c_void),
ApiDef(Cow<'a, ReaperStr>, *const c_char),
ApiVararg(Cow<'a, ReaperStr>, ApiVararg),
HookCommand(HookCommand),
HookCommand2(HookCommand2),
HookPostCommand(HookPostCommand),
HookPostCommand2(HookPostCommand2),
Timer(TimerFunction),
ToggleAction(ToggleAction),
CommandId(*const c_char),
Gaccel(NonNull<gaccel_register_t>),
BackAccelerator(NonNull<accelerator_register_t>),
FrontAccelerator(NonNull<accelerator_register_t>),
CsurfInst(NonNull<IReaperControlSurface>),
Custom(Cow<'a, ReaperStr>, *mut c_void),
}
Expand description
A thing that you can register at REAPER.
Variants
Api(Cow<'a, ReaperStr>, *mut c_void)
A function that you want to expose to other extensions or plug-ins.
Extract from reaper_plugin_functions.h
:
if you have a function called myfunction(..) that you want to expose to other extensions or
plug-ins, use register("API_myfunction",funcaddress), and "-API_myfunction" to remove.
Other extensions then use GetFunc("myfunction") to get the function pointer.
REAPER will also export the function address to ReaScript, so your extension could supply
a Python module that provides a wrapper called RPR_myfunction(..).
ApiDef(Cow<'a, ReaperStr>, *const c_char)
A function definition that describes a function registered via Api
.
Extract from reaper_plugin_functions.h
:
register("APIdef_myfunction",defstring) will include your function declaration and help
in the auto-generated REAPER API header and ReaScript documentation.
defstring is four null-separated fields: return type, argument types, argument names, and
help. Example: double myfunction(char* str, int flag) would have
defstring="double\0char*,int\0str,flag\0help text for myfunction"
ApiVararg(Cow<'a, ReaperStr>, ApiVararg)
A var-arg function for exposing a function to ReaScript.
HookCommand(HookCommand)
A hook command.
Extract from reaper_plugin_functions.h
:
another thing you can register is "hookcommand", which you pass a callback:
NON_API: bool runCommand(int command, int flag);
register("hookcommand",runCommand);
which returns TRUE to eat (process) the command.
flag is usually 0 but can sometimes have useful info depending on the message.
note: it's OK to call Main_OnCommand() within your runCommand, however you MUST check for
recursion if doing so! > in fact, any use of this hook should benefit from a simple
reentrancy test...
HookCommand2(HookCommand2)
A hook command that supports MIDI CC/mousewheel actions.
Extract from reaper_plugin_functions.h
:
you can also register "hookcommand2", which you pass a callback:
NON_API: bool onAction(KbdSectionInfo *sec, int command, int val, int valhw, int relmode,
HWND hwnd); register("hookcommand2",onAction);
which returns TRUE to eat (process) the command.
val/valhw are used for actions learned with MIDI/OSC.
val = [0..127] and valhw = -1 for MIDI CC,
valhw >=0 for MIDI pitch or OSC with value = (valhw|val<<7)/16383.0,
relmode absolute(0) or 1/2/3 for relative adjust modes
HookPostCommand(HookPostCommand)
A hook post command.
Extract from reaper_plugin_functions.h
:
to get notified when an action of the main section is performed,
you can register "hookpostcommand", which you pass a callback:
NON_API: void postCommand(int command, int flag);
register("hookpostcommand",postCommand);
HookPostCommand2(HookPostCommand2)
A hook post command 2.
Timer(TimerFunction)
A timer.
ToggleAction(ToggleAction)
A toggle action.
Extract from reaper_plugin.h
:
register("toggleaction", toggleactioncallback) lets you register a callback function
that is called to check if an action registered by an extension has an on/off state.
callback function:
int toggleactioncallback(int command_id);
return:
-1=action does not belong to this extension, or does not toggle
0=action belongs to this extension and is currently set to "off"
1=action belongs to this extension and is currently set to "on"
CommandId(*const c_char)
A command ID for the given command name.
Extract from reaper_plugin_functions.h
:
you can also register command IDs for actions,
register with "command_id", parameter is a unique string with only A-Z, 0-9,
returns command ID (or 0 if not supported/out of actions)
Gaccel(NonNull<gaccel_register_t>)
An action description and shortcut.
Extract from reaper_plugin.h
:
gaccel_register_t allows you to register ("gaccel") an action into the main keyboard
section action list, and at the same time a default binding for it (accel.cmd is the
command ID, desc is the description, and accel's other parameters are the key to bind.
BackAccelerator(NonNull<accelerator_register_t>)
A record which lets you get a place in the keyboard processing queue.
FrontAccelerator(NonNull<accelerator_register_t>)
A record which lets you get the first place in the keyboard processing queue.
CsurfInst(NonNull<IReaperControlSurface>)
A hidden control surface (useful for being notified by REAPER about events).
Extract from reaper_plugin.h
:
note you can also add a control surface behind the scenes with "csurf_inst"
(IReaperControlSurface*)instance
Custom(Cow<'a, ReaperStr>, *mut c_void)
If a variant is missing in this enum, you can use this custom one as a resort.
Use custom()
to create this variant.
Implementations
sourceimpl<'a> RegistrationObject<'a>
impl<'a> RegistrationObject<'a>
sourcepub fn api(
func_name: impl Into<ReaperStringArg<'a>>,
func: *mut c_void
) -> RegistrationObject<'a>
pub fn api(
func_name: impl Into<ReaperStringArg<'a>>,
func: *mut c_void
) -> RegistrationObject<'a>
Convenience function for creating an Api
registration object.
sourcepub fn api_def(
func_name: impl Into<ReaperStringArg<'a>>,
func_def: *const c_char
) -> RegistrationObject<'a>
pub fn api_def(
func_name: impl Into<ReaperStringArg<'a>>,
func_def: *const c_char
) -> RegistrationObject<'a>
Convenience function for creating an ApiDef
registration object.
sourcepub fn api_vararg(
func_name: impl Into<ReaperStringArg<'a>>,
func: ApiVararg
) -> RegistrationObject<'a>
pub fn api_vararg(
func_name: impl Into<ReaperStringArg<'a>>,
func: ApiVararg
) -> RegistrationObject<'a>
Convenience function for creating an ApiVararg
registration object.
sourcepub fn custom(
key: impl Into<ReaperStringArg<'a>>,
info_struct: *mut c_void
) -> RegistrationObject<'a>
pub fn custom(
key: impl Into<ReaperStringArg<'a>>,
info_struct: *mut c_void
) -> RegistrationObject<'a>
Convenience function for creating a Custom
registration object.
Trait Implementations
sourceimpl<'a> Clone for RegistrationObject<'a>
impl<'a> Clone for RegistrationObject<'a>
sourcefn clone(&self) -> RegistrationObject<'a>
fn clone(&self) -> RegistrationObject<'a>
1.0.0 · sourceconst fn clone_from(&mut self, source: &Self)
const fn clone_from(&mut self, source: &Self)
source
. Read moresourceimpl<'a> Debug for RegistrationObject<'a>
impl<'a> Debug for RegistrationObject<'a>
sourceimpl<'a> Hash for RegistrationObject<'a>
impl<'a> Hash for RegistrationObject<'a>
sourceimpl<'a> PartialEq<RegistrationObject<'a>> for RegistrationObject<'a>
impl<'a> PartialEq<RegistrationObject<'a>> for RegistrationObject<'a>
sourcefn eq(&self, other: &RegistrationObject<'a>) -> bool
fn eq(&self, other: &RegistrationObject<'a>) -> bool
impl<'a> Eq for RegistrationObject<'a>
impl<'a> StructuralEq for RegistrationObject<'a>
impl<'a> StructuralPartialEq for RegistrationObject<'a>
Auto Trait Implementations
impl<'a> RefUnwindSafe for RegistrationObject<'a>
impl<'a> !Send for RegistrationObject<'a>
impl<'a> !Sync for RegistrationObject<'a>
impl<'a> Unpin for RegistrationObject<'a>
impl<'a> UnwindSafe for RegistrationObject<'a>
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