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>
impl<H: HostHandlers> StoppedPluginAudioProcessor<H>
Sourcepub fn reset(&mut self)
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.
Sourcepub fn start_processing(
self,
) -> Result<StartedPluginAudioProcessor<H>, ProcessingStartError<H>>
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.
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.
Sourcepub fn access_handler<'s, R>(
&'s self,
access: impl for<'a> FnOnce(&'s <H as HostHandlers>::AudioProcessor<'a>) -> R,
) -> R
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.
Sourcepub fn access_handler_mut<'s, R>(
&'s mut self,
access: impl for<'a> FnOnce(&'s mut <H as HostHandlers>::AudioProcessor<'a>) -> R,
) -> R
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.
Sourcepub fn plugin_handle(&mut self) -> PluginAudioProcessorHandle<'_>
pub fn plugin_handle(&mut self) -> PluginAudioProcessorHandle<'_>
Returns this plugin instance’s audio processor handle.
Returns this plugin instance’s shared handle.
Sourcepub fn matches(&self, instance: &PluginInstance<H>) -> bool
pub fn matches(&self, instance: &PluginInstance<H>) -> bool
Returns true if this audio processor was created from the given plugin instance.