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.

219 lines
8.1KB

  1. /*
  2. * Custom types to store LADSPA-RDF information
  3. * Copyright (C) 2011-2013 Filipe Coelho <falktx@falktx.com>
  4. *
  5. * This program is free software; you can redistribute it and/or
  6. * modify it under the terms of the GNU General Public License as
  7. * published by the Free Software Foundation; either version 2 of
  8. * the License, or any later version.
  9. *
  10. * This program is distributed in the hope that it will be useful,
  11. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. * GNU General Public License for more details.
  14. *
  15. * For a full copy of the GNU General Public License see the doc/GPL.txt file.
  16. */
  17. #ifndef LADSPA_RDF_HPP_INCLUDED
  18. #define LADSPA_RDF_HPP_INCLUDED
  19. #include "CarlaDefines.h"
  20. // Base Types
  21. typedef float LADSPA_Data;
  22. typedef int LADSPA_Property;
  23. typedef unsigned long long LADSPA_PluginType;
  24. // Unit Types
  25. #define LADSPA_UNIT_DB 0x01
  26. #define LADSPA_UNIT_COEF 0x02
  27. #define LADSPA_UNIT_HZ 0x04
  28. #define LADSPA_UNIT_S 0x08
  29. #define LADSPA_UNIT_MS 0x10
  30. #define LADSPA_UNIT_MIN 0x20
  31. #define LADSPA_UNIT_CLASS_AMPLITUDE (LADSPA_UNIT_DB|LADSPA_UNIT_COEF)
  32. #define LADSPA_UNIT_CLASS_FREQUENCY (LADSPA_UNIT_HZ)
  33. #define LADSPA_UNIT_CLASS_TIME (LADSPA_UNIT_S|LADSPA_UNIT_MS|LADSPA_UNIT_MIN)
  34. #define LADSPA_IS_UNIT_DB(x) ((x) == LADSPA_UNIT_DB)
  35. #define LADSPA_IS_UNIT_COEF(x) ((x) == LADSPA_UNIT_COEF)
  36. #define LADSPA_IS_UNIT_HZ(x) ((x) == LADSPA_UNIT_HZ)
  37. #define LADSPA_IS_UNIT_S(x) ((x) == LADSPA_UNIT_S)
  38. #define LADSPA_IS_UNIT_MS(x) ((x) == LADSPA_UNIT_MS)
  39. #define LADSPA_IS_UNIT_MIN(x) ((x) == LADSPA_UNIT_MIN)
  40. #define LADSPA_IS_UNIT_CLASS_AMPLITUDE(x) ((x) & LADSPA_UNIT_CLASS_AMPLITUDE)
  41. #define LADSPA_IS_UNIT_CLASS_FREQUENCY(x) ((x) & LADSPA_UNIT_CLASS_FREQUENCY)
  42. #define LADSPA_IS_UNIT_CLASS_TIME(x) ((x) & LADSPA_UNIT_CLASS_TIME)
  43. // Port Types (Official API)
  44. #define LADSPA_PORT_INPUT 0x1
  45. #define LADSPA_PORT_OUTPUT 0x2
  46. #define LADSPA_PORT_CONTROL 0x4
  47. #define LADSPA_PORT_AUDIO 0x8
  48. // Port Hints
  49. #define LADSPA_PORT_UNIT 0x1
  50. #define LADSPA_PORT_DEFAULT 0x2
  51. #define LADSPA_PORT_LABEL 0x4
  52. #define LADSPA_PORT_HAS_UNIT(x) ((x) & LADSPA_PORT_UNIT)
  53. #define LADSPA_PORT_HAS_DEFAULT(x) ((x) & LADSPA_PORT_DEFAULT)
  54. #define LADSPA_PORT_HAS_LABEL(x) ((x) & LADSPA_PORT_LABEL)
  55. // Plugin Types
  56. #define LADSPA_PLUGIN_UTILITY 0x000000001LL
  57. #define LADSPA_PLUGIN_GENERATOR 0x000000002LL
  58. #define LADSPA_PLUGIN_SIMULATOR 0x000000004LL
  59. #define LADSPA_PLUGIN_OSCILLATOR 0x000000008LL
  60. #define LADSPA_PLUGIN_TIME 0x000000010LL
  61. #define LADSPA_PLUGIN_DELAY 0x000000020LL
  62. #define LADSPA_PLUGIN_PHASER 0x000000040LL
  63. #define LADSPA_PLUGIN_FLANGER 0x000000080LL
  64. #define LADSPA_PLUGIN_CHORUS 0x000000100LL
  65. #define LADSPA_PLUGIN_REVERB 0x000000200LL
  66. #define LADSPA_PLUGIN_FREQUENCY 0x000000400LL
  67. #define LADSPA_PLUGIN_FREQUENCY_METER 0x000000800LL
  68. #define LADSPA_PLUGIN_FILTER 0x000001000LL
  69. #define LADSPA_PLUGIN_LOWPASS 0x000002000LL
  70. #define LADSPA_PLUGIN_HIGHPASS 0x000004000LL
  71. #define LADSPA_PLUGIN_BANDPASS 0x000008000LL
  72. #define LADSPA_PLUGIN_COMB 0x000010000LL
  73. #define LADSPA_PLUGIN_ALLPASS 0x000020000LL
  74. #define LADSPA_PLUGIN_EQ 0x000040000LL
  75. #define LADSPA_PLUGIN_PARAEQ 0x000080000LL
  76. #define LADSPA_PLUGIN_MULTIEQ 0x000100000LL
  77. #define LADSPA_PLUGIN_AMPLITUDE 0x000200000LL
  78. #define LADSPA_PLUGIN_PITCH 0x000400000LL
  79. #define LADSPA_PLUGIN_AMPLIFIER 0x000800000LL
  80. #define LADSPA_PLUGIN_WAVESHAPER 0x001000000LL
  81. #define LADSPA_PLUGIN_MODULATOR 0x002000000LL
  82. #define LADSPA_PLUGIN_DISTORTION 0x004000000LL
  83. #define LADSPA_PLUGIN_DYNAMICS 0x008000000LL
  84. #define LADSPA_PLUGIN_COMPRESSOR 0x010000000LL
  85. #define LADSPA_PLUGIN_EXPANDER 0x020000000LL
  86. #define LADSPA_PLUGIN_LIMITER 0x040000000LL
  87. #define LADSPA_PLUGIN_GATE 0x080000000LL
  88. #define LADSPA_PLUGIN_SPECTRAL 0x100000000LL
  89. #define LADSPA_PLUGIN_NOTCH 0x200000000LL
  90. #define LADSPA_GROUP_DYNAMICS (LADSPA_PLUGIN_DYNAMICS|LADSPA_PLUGIN_COMPRESSOR|LADSPA_PLUGIN_EXPANDER|LADSPA_PLUGIN_LIMITER|LADSPA_PLUGIN_GATE)
  91. #define LADSPA_GROUP_AMPLITUDE (LADSPA_PLUGIN_AMPLITUDE|LADSPA_PLUGIN_AMPLIFIER|LADSPA_PLUGIN_WAVESHAPER|LADSPA_PLUGIN_MODULATOR|LADSPA_PLUGIN_DISTORTION|LADSPA_GROUP_DYNAMICS)
  92. #define LADSPA_GROUP_EQ (LADSPA_PLUGIN_EQ|LADSPA_PLUGIN_PARAEQ|LADSPA_PLUGIN_MULTIEQ)
  93. #define LADSPA_GROUP_FILTER (LADSPA_PLUGIN_FILTER|LADSPA_PLUGIN_LOWPASS|LADSPA_PLUGIN_HIGHPASS|LADSPA_PLUGIN_BANDPASS|LADSPA_PLUGIN_COMB|LADSPA_PLUGIN_ALLPASS|LADSPA_PLUGIN_NOTCH)
  94. #define LADSPA_GROUP_FREQUENCY (LADSPA_PLUGIN_FREQUENCY|LADSPA_PLUGIN_FREQUENCY_METER|LADSPA_GROUP_FILTER|LADSPA_GROUP_EQ|LADSPA_PLUGIN_PITCH)
  95. #define LADSPA_GROUP_SIMULATOR (LADSPA_PLUGIN_SIMULATOR|LADSPA_PLUGIN_REVERB)
  96. #define LADSPA_GROUP_TIME (LADSPA_PLUGIN_TIME|LADSPA_PLUGIN_DELAY|LADSPA_PLUGIN_PHASER|LADSPA_PLUGIN_FLANGER|LADSPA_PLUGIN_CHORUS|LADSPA_PLUGIN_REVERB)
  97. #define LADSPA_GROUP_GENERATOR (LADSPA_PLUGIN_GENERATOR|LADSPA_PLUGIN_OSCILLATOR)
  98. #define LADSPA_IS_PLUGIN_DYNAMICS(x) ((x) & LADSPA_GROUP_DYNAMICS)
  99. #define LADSPA_IS_PLUGIN_AMPLITUDE(x) ((x) & LADSPA_GROUP_AMPLITUDE)
  100. #define LADSPA_IS_PLUGIN_EQ(x) ((x) & LADSPA_GROUP_EQ)
  101. #define LADSPA_IS_PLUGIN_FILTER(x) ((x) & LADSPA_GROUP_FILTER)
  102. #define LADSPA_IS_PLUGIN_FREQUENCY(x) ((x) & LADSPA_GROUP_FREQUENCY)
  103. #define LADSPA_IS_PLUGIN_SIMULATOR(x) ((x) & LADSPA_GROUP_SIMULATOR)
  104. #define LADSPA_IS_PLUGIN_TIME(x) ((x) & LADSPA_GROUP_TIME)
  105. #define LADSPA_IS_PLUGIN_GENERATOR(x) ((x) & LADSPA_GROUP_GENERATOR)
  106. // Scale Point
  107. struct LADSPA_RDF_ScalePoint {
  108. LADSPA_Data Value;
  109. const char* Label;
  110. LADSPA_RDF_ScalePoint() noexcept
  111. : Value(0.0f),
  112. Label(nullptr) {}
  113. ~LADSPA_RDF_ScalePoint()
  114. {
  115. if (Label != nullptr)
  116. {
  117. delete[] Label;
  118. Label = nullptr;
  119. }
  120. }
  121. CARLA_DECLARE_NON_COPY_STRUCT(LADSPA_RDF_ScalePoint)
  122. };
  123. // Port
  124. struct LADSPA_RDF_Port {
  125. LADSPA_Property Type;
  126. LADSPA_Property Hints;
  127. const char* Label;
  128. LADSPA_Data Default;
  129. LADSPA_Property Unit;
  130. unsigned long ScalePointCount;
  131. LADSPA_RDF_ScalePoint* ScalePoints;
  132. LADSPA_RDF_Port() noexcept
  133. : Type(0x0),
  134. Hints(0x0),
  135. Label(nullptr),
  136. Default(0.0f),
  137. Unit(0),
  138. ScalePointCount(0),
  139. ScalePoints(nullptr) {}
  140. ~LADSPA_RDF_Port()
  141. {
  142. if (Label != nullptr)
  143. {
  144. delete[] Label;
  145. Label = nullptr;
  146. }
  147. if (ScalePoints != nullptr)
  148. {
  149. delete[] ScalePoints;
  150. ScalePoints = nullptr;
  151. }
  152. }
  153. CARLA_DECLARE_NON_COPY_STRUCT(LADSPA_RDF_Port)
  154. };
  155. // Plugin Descriptor
  156. struct LADSPA_RDF_Descriptor {
  157. LADSPA_PluginType Type;
  158. unsigned long UniqueID;
  159. const char* Title;
  160. const char* Creator;
  161. unsigned long PortCount;
  162. LADSPA_RDF_Port* Ports;
  163. LADSPA_RDF_Descriptor() noexcept
  164. : Type(0x0),
  165. UniqueID(0),
  166. Title(nullptr),
  167. Creator(nullptr),
  168. PortCount(0),
  169. Ports(nullptr) {}
  170. ~LADSPA_RDF_Descriptor()
  171. {
  172. if (Title != nullptr)
  173. {
  174. delete[] Title;
  175. Title = nullptr;
  176. }
  177. if (Creator != nullptr)
  178. {
  179. delete[] Creator;
  180. Creator = nullptr;
  181. }
  182. if (Ports != nullptr)
  183. {
  184. delete[] Ports;
  185. Ports = nullptr;
  186. }
  187. }
  188. CARLA_DECLARE_NON_COPY_STRUCT(LADSPA_RDF_Descriptor)
  189. };
  190. #endif // LADSPA_RDF_HPP_INCLUDED