Call the component handler for restarts
This commit is contained in:
parent
223d0c3a90
commit
459175b470
|
@ -142,7 +142,7 @@ pub(crate) struct Wrapper<'a, P: Plugin> {
|
||||||
enum Task {
|
enum Task {
|
||||||
/// Trigger a restart with the given restart flags. This is a bit set of the flags from
|
/// Trigger a restart with the given restart flags. This is a bit set of the flags from
|
||||||
/// [vst3_sys::vst::RestartFlags].
|
/// [vst3_sys::vst::RestartFlags].
|
||||||
TriggerRestart(u32),
|
TriggerRestart(i32),
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Send+Sync wrapper for these interface pointers.
|
/// Send+Sync wrapper for these interface pointers.
|
||||||
|
@ -281,10 +281,12 @@ impl<P: Plugin> MainThreadExecutor<Task> for WrapperInner<'_, P> {
|
||||||
// function for checking if a to be scheduled task can be handled right ther and
|
// function for checking if a to be scheduled task can be handled right ther and
|
||||||
// then).
|
// then).
|
||||||
match task {
|
match task {
|
||||||
Task::TriggerRestart(_flags) => {
|
Task::TriggerRestart(flags) => match &*self.component_handler.read() {
|
||||||
// TODO: Actually call the restart function
|
Some(handler) => unsafe {
|
||||||
nih_log!("Handling {:?}", task);
|
handler.restart_component(flags);
|
||||||
}
|
},
|
||||||
|
None => nih_debug_assert_failure!("Component handler not yet set"),
|
||||||
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -293,7 +295,7 @@ impl<P: Plugin> ProcessContext for WrapperInner<'_, P> {
|
||||||
fn set_latency_samples(&self, samples: u32) {
|
fn set_latency_samples(&self, samples: u32) {
|
||||||
self.current_latency.store(samples, Ordering::SeqCst);
|
self.current_latency.store(samples, Ordering::SeqCst);
|
||||||
let task_posted = unsafe { self.event_loop.read().assume_init_ref() }.do_maybe_async(
|
let task_posted = unsafe { self.event_loop.read().assume_init_ref() }.do_maybe_async(
|
||||||
Task::TriggerRestart(vst3_sys::vst::RestartFlags::kLatencyChanged as u32),
|
Task::TriggerRestart(vst3_sys::vst::RestartFlags::kLatencyChanged as i32),
|
||||||
);
|
);
|
||||||
nih_debug_assert!(task_posted, "The task queue is full, dropping task...");
|
nih_debug_assert!(task_posted, "The task queue is full, dropping task...");
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue