Remove debug code from sine example
Not sure how this ended up here.
This commit is contained in:
parent
fc8aec5afa
commit
7632b21a95
2 changed files with 3 additions and 11 deletions
|
@ -41,6 +41,8 @@ const MAX_AUTOMATION_STEP_SIZE: u32 = 512;
|
||||||
// improved). Other features I want to implement are:
|
// improved). Other features I want to implement are:
|
||||||
// - Briefly muting the output when changing the number of filters to get rid of the clicks
|
// - Briefly muting the output when changing the number of filters to get rid of the clicks
|
||||||
// - A GUI
|
// - A GUI
|
||||||
|
// - A panic switch (maybe also as a trigger-like parameter) to reset all filter states may also be
|
||||||
|
// useful
|
||||||
struct Diopser {
|
struct Diopser {
|
||||||
params: Pin<Box<DiopserParams>>,
|
params: Pin<Box<DiopserParams>>,
|
||||||
|
|
||||||
|
|
|
@ -18,8 +18,6 @@ struct Sine {
|
||||||
/// The current phase of the sine wave, always kept between in `[0, 1]`.
|
/// The current phase of the sine wave, always kept between in `[0, 1]`.
|
||||||
phase: f32,
|
phase: f32,
|
||||||
|
|
||||||
samples: f32,
|
|
||||||
|
|
||||||
/// The frequency if the active note, if triggered by MIDI.
|
/// The frequency if the active note, if triggered by MIDI.
|
||||||
midi_note_freq: f32,
|
midi_note_freq: f32,
|
||||||
/// A simple attack and release envelope to avoid clicks.
|
/// A simple attack and release envelope to avoid clicks.
|
||||||
|
@ -48,7 +46,6 @@ impl Default for Sine {
|
||||||
sample_rate: 1.0,
|
sample_rate: 1.0,
|
||||||
|
|
||||||
phase: 0.0,
|
phase: 0.0,
|
||||||
samples: 0.0,
|
|
||||||
midi_note_freq: 1.0,
|
midi_note_freq: 1.0,
|
||||||
midi_note_gain: Smoother::new(SmoothingStyle::Linear(5.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
|
// Smoothing is optionally built into the parameters themselves
|
||||||
let gain = self.params.gain.smoothed.next();
|
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
|
// This plugin can be either triggered by MIDI or controleld by a parameter
|
||||||
let sine = if self.params.use_midi.value {
|
let sine = if self.params.use_midi.value {
|
||||||
// Act on the next MIDI event
|
// 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()
|
self.calculate_sine(self.midi_note_freq) * self.midi_note_gain.next()
|
||||||
} else {
|
} else {
|
||||||
let frequency = self.params.frequency.smoothed.next();
|
let frequency = self.params.frequency.smoothed.next();
|
||||||
self.calculate_sine(frequency + offset)
|
self.calculate_sine(frequency)
|
||||||
};
|
};
|
||||||
|
|
||||||
for sample in samples {
|
for sample in samples {
|
||||||
|
|
Loading…
Add table
Reference in a new issue