Implement the reset function everywhere
This commit is contained in:
parent
70d3b5d557
commit
fd8bd025c8
|
@ -252,13 +252,16 @@ impl Plugin for Diopser {
|
|||
buffer_config: &BufferConfig,
|
||||
_context: &mut impl ProcessContext,
|
||||
) -> bool {
|
||||
// Initialize the filters on the first process call
|
||||
self.sample_rate = buffer_config.sample_rate;
|
||||
self.should_update_filters.store(true, Ordering::Release);
|
||||
|
||||
true
|
||||
}
|
||||
|
||||
fn reset(&mut self) {
|
||||
// Initialize and/or reset the filters on the next process call
|
||||
self.should_update_filters.store(true, Ordering::Release);
|
||||
}
|
||||
|
||||
fn process(
|
||||
&mut self,
|
||||
buffer: &mut Buffer,
|
||||
|
|
|
@ -115,17 +115,10 @@ impl Plugin for Gain {
|
|||
config.num_input_channels == config.num_output_channels && config.num_input_channels > 0
|
||||
}
|
||||
|
||||
fn initialize(
|
||||
&mut self,
|
||||
_bus_config: &BusConfig,
|
||||
_buffer_config: &BufferConfig,
|
||||
_context: &mut 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
|
||||
// reconfigures the plugin.
|
||||
true
|
||||
}
|
||||
// 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 reconfigures the
|
||||
// plugin. If we did need special initialization, we could implement the `initialize()` and/or
|
||||
// `reset()` methods
|
||||
|
||||
fn process(
|
||||
&mut self,
|
||||
|
|
|
@ -125,6 +125,12 @@ impl Plugin for Sine {
|
|||
true
|
||||
}
|
||||
|
||||
fn reset(&mut self) {
|
||||
self.phase = 0.0;
|
||||
self.midi_note_freq = 1.0;
|
||||
self.midi_note_gain.reset(0.0);
|
||||
}
|
||||
|
||||
fn process(&mut self, buffer: &mut Buffer, context: &mut impl ProcessContext) -> ProcessStatus {
|
||||
let mut next_event = context.next_midi_event();
|
||||
for (sample_id, channel_samples) in buffer.iter_mut().enumerate() {
|
||||
|
|
|
@ -116,14 +116,18 @@ impl Plugin for Stft {
|
|||
_buffer_config: &BufferConfig,
|
||||
context: &mut impl ProcessContext,
|
||||
) -> bool {
|
||||
// Normally we'd also initialize the STFT helper for the correct channel count here, but we
|
||||
// only do stereo so that's not necessary
|
||||
self.stft.set_block_size(WINDOW_SIZE);
|
||||
context.set_latency_samples(self.stft.latency_samples());
|
||||
|
||||
true
|
||||
}
|
||||
|
||||
fn reset(&mut self) {
|
||||
// Normally we'd also initialize the STFT helper for the correct channel count here, but we
|
||||
// only do stereo so that's not necessary. Setting the block size also zeroes out the
|
||||
// buffers.
|
||||
self.stft.set_block_size(WINDOW_SIZE);
|
||||
}
|
||||
|
||||
fn process(
|
||||
&mut self,
|
||||
buffer: &mut Buffer,
|
||||
|
|
|
@ -175,6 +175,11 @@ impl Plugin for PubertySimulator {
|
|||
true
|
||||
}
|
||||
|
||||
fn reset(&mut self) {
|
||||
// This zeroes out the buffers
|
||||
self.stft.set_block_size(self.window_size());
|
||||
}
|
||||
|
||||
fn process(&mut self, buffer: &mut Buffer, context: &mut impl ProcessContext) -> ProcessStatus {
|
||||
// Compensate for the window function, the overlap, and the extra gain introduced by the
|
||||
// IDFT operation
|
||||
|
|
Loading…
Reference in a new issue