1
0
Fork 0

Optionally disallow allocations in reset function

This commit is contained in:
Robbert van der Helm 2022-03-08 00:46:04 +01:00
parent fd8bd025c8
commit 37e1b9523b
2 changed files with 5 additions and 5 deletions
src/wrapper

View file

@ -728,7 +728,7 @@ impl<P: ClapPlugin> Wrapper<P> {
&mut wrapper.make_process_context(Transport::new(buffer_config.sample_rate)), &mut wrapper.make_process_context(Transport::new(buffer_config.sample_rate)),
) { ) {
// As per-the trait docs we'll always call this after the initialization function // As per-the trait docs we'll always call this after the initialization function
plugin.reset(); process_wrapper(|| plugin.reset());
// Preallocate enough room in the output slices vector so we can convert a `*mut *mut // Preallocate enough room in the output slices vector so we can convert a `*mut *mut
// f32` to a `&mut [&mut f32]` in the process call // f32` to a `&mut [&mut f32]` in the process call
@ -774,7 +774,7 @@ impl<P: ClapPlugin> Wrapper<P> {
check_null_ptr!((), plugin); check_null_ptr!((), plugin);
let wrapper = &*(plugin as *const Self); let wrapper = &*(plugin as *const Self);
wrapper.plugin.write().reset(); process_wrapper(|| wrapper.plugin.write().reset());
} }
unsafe extern "C" fn process( unsafe extern "C" fn process(
@ -1655,7 +1655,7 @@ impl<P: ClapPlugin> Wrapper<P> {
&buffer_config, &buffer_config,
&mut wrapper.make_process_context(Transport::new(buffer_config.sample_rate)), &mut wrapper.make_process_context(Transport::new(buffer_config.sample_rate)),
); );
plugin.reset(); process_wrapper(|| plugin.reset());
} }
true true

View file

@ -242,7 +242,7 @@ impl<P: Vst3Plugin> IComponent for Wrapper<P> {
.inner .inner
.make_process_context(Transport::new(buffer_config.sample_rate)), .make_process_context(Transport::new(buffer_config.sample_rate)),
); );
plugin.reset(); process_wrapper(|| plugin.reset());
} }
kResultOk kResultOk
@ -602,7 +602,7 @@ impl<P: Vst3Plugin> IAudioProcessor for Wrapper<P> {
.make_process_context(Transport::new(buffer_config.sample_rate)), .make_process_context(Transport::new(buffer_config.sample_rate)),
) { ) {
// As per-the trait docs we'll always call this after the initialization function // As per-the trait docs we'll always call this after the initialization function
plugin.reset(); process_wrapper(|| plugin.reset());
// Preallocate enough room in the output slices vector so we can convert a `*mut *mut // Preallocate enough room in the output slices vector so we can convert a `*mut *mut
// f32` to a `&mut [&mut f32]` in the process call // f32` to a `&mut [&mut f32]` in the process call