Audio plugin host https://kx.studio/carla
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

plugin.h 3.8KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. #pragma once
  2. #include "private/macros.h"
  3. #include "host.h"
  4. #include "process.h"
  5. #include "plugin-features.h"
  6. #ifdef __cplusplus
  7. extern "C" {
  8. #endif
  9. typedef struct clap_plugin_descriptor {
  10. clap_version_t clap_version; // initialized to CLAP_VERSION
  11. // Mandatory fields must be set and must not be blank.
  12. // Otherwise the fields can be null or blank, though it is safer to make them blank.
  13. const char *id; // eg: "com.u-he.diva", mandatory
  14. const char *name; // eg: "Diva", mandatory
  15. const char *vendor; // eg: "u-he"
  16. const char *url; // eg: "https://u-he.com/products/diva/"
  17. const char *manual_url; // eg: "https://dl.u-he.com/manuals/plugins/diva/Diva-user-guide.pdf"
  18. const char *support_url; // eg: "https://u-he.com/support/"
  19. const char *version; // eg: "1.4.4"
  20. const char *description; // eg: "The spirit of analogue"
  21. // Arbitrary list of keywords.
  22. // They can be matched by the host indexer and used to classify the plugin.
  23. // The array of pointers must be null terminated.
  24. // For some standard features see plugin-features.h
  25. const char **features;
  26. } clap_plugin_descriptor_t;
  27. typedef struct clap_plugin {
  28. const clap_plugin_descriptor_t *desc;
  29. void *plugin_data; // reserved pointer for the plugin
  30. // Must be called after creating the plugin.
  31. // If init returns false, the host must destroy the plugin instance.
  32. // [main-thread]
  33. bool (CLAP_ABI *init)(const struct clap_plugin *plugin);
  34. // Free the plugin and its resources.
  35. // It is required to deactivate the plugin prior to this call.
  36. // [main-thread & !active]
  37. void (CLAP_ABI *destroy)(const struct clap_plugin *plugin);
  38. // Activate and deactivate the plugin.
  39. // In this call the plugin may allocate memory and prepare everything needed for the process
  40. // call. The process's sample rate will be constant and process's frame count will included in
  41. // the [min, max] range, which is bounded by [1, INT32_MAX].
  42. // Once activated the latency and port configuration must remain constant, until deactivation.
  43. //
  44. // [main-thread & !active_state]
  45. bool (CLAP_ABI *activate)(const struct clap_plugin *plugin,
  46. double sample_rate,
  47. uint32_t min_frames_count,
  48. uint32_t max_frames_count);
  49. // [main-thread & active_state]
  50. void (CLAP_ABI *deactivate)(const struct clap_plugin *plugin);
  51. // Call start processing before processing.
  52. // [audio-thread & active_state & !processing_state]
  53. bool (CLAP_ABI *start_processing)(const struct clap_plugin *plugin);
  54. // Call stop processing before sending the plugin to sleep.
  55. // [audio-thread & active_state & processing_state]
  56. void (CLAP_ABI *stop_processing)(const struct clap_plugin *plugin);
  57. // - Clears all buffers, performs a full reset of the processing state (filters, oscillators,
  58. // enveloppes, lfo, ...) and kills all voices.
  59. // - The parameter's value remain unchanged.
  60. // - clap_process.steady_time may jump backward.
  61. //
  62. // [audio-thread & active_state]
  63. void (CLAP_ABI *reset)(const struct clap_plugin *plugin);
  64. // process audio, events, ...
  65. // [audio-thread & active_state & processing_state]
  66. clap_process_status (CLAP_ABI *process)(const struct clap_plugin *plugin, const clap_process_t *process);
  67. // Query an extension.
  68. // The returned pointer is owned by the plugin.
  69. // [thread-safe]
  70. const void *(CLAP_ABI *get_extension)(const struct clap_plugin *plugin, const char *id);
  71. // Called by the host on the main thread in response to a previous call to:
  72. // host->request_callback(host);
  73. // [main-thread]
  74. void (CLAP_ABI *on_main_thread)(const struct clap_plugin *plugin);
  75. } clap_plugin_t;
  76. #ifdef __cplusplus
  77. }
  78. #endif