From 7632b21a95f3962ddad6ed1a5fb57917e8bed9db Mon Sep 17 00:00:00 2001 From: Robbert van der Helm Date: Tue, 15 Feb 2022 03:45:39 +0100 Subject: [PATCH] Remove debug code from sine example Not sure how this ended up here. --- plugins/diopser/src/lib.rs | 2 ++ plugins/examples/sine/src/lib.rs | 12 +----------- 2 files changed, 3 insertions(+), 11 deletions(-) diff --git a/plugins/diopser/src/lib.rs b/plugins/diopser/src/lib.rs index e2a40d77..58f1c6ac 100644 --- a/plugins/diopser/src/lib.rs +++ b/plugins/diopser/src/lib.rs @@ -41,6 +41,8 @@ const MAX_AUTOMATION_STEP_SIZE: u32 = 512; // improved). Other features I want to implement are: // - Briefly muting the output when changing the number of filters to get rid of the clicks // - A GUI +// - A panic switch (maybe also as a trigger-like parameter) to reset all filter states may also be +// useful struct Diopser { params: Pin>, diff --git a/plugins/examples/sine/src/lib.rs b/plugins/examples/sine/src/lib.rs index 29cc6986..a4dd317b 100644 --- a/plugins/examples/sine/src/lib.rs +++ b/plugins/examples/sine/src/lib.rs @@ -18,8 +18,6 @@ struct Sine { /// The current phase of the sine wave, always kept between in `[0, 1]`. phase: f32, - samples: f32, - /// The frequency if the active note, if triggered by MIDI. midi_note_freq: f32, /// A simple attack and release envelope to avoid clicks. @@ -48,7 +46,6 @@ impl Default for Sine { sample_rate: 1.0, phase: 0.0, - samples: 0.0, midi_note_freq: 1.0, midi_note_gain: Smoother::new(SmoothingStyle::Linear(5.0)), } @@ -141,13 +138,6 @@ impl Plugin for Sine { // Smoothing is optionally built into the parameters themselves let gain = self.params.gain.smoothed.next(); - let offset = - ((self.samples / 100.0) + 1.0).log2() / (100.0f32 * 500.0 + 1.0).log2() * 500.0; - self.samples += 1.0; - if self.samples / 100.0 > 500.0 { - self.samples = 0.0; - } - // This plugin can be either triggered by MIDI or controleld by a parameter let sine = if self.params.use_midi.value { // Act on the next MIDI event @@ -174,7 +164,7 @@ impl Plugin for Sine { self.calculate_sine(self.midi_note_freq) * self.midi_note_gain.next() } else { let frequency = self.params.frequency.smoothed.next(); - self.calculate_sine(frequency + offset) + self.calculate_sine(frequency) }; for sample in samples {