1
0
Fork 0

Fix alloc failures in VST3 with many events

Or well, work around. We should use a different non-allocating sorting
implementation here. This only crept up in Ardour because they for some
reason send all parameter values after loading a VST3 plugin.
This commit is contained in:
Robbert van der Helm 2022-12-28 01:29:06 +01:00
parent fd28a95231
commit 5cbef6ec03

View file

@ -1251,9 +1251,13 @@ impl<P: Vst3Plugin> IAudioProcessor for Wrapper<P> {
// processed before note events. Otherwise you'll get out of bounds note events
// with block splitting when the note event occurs at one index after the end (or
// on the exclusive end index) of the block.
process_events.sort_by_key(|event| match event {
ProcessEvent::ParameterChange { timing, .. } => *timing,
ProcessEvent::NoteEvent { timing, .. } => *timing,
// FIXME: Apparently stable sort allcoates if the slice is large enough. This should be
// fixed at some point.
permit_alloc(|| {
process_events.sort_by_key(|event| match event {
ProcessEvent::ParameterChange { timing, .. } => *timing,
ProcessEvent::NoteEvent { timing, .. } => *timing,
})
});
let mut block_start = 0usize;