Terminate all matches voices in PolyModSynth
This is needed for a single NoteOff followed by multiple NoteOns for the same key/channel with different note IDs.
This commit is contained in:
parent
fb43047cbe
commit
097d6c9fc4
|
@ -289,8 +289,8 @@ impl PolyModSynth {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Terminate a voice, removing it from the pool and informing the host that the voice has
|
/// Terminate one or more voice, removing it from the pool and informing the host that the voice
|
||||||
/// ended. Returns whether a voice has actually been terminated.
|
/// has ended. If `voice_id` is not provided, then this will terminate all matching voices.
|
||||||
fn terminate_voice(
|
fn terminate_voice(
|
||||||
&mut self,
|
&mut self,
|
||||||
context: &mut impl ProcessContext,
|
context: &mut impl ProcessContext,
|
||||||
|
@ -298,7 +298,8 @@ impl PolyModSynth {
|
||||||
voice_id: Option<i32>,
|
voice_id: Option<i32>,
|
||||||
channel: u8,
|
channel: u8,
|
||||||
note: u8,
|
note: u8,
|
||||||
) -> bool {
|
) {
|
||||||
|
// TODO: If voice ID = none, terminate all matching voices
|
||||||
for voice in self.voices.iter_mut() {
|
for voice in self.voices.iter_mut() {
|
||||||
match voice {
|
match voice {
|
||||||
Some(Voice {
|
Some(Voice {
|
||||||
|
@ -320,13 +321,16 @@ impl PolyModSynth {
|
||||||
});
|
});
|
||||||
*voice = None;
|
*voice = None;
|
||||||
|
|
||||||
return true;
|
// If this targetted a single voice ID, we're done here. Otherwise there may be
|
||||||
|
// multiple overlapping voices as we enabled support for that in the
|
||||||
|
// `PolyModulationConfig`.
|
||||||
|
if voice_id.is_some() {
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
_ => (),
|
_ => (),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
false
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue