API question plugin->host requests #332
-
Greetings clappers, I'm developing a CLAP host that hosts multiple plugins and am finding an awkward corner of Clap's plugin-to-host API. The problem: //host.h
request_callback(const clap_host *);
request_process(const clap_host *);
request_restart(const clap_host *);
// ext/gui.h (host)
request_resize(const clap_host_t *, uint32_t , uint32_t );
request_show(const clap_host_t *);
request_hide(const clap_host_t *); These methods are invoked from a plugin to request a service from the host. The The awkwardness is that these requests don't include any plugin-specific context. Ie: the source of the request. The only solution I see is to pass a plugin-instance-specific clap_host with a different host_data for each instance. Obviously doable, but it would seem nicer if these three callbacks also included the Any comments or thoughts are welcome! Am I missing something? Thanks! |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
You will need to create an object instance for every hosted plugin. This will also contain a pointer back to the plugin instance. This way I can always find the way back to the plugin and I also know which instance is being addressed. You will have no success with pointing |
Beta Was this translation helpful? Give feedback.
You will need to create an object instance for every hosted plugin. This will also contain a pointer back to the plugin instance.
In the clap-wrapper I've introduced an
IHost
interface and derived the actual wrapping object from it. The pointer to this interface is being provided asclap_host_t*
.https://github.com/free-audio/clap-wrapper/blob/f14d5b24806f1da080d1534199d2668ebd2f5e43/src/wrapasvst3.h#L87
This way I can always find the way back to the plugin and I also know which instance is being addressed.
You will have no success with pointing
clap_host_t
to the same object for all plugin instances, it is individual for each plugin.