Replace sine loop
This commit is contained in:
parent
8219d5f2b8
commit
97b2c9a2b1
|
@ -147,9 +147,12 @@ impl Plugin for Sine {
|
||||||
// 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
|
||||||
'midi_events: loop {
|
while let Some(event) = next_event {
|
||||||
match next_event {
|
if event.timing() != sample_id as u32 {
|
||||||
Some(event) if event.timing() == sample_id as u32 => match event {
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
match event {
|
||||||
NoteEvent::NoteOn { note, velocity, .. } => {
|
NoteEvent::NoteOn { note, velocity, .. } => {
|
||||||
self.midi_note_id = note;
|
self.midi_note_id = note;
|
||||||
self.midi_note_freq = util::midi_note_to_freq(note);
|
self.midi_note_freq = util::midi_note_to_freq(note);
|
||||||
|
@ -164,8 +167,6 @@ impl Plugin for Sine {
|
||||||
self.midi_note_gain.set_target(self.sample_rate, pressure);
|
self.midi_note_gain.set_target(self.sample_rate, pressure);
|
||||||
}
|
}
|
||||||
_ => (),
|
_ => (),
|
||||||
},
|
|
||||||
_ => break 'midi_events,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
next_event = context.next_event();
|
next_event = context.next_event();
|
||||||
|
|
Loading…
Reference in a new issue