DPF

DISTRHO Plugin Framework
Log | Files | Refs | Submodules | README | LICENSE

plugin-factory.h (1463B)


      1 #pragma once
      2 
      3 #include "plugin.h"
      4 
      5 static const CLAP_CONSTEXPR char CLAP_PLUGIN_FACTORY_ID[] = "clap.plugin-factory";
      6 
      7 #ifdef __cplusplus
      8 extern "C" {
      9 #endif
     10 
     11 // Every method must be thread-safe.
     12 // It is very important to be able to scan the plugin as quickly as possible.
     13 //
     14 // The host may use clap_plugin_invalidation_factory to detect filesystem changes
     15 // which may change the factory's content.
     16 typedef struct clap_plugin_factory {
     17    // Get the number of plugins available.
     18    // [thread-safe]
     19    uint32_t(CLAP_ABI *get_plugin_count)(const struct clap_plugin_factory *factory);
     20 
     21    // Retrieves a plugin descriptor by its index.
     22    // Returns null in case of error.
     23    // The descriptor must not be freed.
     24    // [thread-safe]
     25    const clap_plugin_descriptor_t *(CLAP_ABI *get_plugin_descriptor)(
     26       const struct clap_plugin_factory *factory, uint32_t index);
     27 
     28    // Create a clap_plugin by its plugin_id.
     29    // The returned pointer must be freed by calling plugin->destroy(plugin);
     30    // The plugin is not allowed to use the host callbacks in the create method.
     31    // Returns null in case of error.
     32    // [thread-safe]
     33    const clap_plugin_t *(CLAP_ABI *create_plugin)(const struct clap_plugin_factory *factory,
     34                                                   const clap_host_t                *host,
     35                                                   const char                       *plugin_id);
     36 } clap_plugin_factory_t;
     37 
     38 #ifdef __cplusplus
     39 }
     40 #endif