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.

213 lines
8.5KB

  1. /*
  2. * Custom types to store LADSPA-RDF information
  3. * Copyright (C) 2011-2022 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. #include "ladspa/ladspa.h"
  21. // Base Types
  22. typedef int LADSPA_RDF_Property;
  23. typedef unsigned long long LADSPA_RDF_PluginType;
  24. // Unit Types
  25. #define LADSPA_RDF_UNIT_DB 0x01
  26. #define LADSPA_RDF_UNIT_COEF 0x02
  27. #define LADSPA_RDF_UNIT_HZ 0x04
  28. #define LADSPA_RDF_UNIT_S 0x08
  29. #define LADSPA_RDF_UNIT_MS 0x10
  30. #define LADSPA_RDF_UNIT_MIN 0x20
  31. #define LADSPA_RDF_UNIT_CLASS_AMPLITUDE (LADSPA_RDF_UNIT_DB|LADSPA_RDF_UNIT_COEF)
  32. #define LADSPA_RDF_UNIT_CLASS_FREQUENCY (LADSPA_RDF_UNIT_HZ)
  33. #define LADSPA_RDF_UNIT_CLASS_TIME (LADSPA_RDF_UNIT_S|LADSPA_RDF_UNIT_MS|LADSPA_RDF_UNIT_MIN)
  34. #define LADSPA_RDF_IS_UNIT_DB(x) ((x) == LADSPA_RDF_UNIT_DB)
  35. #define LADSPA_RDF_IS_UNIT_COEF(x) ((x) == LADSPA_RDF_UNIT_COEF)
  36. #define LADSPA_RDF_IS_UNIT_HZ(x) ((x) == LADSPA_RDF_UNIT_HZ)
  37. #define LADSPA_RDF_IS_UNIT_S(x) ((x) == LADSPA_RDF_UNIT_S)
  38. #define LADSPA_RDF_IS_UNIT_MS(x) ((x) == LADSPA_RDF_UNIT_MS)
  39. #define LADSPA_RDF_IS_UNIT_MIN(x) ((x) == LADSPA_RDF_UNIT_MIN)
  40. #define LADSPA_RDF_IS_UNIT_CLASS_AMPLITUDE(x) ((x) & LADSPA_RDF_UNIT_CLASS_AMPLITUDE)
  41. #define LADSPA_RDF_IS_UNIT_CLASS_FREQUENCY(x) ((x) & LADSPA_RDF_UNIT_CLASS_FREQUENCY)
  42. #define LADSPA_RDF_IS_UNIT_CLASS_TIME(x) ((x) & LADSPA_RDF_UNIT_CLASS_TIME)
  43. // Port Hints
  44. #define LADSPA_RDF_PORT_UNIT 0x1
  45. #define LADSPA_RDF_PORT_DEFAULT 0x2
  46. #define LADSPA_RDF_PORT_LABEL 0x4
  47. #define LADSPA_RDF_PORT_HAS_UNIT(x) ((x) & LADSPA_RDF_PORT_UNIT)
  48. #define LADSPA_RDF_PORT_HAS_DEFAULT(x) ((x) & LADSPA_RDF_PORT_DEFAULT)
  49. #define LADSPA_RDF_PORT_HAS_LABEL(x) ((x) & LADSPA_RDF_PORT_LABEL)
  50. // Plugin Types
  51. #define LADSPA_RDF_PLUGIN_UTILITY 0x000000001LL
  52. #define LADSPA_RDF_PLUGIN_GENERATOR 0x000000002LL
  53. #define LADSPA_RDF_PLUGIN_SIMULATOR 0x000000004LL
  54. #define LADSPA_RDF_PLUGIN_OSCILLATOR 0x000000008LL
  55. #define LADSPA_RDF_PLUGIN_TIME 0x000000010LL
  56. #define LADSPA_RDF_PLUGIN_DELAY 0x000000020LL
  57. #define LADSPA_RDF_PLUGIN_PHASER 0x000000040LL
  58. #define LADSPA_RDF_PLUGIN_FLANGER 0x000000080LL
  59. #define LADSPA_RDF_PLUGIN_CHORUS 0x000000100LL
  60. #define LADSPA_RDF_PLUGIN_REVERB 0x000000200LL
  61. #define LADSPA_RDF_PLUGIN_FREQUENCY 0x000000400LL
  62. #define LADSPA_RDF_PLUGIN_FREQUENCY_METER 0x000000800LL
  63. #define LADSPA_RDF_PLUGIN_FILTER 0x000001000LL
  64. #define LADSPA_RDF_PLUGIN_LOWPASS 0x000002000LL
  65. #define LADSPA_RDF_PLUGIN_HIGHPASS 0x000004000LL
  66. #define LADSPA_RDF_PLUGIN_BANDPASS 0x000008000LL
  67. #define LADSPA_RDF_PLUGIN_COMB 0x000010000LL
  68. #define LADSPA_RDF_PLUGIN_ALLPASS 0x000020000LL
  69. #define LADSPA_RDF_PLUGIN_EQ 0x000040000LL
  70. #define LADSPA_RDF_PLUGIN_PARAEQ 0x000080000LL
  71. #define LADSPA_RDF_PLUGIN_MULTIEQ 0x000100000LL
  72. #define LADSPA_RDF_PLUGIN_AMPLITUDE 0x000200000LL
  73. #define LADSPA_RDF_PLUGIN_PITCH 0x000400000LL
  74. #define LADSPA_RDF_PLUGIN_AMPLIFIER 0x000800000LL
  75. #define LADSPA_RDF_PLUGIN_WAVESHAPER 0x001000000LL
  76. #define LADSPA_RDF_PLUGIN_MODULATOR 0x002000000LL
  77. #define LADSPA_RDF_PLUGIN_DISTORTION 0x004000000LL
  78. #define LADSPA_RDF_PLUGIN_DYNAMICS 0x008000000LL
  79. #define LADSPA_RDF_PLUGIN_COMPRESSOR 0x010000000LL
  80. #define LADSPA_RDF_PLUGIN_EXPANDER 0x020000000LL
  81. #define LADSPA_RDF_PLUGIN_LIMITER 0x040000000LL
  82. #define LADSPA_RDF_PLUGIN_GATE 0x080000000LL
  83. #define LADSPA_RDF_PLUGIN_SPECTRAL 0x100000000LL
  84. #define LADSPA_RDF_PLUGIN_NOTCH 0x200000000LL
  85. #define LADSPA_RDF_GROUP_DYNAMICS (LADSPA_RDF_PLUGIN_DYNAMICS|LADSPA_RDF_PLUGIN_COMPRESSOR|LADSPA_RDF_PLUGIN_EXPANDER|LADSPA_RDF_PLUGIN_LIMITER|LADSPA_RDF_PLUGIN_GATE)
  86. #define LADSPA_RDF_GROUP_AMPLITUDE (LADSPA_RDF_PLUGIN_AMPLITUDE|LADSPA_RDF_PLUGIN_AMPLIFIER|LADSPA_RDF_PLUGIN_WAVESHAPER|LADSPA_RDF_PLUGIN_MODULATOR|LADSPA_RDF_PLUGIN_DISTORTION|LADSPA_RDF_GROUP_DYNAMICS)
  87. #define LADSPA_RDF_GROUP_EQ (LADSPA_RDF_PLUGIN_EQ|LADSPA_RDF_PLUGIN_PARAEQ|LADSPA_RDF_PLUGIN_MULTIEQ)
  88. #define LADSPA_RDF_GROUP_FILTER (LADSPA_RDF_PLUGIN_FILTER|LADSPA_RDF_PLUGIN_LOWPASS|LADSPA_RDF_PLUGIN_HIGHPASS|LADSPA_RDF_PLUGIN_BANDPASS|LADSPA_RDF_PLUGIN_COMB|LADSPA_RDF_PLUGIN_ALLPASS|LADSPA_RDF_PLUGIN_NOTCH)
  89. #define LADSPA_RDF_GROUP_FREQUENCY (LADSPA_RDF_PLUGIN_FREQUENCY|LADSPA_RDF_PLUGIN_FREQUENCY_METER|LADSPA_RDF_GROUP_FILTER|LADSPA_RDF_GROUP_EQ|LADSPA_RDF_PLUGIN_PITCH)
  90. #define LADSPA_RDF_GROUP_SIMULATOR (LADSPA_RDF_PLUGIN_SIMULATOR|LADSPA_RDF_PLUGIN_REVERB)
  91. #define LADSPA_RDF_GROUP_TIME (LADSPA_RDF_PLUGIN_TIME|LADSPA_RDF_PLUGIN_DELAY|LADSPA_RDF_PLUGIN_PHASER|LADSPA_RDF_PLUGIN_FLANGER|LADSPA_RDF_PLUGIN_CHORUS|LADSPA_RDF_PLUGIN_REVERB)
  92. #define LADSPA_RDF_GROUP_GENERATOR (LADSPA_RDF_PLUGIN_GENERATOR|LADSPA_RDF_PLUGIN_OSCILLATOR)
  93. #define LADSPA_RDF_IS_PLUGIN_DYNAMICS(x) ((x) & LADSPA_RDF_GROUP_DYNAMICS)
  94. #define LADSPA_RDF_IS_PLUGIN_AMPLITUDE(x) ((x) & LADSPA_RDF_GROUP_AMPLITUDE)
  95. #define LADSPA_RDF_IS_PLUGIN_EQ(x) ((x) & LADSPA_RDF_GROUP_EQ)
  96. #define LADSPA_RDF_IS_PLUGIN_FILTER(x) ((x) & LADSPA_RDF_GROUP_FILTER)
  97. #define LADSPA_RDF_IS_PLUGIN_FREQUENCY(x) ((x) & LADSPA_RDF_GROUP_FREQUENCY)
  98. #define LADSPA_RDF_IS_PLUGIN_SIMULATOR(x) ((x) & LADSPA_RDF_GROUP_SIMULATOR)
  99. #define LADSPA_RDF_IS_PLUGIN_TIME(x) ((x) & LADSPA_RDF_GROUP_TIME)
  100. #define LADSPA_RDF_IS_PLUGIN_GENERATOR(x) ((x) & LADSPA_RDF_GROUP_GENERATOR)
  101. // Scale Point
  102. struct LADSPA_RDF_ScalePoint {
  103. LADSPA_Data Value;
  104. const char* Label;
  105. LADSPA_RDF_ScalePoint() noexcept
  106. : Value(0.0f),
  107. Label(nullptr) {}
  108. ~LADSPA_RDF_ScalePoint() noexcept
  109. {
  110. if (Label != nullptr)
  111. {
  112. delete[] Label;
  113. Label = nullptr;
  114. }
  115. }
  116. CARLA_DECLARE_NON_COPYABLE(LADSPA_RDF_ScalePoint)
  117. };
  118. // Port
  119. struct LADSPA_RDF_Port {
  120. LADSPA_RDF_Property Type;
  121. LADSPA_RDF_Property Hints;
  122. const char* Label;
  123. LADSPA_Data Default;
  124. LADSPA_RDF_Property Unit;
  125. unsigned long ScalePointCount;
  126. LADSPA_RDF_ScalePoint* ScalePoints;
  127. LADSPA_RDF_Port() noexcept
  128. : Type(0x0),
  129. Hints(0x0),
  130. Label(nullptr),
  131. Default(0.0f),
  132. Unit(0),
  133. ScalePointCount(0),
  134. ScalePoints(nullptr) {}
  135. ~LADSPA_RDF_Port() noexcept
  136. {
  137. if (Label != nullptr)
  138. {
  139. delete[] Label;
  140. Label = nullptr;
  141. }
  142. if (ScalePoints != nullptr)
  143. {
  144. delete[] ScalePoints;
  145. ScalePoints = nullptr;
  146. }
  147. }
  148. CARLA_DECLARE_NON_COPYABLE(LADSPA_RDF_Port)
  149. };
  150. // Plugin Descriptor
  151. struct LADSPA_RDF_Descriptor {
  152. LADSPA_RDF_PluginType Type;
  153. unsigned long UniqueID;
  154. const char* Title;
  155. const char* Creator;
  156. unsigned long PortCount;
  157. LADSPA_RDF_Port* Ports;
  158. LADSPA_RDF_Descriptor() noexcept
  159. : Type(0x0),
  160. UniqueID(0),
  161. Title(nullptr),
  162. Creator(nullptr),
  163. PortCount(0),
  164. Ports(nullptr) {}
  165. ~LADSPA_RDF_Descriptor() noexcept
  166. {
  167. if (Title != nullptr)
  168. {
  169. delete[] Title;
  170. Title = nullptr;
  171. }
  172. if (Creator != nullptr)
  173. {
  174. delete[] Creator;
  175. Creator = nullptr;
  176. }
  177. if (Ports != nullptr)
  178. {
  179. delete[] Ports;
  180. Ports = nullptr;
  181. }
  182. }
  183. CARLA_DECLARE_NON_COPYABLE(LADSPA_RDF_Descriptor)
  184. };
  185. #endif // LADSPA_RDF_HPP_INCLUDED