From ba7b5a3b32e34664498aa51ab844a8adc8ef1d82 Mon Sep 17 00:00:00 2001 From: Robbert van der Helm Date: Thu, 14 Jul 2022 12:50:16 +0200 Subject: [PATCH] Fix examples for out of order events This would be a host bug, but in theory CLAP hosts could provide out of order events this way. --- plugins/examples/poly_mod_synth/src/lib.rs | 2 +- plugins/examples/sine/src/lib.rs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/examples/poly_mod_synth/src/lib.rs b/plugins/examples/poly_mod_synth/src/lib.rs index 9f6e1199..eeb02ec6 100644 --- a/plugins/examples/poly_mod_synth/src/lib.rs +++ b/plugins/examples/poly_mod_synth/src/lib.rs @@ -199,7 +199,7 @@ impl Plugin for PolyModSynth { 'events: loop { match next_event { // If the event happens now, then we'll keep processing events - Some(event) if (event.timing() as usize) == block_start => { + Some(event) if (event.timing() as usize) <= block_start => { // This synth doesn't support any of the polyphonic expression events. A // real synth plugin however will want to support those. match event { diff --git a/plugins/examples/sine/src/lib.rs b/plugins/examples/sine/src/lib.rs index bd740c8f..21ff2833 100644 --- a/plugins/examples/sine/src/lib.rs +++ b/plugins/examples/sine/src/lib.rs @@ -153,7 +153,7 @@ impl Plugin for Sine { let sine = if self.params.use_midi.value { // Act on the next MIDI event while let Some(event) = next_event { - if event.timing() != sample_id as u32 { + if event.timing() > sample_id as u32 { break; }