1
0
Fork 0

Fix resizing aux input storage on buffer size

This nested `resize_with()` of course wouldn't resize the inner vectors
of the outer ones were already the correct size.
This commit is contained in:
Robbert van der Helm 2022-09-11 16:41:31 +02:00
parent 4c9a2726f3
commit b883a611ab
2 changed files with 20 additions and 15 deletions

View file

@ -1719,12 +1719,15 @@ impl<P: ClapPlugin> Wrapper<P> {
// inputs. The slices will be assigned in the process function as this object may have
// been moved before then.
let mut aux_input_storage = wrapper.aux_input_storage.borrow_mut();
aux_input_storage.resize_with(bus_config.aux_input_busses.num_busses as usize, || {
vec![
vec![0.0; max_frames_count as usize];
bus_config.aux_input_busses.num_channels as usize
]
});
aux_input_storage
.resize_with(bus_config.aux_input_busses.num_busses as usize, Vec::new);
for bus_storage in aux_input_storage.iter_mut() {
bus_storage
.resize_with(bus_config.aux_input_busses.num_channels as usize, Vec::new);
for channel_storage in bus_storage {
channel_storage.resize(max_frames_count as usize, 0.0);
}
}
let mut aux_input_buffers = wrapper.aux_input_buffers.borrow_mut();
aux_input_buffers.resize_with(

View file

@ -413,15 +413,17 @@ impl<P: Vst3Plugin> IComponent for Wrapper<P> {
// sidechain inputs. The slices will be assigned in the process function as this
// object may have been moved before then.
let mut aux_input_storage = self.inner.aux_input_storage.borrow_mut();
aux_input_storage.resize_with(
bus_config.aux_input_busses.num_busses as usize,
|| {
vec![
vec![0.0; buffer_config.max_buffer_size as usize];
bus_config.aux_input_busses.num_channels as usize
]
},
);
aux_input_storage
.resize_with(bus_config.aux_input_busses.num_busses as usize, Vec::new);
for bus_storage in aux_input_storage.iter_mut() {
bus_storage.resize_with(
bus_config.aux_input_busses.num_channels as usize,
Vec::new,
);
for channel_storage in bus_storage {
channel_storage.resize(buffer_config.max_buffer_size as usize, 0.0);
}
}
let mut aux_input_buffers = self.inner.aux_input_buffers.borrow_mut();
aux_input_buffers.resize_with(