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.

factory.h 3.1KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122
  1. /*
  2. * travesty, pure C VST3-compatible interface
  3. * Copyright (C) 2021 Filipe Coelho <falktx@falktx.com>
  4. *
  5. * Permission to use, copy, modify, and/or distribute this software for any purpose with
  6. * or without fee is hereby granted, provided that the above copyright notice and this
  7. * permission notice appear in all copies.
  8. *
  9. * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD
  10. * TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN
  11. * NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
  12. * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER
  13. * IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
  14. * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  15. */
  16. #pragma once
  17. #include "base.h"
  18. /**
  19. * plugin factory v1
  20. */
  21. struct v3_factory_info {
  22. char vendor[64];
  23. char url[256];
  24. char email[128];
  25. int32_t flags; // set to 0x10 (unicode)
  26. };
  27. struct v3_class_info {
  28. v3_tuid class_id;
  29. int32_t cardinality; // set to 0x7FFFFFFF (many instances)
  30. char category[32];
  31. char name[64];
  32. };
  33. struct v3_plugin_factory {
  34. struct v3_funknown;
  35. v3_result (V3_API *get_factory_info)(void* self, struct v3_factory_info*);
  36. int32_t (V3_API *num_classes)(void* self);
  37. v3_result (V3_API *get_class_info)(void* self, int32_t idx, struct v3_class_info*);
  38. v3_result (V3_API *create_instance)(void* self, const v3_tuid class_id, const v3_tuid iid, void** instance);
  39. };
  40. static constexpr const v3_tuid v3_plugin_factory_iid =
  41. V3_ID(0x7A4D811C, 0x52114A1F, 0xAED9D2EE, 0x0B43BF9F);
  42. /**
  43. * plugin factory v2
  44. */
  45. enum {
  46. V3_DISTRIBUTABLE = 1 << 0,
  47. V3_SIMPLE_MODE = 1 << 1
  48. };
  49. struct v3_class_info_2 {
  50. v3_tuid class_id;
  51. int32_t cardinality; // set to 0x7FFFFFFF
  52. char category[32];
  53. char name[64];
  54. uint32_t class_flags;
  55. char sub_categories[128];
  56. char vendor[64];
  57. char version[64];
  58. char sdk_version[64];
  59. };
  60. struct v3_plugin_factory_2 {
  61. struct v3_plugin_factory;
  62. v3_result (V3_API *get_class_info_2)(void* self, int32_t idx, struct v3_class_info_2*);
  63. };
  64. static constexpr const v3_tuid v3_plugin_factory_2_iid =
  65. V3_ID(0x0007B650, 0xF24B4C0B, 0xA464EDB9, 0xF00B2ABB);
  66. /**
  67. * plugin factory v3
  68. * (we got it right this time I swear)
  69. *
  70. * same as above, but "unicode" (really just utf-16, thanks microsoft!)
  71. */
  72. struct v3_class_info_3 {
  73. v3_tuid class_id;
  74. int32_t cardinality; // set to 0x7FFFFFFF
  75. char category[32];
  76. int16_t name[64];
  77. uint32_t class_flags;
  78. char sub_categories[128];
  79. int16_t vendor[64];
  80. int16_t version[64];
  81. int16_t sdk_version[64];
  82. };
  83. struct v3_plugin_factory_3 {
  84. struct v3_plugin_factory_2;
  85. v3_result (V3_API *get_class_info_utf16)(void* self, int32_t idx, struct v3_class_info_3*);
  86. v3_result (V3_API *set_host_context)(void* self, struct v3_funknown** host);
  87. };
  88. static constexpr const v3_tuid v3_plugin_factory_3_iid =
  89. V3_ID(0x4555A2AB, 0xC1234E57, 0x9B122910, 0x36878931);
  90. #ifdef __cplusplus
  91. /**
  92. * C++ variants
  93. */
  94. struct v3_plugin_factory_cpp : v3_funknown {
  95. v3_plugin_factory v1;
  96. v3_plugin_factory_2 v2;
  97. v3_plugin_factory_3 v3;
  98. };
  99. #endif