Skip to main content

Plugin

Trait Plugin 

Source
pub trait Plugin: 'static {
    type AudioProcessor<'a>: PluginAudioProcessor<'a, Self::Shared<'a>, Self::MainThread<'a>>;
    type Shared<'a>: PluginShared<'a>;
    type MainThread<'a>: PluginMainThread<'a, Self::Shared<'a>>;

    // Provided method
    fn declare_extensions(
        builder: &mut PluginExtensions<'_, Self>,
        shared: Option<&Self::Shared<'_>>,
    ) { ... }
}
Expand description

The main trait required to implement a CLAP plugin.

Types implementing this trait are never instantiated and are not meant to contain any data.

Their purpose is to tie together the various subtypes that will be instantiated and live across different threads.

§Plugin instantiation

Plugin instantiation and initialization is not covered by this trait. The Shared and MainThread components are created from a PluginFactory implementation (in PluginFactory::create_plugin) using the PluginInstance::new method.

Alternatively, if custom PluginFactory and Entry implementations are not needed, one can use a SinglePluginEntry and implement its companion trait DefaultPluginFactory to implement the instantiation instead.

Required Associated Types§

Source

type AudioProcessor<'a>: PluginAudioProcessor<'a, Self::Shared<'a>, Self::MainThread<'a>>

The type holding the plugin’s data and operations that belong to the audio thread.

See the module documentation for more information on the thread model.

Source

type Shared<'a>: PluginShared<'a>

The type holding the plugin’s thread-safe data and operations.

If not needed, the empty () type can be used instead.

See the module documentation for more information on the thread model.

Source

type MainThread<'a>: PluginMainThread<'a, Self::Shared<'a>>

The type holding the plugin’s data and operations that belong to the main thread.

If not needed, the empty () type can be used instead.

See the module documentation for more information on the thread model.

Provided Methods§

Source

fn declare_extensions( builder: &mut PluginExtensions<'_, Self>, shared: Option<&Self::Shared<'_>>, )

Declares the extensions this plugin supports.

This is implemented by calling register on the given PluginExtensions builder for every extension type that is supported.

A reference to the Shared type is also given. However, it can be None, as the host is allowed to query extensions before the plugin has finished initializing.

Dyn Compatibility§

This trait is not dyn compatible.

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

Implementors§