Skip to main content

GuiContextInner

Trait GuiContextInner 

Source
pub trait GuiContextInner:
    Send
    + Sync
    + 'static {
    // Required methods
    fn plugin_api(&self) -> PluginApi;
    unsafe fn raw_begin_set_parameter(&self, param: ParamPtr);
    unsafe fn raw_set_parameter_normalized(
        &self,
        param: ParamPtr,
        normalized: f32,
    );
    unsafe fn raw_end_set_parameter(&self, param: ParamPtr);
    fn get_state(&self) -> PluginState;
    fn set_state(&self, state: PluginState);
}
Expand description

Callbacks the plugin can make when the user interacts with its GUI such as updating parameter values. This is passed to the plugin during Editor::spawn(). All of these functions assume they’re being called from the main GUI thread.

Required Methods§

Source

fn plugin_api(&self) -> PluginApi

Get the current plugin API. This may be useful to display in the plugin’s GUI as part of an about screen.

Source

unsafe fn raw_begin_set_parameter(&self, param: ParamPtr)

Inform the host a parameter will be automated. Create a ParamSetter and use ParamSetter::begin_set_parameter() instead for a safe, user friendly API.

§Safety

The implementing function still needs to check if param actually exists. This function is mostly marked as unsafe for API reasons.

Source

unsafe fn raw_set_parameter_normalized(&self, param: ParamPtr, normalized: f32)

Inform the host a parameter is being automated with an already normalized value. Create a ParamSetter and use ParamSetter::set_parameter() instead for a safe, user friendly API.

§Safety

The implementing function still needs to check if param actually exists. This function is mostly marked as unsafe for API reasons.

Source

unsafe fn raw_end_set_parameter(&self, param: ParamPtr)

Inform the host a parameter has been automated. Create a ParamSetter and use ParamSetter::end_set_parameter() instead for a safe, user friendly API.

§Safety

The implementing function still needs to check if param actually exists. This function is mostly marked as unsafe for API reasons.

Source

fn get_state(&self) -> PluginState

Serialize the plugin’s current state to a serde-serializable object. Useful for implementing preset handling within a plugin’s GUI.

Source

fn set_state(&self, state: PluginState)

Restore the state from a previously serialized state object. This will block the GUI thread until the state has been restored and a parameter value rescan has been requested from the host. If the plugin is currently processing audio, then the parameter values will be restored at the end of the current processing cycle.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§