diff --git a/src/context/gui.rs b/src/context/gui.rs index ab7a4dc8..6febbd77 100644 --- a/src/context/gui.rs +++ b/src/context/gui.rs @@ -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 AsyncExecutor

{ - /// 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); } } diff --git a/src/context/process.rs b/src/context/process.rs index 5e371dc5..f3f57e7e 100644 --- a/src/context/process.rs +++ b/src/context/process.rs @@ -17,15 +17,15 @@ pub trait ProcessContext { /// 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; diff --git a/src/wrapper/clap/context.rs b/src/wrapper/clap/context.rs index c4ecfe66..d872d463 100644 --- a/src/wrapper/clap/context.rs +++ b/src/wrapper/clap/context.rs @@ -59,7 +59,7 @@ impl ProcessContext

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..."); } diff --git a/src/wrapper/standalone/context.rs b/src/wrapper/standalone/context.rs index eb7b2cba..a24dbb7f 100644 --- a/src/wrapper/standalone/context.rs +++ b/src/wrapper/standalone/context.rs @@ -67,7 +67,7 @@ impl ProcessContext

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..."); } diff --git a/src/wrapper/vst3/context.rs b/src/wrapper/vst3/context.rs index 8aba52f3..219dc273 100644 --- a/src/wrapper/vst3/context.rs +++ b/src/wrapper/vst3/context.rs @@ -61,7 +61,7 @@ impl ProcessContext

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..."); }