Put the no_alloc guard around entire process call
This commit is contained in:
parent
f644ae8df8
commit
3bd3696abe
1 changed files with 132 additions and 130 deletions
|
@ -1129,6 +1129,9 @@ impl<P: Plugin> IAudioProcessor for Wrapper<P> {
|
|||
unsafe fn process(&self, data: *mut vst3_sys::vst::ProcessData) -> tresult {
|
||||
check_null_ptr!(data);
|
||||
|
||||
// Panic on allocations if the `assert_process_allocs` feature has been enabled, and make
|
||||
// sure that FTZ is set up correctly
|
||||
process_wrapper(|| {
|
||||
// We need to handle incoming automation first
|
||||
let data = &*data;
|
||||
let sample_rate = self
|
||||
|
@ -1145,8 +1148,8 @@ impl<P: Plugin> IAudioProcessor for Wrapper<P> {
|
|||
let param_hash = param_change_queue.get_parameter_id();
|
||||
let num_changes = param_change_queue.get_point_count();
|
||||
|
||||
// TODO: Handle sample accurate parameter changes, possibly in a similar way to
|
||||
// the smoothing
|
||||
// TODO: Handle sample accurate parameter changes, possibly in a similar way
|
||||
// to the smoothing
|
||||
let mut sample_offset = 0i32;
|
||||
let mut value = 0.0f64;
|
||||
if num_changes > 0
|
||||
|
@ -1235,7 +1238,9 @@ impl<P: Plugin> IAudioProcessor for Wrapper<P> {
|
|||
{
|
||||
let output_slices = output_buffer.as_raw_vec();
|
||||
nih_debug_assert_eq!(num_output_channels, output_slices.len());
|
||||
for (output_channel_idx, output_channel_slice) in output_slices.iter_mut().enumerate() {
|
||||
for (output_channel_idx, output_channel_slice) in
|
||||
output_slices.iter_mut().enumerate()
|
||||
{
|
||||
// SAFETY: These pointers may not be valid outside of this function even though
|
||||
// their lifetime is equal to this structs. This is still safe because they are
|
||||
// only dereferenced here later as part of this process function.
|
||||
|
@ -1247,8 +1252,8 @@ impl<P: Plugin> IAudioProcessor for Wrapper<P> {
|
|||
}
|
||||
|
||||
// Most hosts process data in place, in which case we don't need to do any copying
|
||||
// ourselves. If the pointers do not alias, then we'll do the copy here and then the plugin
|
||||
// can just do normal in place processing.
|
||||
// ourselves. If the pointers do not alias, then we'll do the copy here and then the
|
||||
// plugin can just do normal in place processing.
|
||||
if !data.inputs.is_null() {
|
||||
let num_input_channels = (*data.inputs).num_channels as usize;
|
||||
nih_debug_assert!(
|
||||
|
@ -1272,18 +1277,15 @@ impl<P: Plugin> IAudioProcessor for Wrapper<P> {
|
|||
|
||||
let mut plugin = self.inner.plugin.write();
|
||||
let mut context = self.inner.make_process_context();
|
||||
// Panic on allocations if the `assert_process_allocs` feature has been enabled, and make
|
||||
// sure that FTZ is set up correctly
|
||||
process_wrapper(
|
||||
move || match plugin.process(&mut output_buffer, &mut context) {
|
||||
match plugin.process(&mut output_buffer, &mut context) {
|
||||
ProcessStatus::Error(err) => {
|
||||
nih_debug_assert_failure!("Process error: {}", err);
|
||||
|
||||
kResultFalse
|
||||
}
|
||||
_ => kResultOk,
|
||||
},
|
||||
)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
unsafe fn get_tail_samples(&self) -> u32 {
|
||||
|
|
Loading…
Add table
Reference in a new issue