1
0
Fork 0

Remove debug code from sine example

Not sure how this ended up here.
This commit is contained in:
Robbert van der Helm 2022-02-15 03:45:39 +01:00
parent fc8aec5afa
commit 7632b21a95
2 changed files with 3 additions and 11 deletions

View file

@ -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<Box<DiopserParams>>,

View file

@ -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 {