Skip to main content

StoppedPluginAudioProcessor

Struct StoppedPluginAudioProcessor 

Source
pub struct StoppedPluginAudioProcessor<H: HostHandlers> { /* private fields */ }
Expand description

A handle to a plugin’s audio processor that is in the stopped state.

This is the default state the plugin’s audio processor will be in after calling activate.

A host needs to call start_processing before it can call the process method to process audio and events.

This type is generic over the HostHandlers type that was used to create the plugin instance. The shared and audio processor handlers can be accessed with the access_shared_handler, access_handler and access_handler_mut methods.

Note that in order to maintain thread-safety, this type must be either dropped or stopped and passed to either PluginInstance::deactivate or PluginInstance::deactivate_with, before the PluginInstance itself is dropped. If this is not done, the plugin instance will never be deactivated or destroyed, and will leak all its associated resources.

Implementations§

Source§

impl<H: HostHandlers> StoppedPluginAudioProcessor<H>

Source

pub fn reset(&mut self)

Resets the plugin’s audio processing state.

This clears all the plugin’s internal buffers, kills all voices, and resets all processing state such as envelopes, LFOs, oscillators, filters, etc.

Calling this method allows the steady_time parameter passed to process to jump backwards.

Source

pub fn start_processing( self, ) -> Result<StartedPluginAudioProcessor<H>, ProcessingStartError<H>>

Indicates to the plugin that continuous processing is about to start.

Calling this is required in order to be able to call the process method to process audio and events.

If this succeeds, this returns an audio processor in the started state.

§Errors

This method can fail if the underlying plugin’s implementation fails for any reason. In this case, a ProcessingStartError is returned, from which the stopped audio processor can be recovered.

Source

pub fn access_shared_handler<'s, R>( &'s self, access: impl for<'a> FnOnce(&'s <H as HostHandlers>::Shared<'a>) -> R, ) -> R

Accesses the SharedHandler for this instance, using the provided closure.

This function returns the return value of the provided closure directly.

Note that the lifetime of the SharedHandler cannot be statically known, as it is bound to the plugin instance itself.

Unlike access_handler and access_handler_mut, there is no way to obtain a mutable reference to the SharedHandler, as it may be concurrently accessed by other threads.

Source

pub fn access_handler<'s, R>( &'s self, access: impl for<'a> FnOnce(&'s <H as HostHandlers>::AudioProcessor<'a>) -> R, ) -> R

Accesses the AudioProcessorHandler for this instance, using the provided closure.

This function returns the return value of the provided closure directly.

Note that the lifetime of the AudioProcessorHandler cannot be statically known, as it is bound to the plugin instance itself.

See the access_handler_mut method to receive a mutable reference to the AudioProcessorHandler instead.

Source

pub fn access_handler_mut<'s, R>( &'s mut self, access: impl for<'a> FnOnce(&'s mut <H as HostHandlers>::AudioProcessor<'a>) -> R, ) -> R

Accesses the AudioProcessorHandler for this instance, using the provided closure.

This function returns the return value of the provided closure directly.

Note that the lifetime of the AudioProcessorHandler cannot be statically known, as it is bound to the plugin instance itself.

See the access_handler method to receive a shared reference to the AudioProcessorHandler instead.

Source

pub fn plugin_handle(&mut self) -> PluginAudioProcessorHandle<'_>

Returns this plugin instance’s audio processor handle.

Source

pub fn shared_plugin_handle(&self) -> PluginSharedHandle<'_>

Returns this plugin instance’s shared handle.

Source

pub fn matches(&self, instance: &PluginInstance<H>) -> bool

Returns true if this audio processor was created from the given plugin instance.

Trait Implementations§

Source§

impl<H: HostHandlers> From<StoppedPluginAudioProcessor<H>> for PluginAudioProcessor<H>

Source§

fn from(p: StoppedPluginAudioProcessor<H>) -> Self

Converts to this type from the input type.

Auto Trait Implementations§

§

impl<H> !RefUnwindSafe for StoppedPluginAudioProcessor<H>

§

impl<H> !Sync for StoppedPluginAudioProcessor<H>

§

impl<H> !UnwindSafe for StoppedPluginAudioProcessor<H>

§

impl<H> Freeze for StoppedPluginAudioProcessor<H>
where Arc<PluginInstanceInner<H>>: Freeze,

§

impl<H> Send for StoppedPluginAudioProcessor<H>
where Arc<PluginInstanceInner<H>>: Send,

§

impl<H> Unpin for StoppedPluginAudioProcessor<H>
where Arc<PluginInstanceInner<H>>: Unpin,

§

impl<H> UnsafeUnpin for StoppedPluginAudioProcessor<H>
where Arc<PluginInstanceInner<H>>: UnsafeUnpin,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.