Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add the ability for plugins to opt-in to asyncronous state calls #310

Open
wants to merge 1 commit into
base: next
Choose a base branch
from

Conversation

russellmcc
Copy link
Contributor

This adds a new function on state-context that allows the plugin to opt in to receiving save and load calls on a new "state-thread" symbolic thread. Hosts could use this to parallelize loading and saving session state, which can greatly reduce the time it takes to load or save a large session.

This came out of discussion on #255, and is opened as a PR in the hopes that looking at a concrete change proposal is more productive than discussing in the abstract. I'm happy to reject this and continue the discussion somewhere else if that's more appropriate.

Currently left unaddressed is the idea of activating also on a background thread, raised in this comment. I could use ideas on how to allow this. Perhaps state-thread is not a good idea and it should be called bg-thread or something like that?

This adds a new function on state-context that allows the plugin to
opt in to receiving save and load calls on a new "state-thread"
symbolic thread. Hosts could use this to parallelize loading and
saving session state, which can greatly reduce the time it takes to
load or save a large session.
@abique
Copy link
Contributor

abique commented Aug 15, 2023

I will propose a different approach which will cover both loading a state or activating the plugin.

@abique
Copy link
Contributor

abique commented Aug 19, 2023

Here is my proposal: #343

@defiantnerd
Copy link
Contributor

We still need to extend the enum:

enum clap_plugin_state_context_type {
   // suitable for duplicating a plugin instance
   CLAP_STATE_CONTEXT_FOR_DUPLICATE = 1,

   // suitable for loading a state as a preset
   CLAP_STATE_CONTEXT_FOR_PRESET = 2,
};

with a CLAP_STATE_CONTEXT_FOR_PROJECT constant, except that this would be the default?

Resource allocations during a project load linked with enumerated unique resources (hardware!) can only safely be restored properly when properly signalled.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants