free-audio / clap

Audio Plugin API
https://cleveraudio.org/
MIT License
1.76k stars 97 forks source link

plugin actions extension #222

Closed Trinitou closed 1 year ago

Trinitou commented 1 year ago

What if a plugin could register actions to the host?

The host could then:

Use case examples would be

More a rough idea but I imagine this would be a very nice feature for CLAP Something similar was already mentioned in #32 but I think putting it into a separate issue might help to bring on the discussion.

nakst commented 1 year ago

I second this. It's also an easy way for improving plugin accessibility, if the host has implemented the OS's automation APIs.

robbert-vdh commented 1 year ago

What's the difference between this and the proposed context menu extensions? #221 is a new draft based on the earlier discussions.

Trinitou commented 1 year ago

What's the difference between this and the proposed context menu extensions? #221 is a new draft based on the earlier discussions.

Oops, didn't see that. But I think #221 is more about context menus for individual parameters. Correct me if I'm wrong, @abique ! This one is about actions that are available for a whole plugin instance. I'm not sure whether actions like I mentioned as examples should rather be parameters themselves with a parameter id (so that there are "trigger action parameters") or if these actions are some kind of extra type. I suppose something like "randomizing a step sequencer" might be a bit more CPU intensive so at least it shouldn't be modulatable nor automatable. Also this proposal would be independent from any context menu handling as the host could decide by itself whether to put plugin actions into a context menu, have them midi-learnable, and/or map them to a hardware controller automatically.

abique commented 1 year ago

@Trinitou that'd be nice to have trigger port/events for the plugin. Those controls could indeed be mapped to hw controller. I think that would do what you're asking for?

Trinitou commented 1 year ago

@Trinitou that'd be nice to have trigger port/events for the plugin. Those controls could indeed be mapped to hw controller. I think that would do what you're asking for?

Yes, I think that would do the job. To have the triggers as parameters would help so that they could be put into remote control pages but maybe that would confuse things (?)

nakst commented 1 year ago

I think the context menu API draft could work as-is for this purpose. When the host wants to query the plugin's 'actions', it can call clap_plugin_context_menu_t.populate with some special reserved value for the param_id indicating the 'global actions list'. Whether it actually displays the populated items in a menu or in some sort of list for assigning to controllers is up to the host.

nakst commented 1 year ago

Additionally, some action clap_ids could possibly be standardized, such as 'initialize current patch' or 'disable all effect units' (for a synthesizer). (Unless the CLAP API already has a way to do this?)

abique commented 1 year ago

Yes, I think that would do the job. To have the triggers as parameters would help so that they could be put into remote control pages but maybe that would confuse things (?)

Unlike parameters, triggers are state less. So they'd need their own thing.

Trinitou commented 1 year ago

Other thoughts:

Trinitou commented 1 year ago

I think it still would be nice to have a separate plugin actions/commands extension. But as I don't find the time for a pull request ATM, I'll close the issue for now.