1
0
Fork 0

Monomorphize the context variables

For the parameter setting context functions we don't be able to use
trait objects.
This commit is contained in:
Robbert van der Helm 2022-02-04 22:34:53 +01:00
parent f2d3d987a0
commit cbd51b0c3a
3 changed files with 6 additions and 6 deletions

View file

@ -111,7 +111,7 @@ impl Plugin for Gain {
&mut self,
_bus_config: &BusConfig,
_buffer_config: &BufferConfig,
_context: &dyn ProcessContext,
_context: &impl ProcessContext,
) -> bool {
// This plugin doesn't need any special initialization, but if you need to do anything
// expensive then this would be the place. State is kept around while when the host
@ -119,7 +119,7 @@ impl Plugin for Gain {
true
}
fn process(&mut self, buffer: &mut Buffer, _context: &dyn ProcessContext) -> ProcessStatus {
fn process(&mut self, buffer: &mut Buffer, _context: &impl ProcessContext) -> ProcessStatus {
for samples in buffer.iter_mut() {
// Smoothing is optionally built into the parameters themselves
let gain = self.params.gain.smoothed.next();

View file

@ -145,14 +145,14 @@ impl Plugin for Sine {
&mut self,
_bus_config: &BusConfig,
buffer_config: &BufferConfig,
_context: &dyn ProcessContext,
_context: &impl ProcessContext,
) -> bool {
self.sample_rate = buffer_config.sample_rate;
true
}
fn process(&mut self, buffer: &mut Buffer, context: &dyn ProcessContext) -> ProcessStatus {
fn process(&mut self, buffer: &mut Buffer, context: &impl ProcessContext) -> ProcessStatus {
let mut next_event = context.next_midi_event();
for (sample_id, samples) in buffer.iter_mut().enumerate() {
// Smoothing is optionally built into the parameters themselves

View file

@ -88,7 +88,7 @@ pub trait Plugin: Default + Send + Sync {
&mut self,
bus_config: &BusConfig,
buffer_config: &BufferConfig,
context: &dyn ProcessContext,
context: &impl ProcessContext,
) -> bool {
true
}
@ -103,7 +103,7 @@ pub trait Plugin: Default + Send + Sync {
/// TODO: Provide a way to access auxiliary input channels if the IO configuration is
/// assymetric
/// TODO: Pass transport and other context information to the plugin
fn process(&mut self, buffer: &mut Buffer, context: &dyn ProcessContext) -> ProcessStatus;
fn process(&mut self, buffer: &mut Buffer, context: &impl ProcessContext) -> ProcessStatus;
}
/// Provides auxiliary metadata needed for a VST3 plugin.