Rename execute_async() to execute_gui()
We'll have another function that uses a dedicated background thread.
This commit is contained in:
parent
5d84800c0c
commit
21bfb57023
|
@ -68,10 +68,11 @@ pub trait GuiContext: Send + Sync + 'static {
|
|||
fn set_state(&self, state: PluginState);
|
||||
}
|
||||
|
||||
/// An way to run background tasks from the plugin's GUI, equivalent to
|
||||
/// [`ProcessContext::execute_async()`][crate::prelude::ProcessContext::execute_async()]. This is
|
||||
/// passed directly to [`Plugin::editor()`] so the plugin can move it into its editor and use it
|
||||
/// later.
|
||||
/// An way to run background tasks from the plugin's GUI, equivalent to the
|
||||
/// [`ProcessContext::execute_background()`][crate::prelude::ProcessContext::execute_background()]
|
||||
/// and [`ProcessContext::execute_gui()`][crate::prelude::ProcessContext::execute_gui()] functions.
|
||||
/// This is passed directly to [`Plugin::editor()`] so the plugin can move it into its editor and
|
||||
/// use it later.
|
||||
///
|
||||
/// # Note
|
||||
///
|
||||
|
@ -103,15 +104,14 @@ pub struct ParamSetter<'a> {
|
|||
}
|
||||
|
||||
impl<P: Plugin> AsyncExecutor<P> {
|
||||
/// Run a task on a background thread. This allows deferring expensive background tasks for
|
||||
/// later. This task will likely still be executed on the GUI thread.
|
||||
/// Run a task from the plugin's GUI thread.
|
||||
///
|
||||
/// # Note
|
||||
///
|
||||
/// Scheduling the same task multiple times will cause those duplicate tasks to pile up. Try to
|
||||
/// either prevent this from happening, or check whether the task still needs to be completed in
|
||||
/// your task executor.
|
||||
pub fn execute_async(&self, task: P::BackgroundTask) {
|
||||
pub fn execute_gui(&self, task: P::BackgroundTask) {
|
||||
(self.inner)(task);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -17,15 +17,15 @@ pub trait ProcessContext<P: Plugin> {
|
|||
/// Get the current plugin API.
|
||||
fn plugin_api(&self) -> PluginApi;
|
||||
|
||||
/// Run a task on a background thread. This allows deferring expensive background tasks for
|
||||
/// alter. As long as creating the `task` is realtime-safe, this operation is too.
|
||||
/// Run a task from the plugin's GUI thread. As long as creating the `task` is realtime-safe,
|
||||
/// this operation is too.
|
||||
///
|
||||
/// # Note
|
||||
///
|
||||
/// Scheduling the same task multiple times will cause those duplicate tasks to pile up. Try to
|
||||
/// either prevent this from happening, or check whether the task still needs to be completed in
|
||||
/// your task executor.
|
||||
fn execute_async(&self, task: P::BackgroundTask);
|
||||
fn execute_gui(&self, task: P::BackgroundTask);
|
||||
|
||||
/// Get information about the current transport position and status.
|
||||
fn transport(&self) -> &Transport;
|
||||
|
|
|
@ -59,7 +59,7 @@ impl<P: ClapPlugin> ProcessContext<P> for WrapperProcessContext<'_, P> {
|
|||
PluginApi::Clap
|
||||
}
|
||||
|
||||
fn execute_async(&self, task: P::BackgroundTask) {
|
||||
fn execute_gui(&self, task: P::BackgroundTask) {
|
||||
let task_posted = self.wrapper.do_maybe_async(Task::PluginTask(task));
|
||||
nih_debug_assert!(task_posted, "The task queue is full, dropping task...");
|
||||
}
|
||||
|
|
|
@ -67,7 +67,7 @@ impl<P: Plugin, B: Backend> ProcessContext<P> for WrapperProcessContext<'_, P, B
|
|||
PluginApi::Standalone
|
||||
}
|
||||
|
||||
fn execute_async(&self, task: P::BackgroundTask) {
|
||||
fn execute_gui(&self, task: P::BackgroundTask) {
|
||||
let task_posted = self.wrapper.event_loop.do_maybe_async(task);
|
||||
nih_debug_assert!(task_posted, "The task queue is full, dropping task...");
|
||||
}
|
||||
|
|
|
@ -61,7 +61,7 @@ impl<P: Vst3Plugin> ProcessContext<P> for WrapperProcessContext<'_, P> {
|
|||
PluginApi::Vst3
|
||||
}
|
||||
|
||||
fn execute_async(&self, task: P::BackgroundTask) {
|
||||
fn execute_gui(&self, task: P::BackgroundTask) {
|
||||
let task_posted = self.inner.do_maybe_async(Task::PluginTask(task));
|
||||
nih_debug_assert!(task_posted, "The task queue is full, dropping task...");
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue