1
0
Fork 0

Change single branch match to if let

This commit is contained in:
Robbert van der Helm 2022-07-25 14:39:43 +02:00
parent 1fbcd583a4
commit 3ffc2f0604

View file

@ -249,9 +249,13 @@ impl Plugin for PolyModSynth {
normalized_offset, normalized_offset,
} => { } => {
// Polyphonic modulation events are matched to voices using the // Polyphonic modulation events are matched to voices using the
// voice ID, and to parameters using the poly modulation ID // voice ID, and to parameters using the poly modulation ID. The
match self.get_voice_idx(voice_id) { // host will probably send a modulation event every N samples. This
Some(voice_idx) => { // will happen before the voice is active, and of course also after
// it has been terminated (because the host doesn't know that it
// will be). Because of that, we won't print any assertion failures
// when we can't find the voice index here.
if let Some(voice_idx) = self.get_voice_idx(voice_id) {
let voice = self.voices[voice_idx].as_mut().unwrap(); let voice = self.voices[voice_idx].as_mut().unwrap();
match poly_modulation_id { match poly_modulation_id {
@ -282,10 +286,8 @@ impl Plugin for PolyModSynth {
{ {
smoother.reset(target_plain_value); smoother.reset(target_plain_value);
} else { } else {
smoother.set_target( smoother
sample_rate, .set_target(sample_rate, target_plain_value);
target_plain_value,
);
} }
} }
n => nih_debug_assert_failure!( n => nih_debug_assert_failure!(
@ -295,13 +297,6 @@ impl Plugin for PolyModSynth {
), ),
} }
} }
// The host will probably send a modulation event every N
// samples. This will happen before the voice is active, and of
// course also after it has been terminated (because the host
// doesn't know that it will be). Because of that, we won't
// print any assertion failures here.
None => (),
}
} }
NoteEvent::MonoAutomation { NoteEvent::MonoAutomation {
timing: _, timing: _,