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.

ladspa_rdf.hpp 7.5KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192
  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 GPL.txt file
  16. */
  17. #ifndef LADSPA_RDF_INCLUDED
  18. #define LADSPA_RDF_INCLUDED
  19. // Base Types
  20. typedef float LADSPA_Data;
  21. typedef int LADSPA_Property;
  22. typedef unsigned long long LADSPA_PluginType;
  23. // Unit Types
  24. #define LADSPA_UNIT_DB 0x01
  25. #define LADSPA_UNIT_COEF 0x02
  26. #define LADSPA_UNIT_HZ 0x04
  27. #define LADSPA_UNIT_S 0x08
  28. #define LADSPA_UNIT_MS 0x10
  29. #define LADSPA_UNIT_MIN 0x20
  30. #define LADSPA_UNIT_CLASS_AMPLITUDE (LADSPA_UNIT_DB|LADSPA_UNIT_COEF)
  31. #define LADSPA_UNIT_CLASS_FREQUENCY (LADSPA_UNIT_HZ)
  32. #define LADSPA_UNIT_CLASS_TIME (LADSPA_UNIT_S|LADSPA_UNIT_MS|LADSPA_UNIT_MIN)
  33. #define LADSPA_IS_UNIT_DB(x) ((x) == LADSPA_UNIT_DB)
  34. #define LADSPA_IS_UNIT_COEF(x) ((x) == LADSPA_UNIT_COEF)
  35. #define LADSPA_IS_UNIT_HZ(x) ((x) == LADSPA_UNIT_HZ)
  36. #define LADSPA_IS_UNIT_S(x) ((x) == LADSPA_UNIT_S)
  37. #define LADSPA_IS_UNIT_MS(x) ((x) == LADSPA_UNIT_MS)
  38. #define LADSPA_IS_UNIT_MIN(x) ((x) == LADSPA_UNIT_MIN)
  39. #define LADSPA_IS_UNIT_CLASS_AMPLITUDE(x) ((x) & LADSPA_UNIT_CLASS_AMPLITUDE)
  40. #define LADSPA_IS_UNIT_CLASS_FREQUENCY(x) ((x) & LADSPA_UNIT_CLASS_FREQUENCY)
  41. #define LADSPA_IS_UNIT_CLASS_TIME(x) ((x) & LADSPA_UNIT_CLASS_TIME)
  42. // Port Types (Official API)
  43. #define LADSPA_PORT_INPUT 0x1
  44. #define LADSPA_PORT_OUTPUT 0x2
  45. #define LADSPA_PORT_CONTROL 0x4
  46. #define LADSPA_PORT_AUDIO 0x8
  47. // Port Hints
  48. #define LADSPA_PORT_UNIT 0x1
  49. #define LADSPA_PORT_DEFAULT 0x2
  50. #define LADSPA_PORT_LABEL 0x4
  51. #define LADSPA_PORT_HAS_UNIT(x) ((x) & LADSPA_PORT_UNIT)
  52. #define LADSPA_PORT_HAS_DEFAULT(x) ((x) & LADSPA_PORT_DEFAULT)
  53. #define LADSPA_PORT_HAS_LABEL(x) ((x) & LADSPA_PORT_LABEL)
  54. // Plugin Types
  55. #define LADSPA_PLUGIN_UTILITY 0x000000001LL
  56. #define LADSPA_PLUGIN_GENERATOR 0x000000002LL
  57. #define LADSPA_PLUGIN_SIMULATOR 0x000000004LL
  58. #define LADSPA_PLUGIN_OSCILLATOR 0x000000008LL
  59. #define LADSPA_PLUGIN_TIME 0x000000010LL
  60. #define LADSPA_PLUGIN_DELAY 0x000000020LL
  61. #define LADSPA_PLUGIN_PHASER 0x000000040LL
  62. #define LADSPA_PLUGIN_FLANGER 0x000000080LL
  63. #define LADSPA_PLUGIN_CHORUS 0x000000100LL
  64. #define LADSPA_PLUGIN_REVERB 0x000000200LL
  65. #define LADSPA_PLUGIN_FREQUENCY 0x000000400LL
  66. #define LADSPA_PLUGIN_FREQUENCY_METER 0x000000800LL
  67. #define LADSPA_PLUGIN_FILTER 0x000001000LL
  68. #define LADSPA_PLUGIN_LOWPASS 0x000002000LL
  69. #define LADSPA_PLUGIN_HIGHPASS 0x000004000LL
  70. #define LADSPA_PLUGIN_BANDPASS 0x000008000LL
  71. #define LADSPA_PLUGIN_COMB 0x000010000LL
  72. #define LADSPA_PLUGIN_ALLPASS 0x000020000LL
  73. #define LADSPA_PLUGIN_EQ 0x000040000LL
  74. #define LADSPA_PLUGIN_PARAEQ 0x000080000LL
  75. #define LADSPA_PLUGIN_MULTIEQ 0x000100000LL
  76. #define LADSPA_PLUGIN_AMPLITUDE 0x000200000LL
  77. #define LADSPA_PLUGIN_PITCH 0x000400000LL
  78. #define LADSPA_PLUGIN_AMPLIFIER 0x000800000LL
  79. #define LADSPA_PLUGIN_WAVESHAPER 0x001000000LL
  80. #define LADSPA_PLUGIN_MODULATOR 0x002000000LL
  81. #define LADSPA_PLUGIN_DISTORTION 0x004000000LL
  82. #define LADSPA_PLUGIN_DYNAMICS 0x008000000LL
  83. #define LADSPA_PLUGIN_COMPRESSOR 0x010000000LL
  84. #define LADSPA_PLUGIN_EXPANDER 0x020000000LL
  85. #define LADSPA_PLUGIN_LIMITER 0x040000000LL
  86. #define LADSPA_PLUGIN_GATE 0x080000000LL
  87. #define LADSPA_PLUGIN_SPECTRAL 0x100000000LL
  88. #define LADSPA_PLUGIN_NOTCH 0x200000000LL
  89. #define LADSPA_GROUP_DYNAMICS (LADSPA_PLUGIN_DYNAMICS|LADSPA_PLUGIN_COMPRESSOR|LADSPA_PLUGIN_EXPANDER|LADSPA_PLUGIN_LIMITER|LADSPA_PLUGIN_GATE)
  90. #define LADSPA_GROUP_AMPLITUDE (LADSPA_PLUGIN_AMPLITUDE|LADSPA_PLUGIN_AMPLIFIER|LADSPA_PLUGIN_WAVESHAPER|LADSPA_PLUGIN_MODULATOR|LADSPA_PLUGIN_DISTORTION|LADSPA_GROUP_DYNAMICS)
  91. #define LADSPA_GROUP_EQ (LADSPA_PLUGIN_EQ|LADSPA_PLUGIN_PARAEQ|LADSPA_PLUGIN_MULTIEQ)
  92. #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)
  93. #define LADSPA_GROUP_FREQUENCY (LADSPA_PLUGIN_FREQUENCY|LADSPA_PLUGIN_FREQUENCY_METER|LADSPA_GROUP_FILTER|LADSPA_GROUP_EQ|LADSPA_PLUGIN_PITCH)
  94. #define LADSPA_GROUP_SIMULATOR (LADSPA_PLUGIN_SIMULATOR|LADSPA_PLUGIN_REVERB)
  95. #define LADSPA_GROUP_TIME (LADSPA_PLUGIN_TIME|LADSPA_PLUGIN_DELAY|LADSPA_PLUGIN_PHASER|LADSPA_PLUGIN_FLANGER|LADSPA_PLUGIN_CHORUS|LADSPA_PLUGIN_REVERB)
  96. #define LADSPA_GROUP_GENERATOR (LADSPA_PLUGIN_GENERATOR|LADSPA_PLUGIN_OSCILLATOR)
  97. #define LADSPA_IS_PLUGIN_DYNAMICS(x) ((x) & LADSPA_GROUP_DYNAMICS)
  98. #define LADSPA_IS_PLUGIN_AMPLITUDE(x) ((x) & LADSPA_GROUP_AMPLITUDE)
  99. #define LADSPA_IS_PLUGIN_EQ(x) ((x) & LADSPA_GROUP_EQ)
  100. #define LADSPA_IS_PLUGIN_FILTER(x) ((x) & LADSPA_GROUP_FILTER)
  101. #define LADSPA_IS_PLUGIN_FREQUENCY(x) ((x) & LADSPA_GROUP_FREQUENCY)
  102. #define LADSPA_IS_PLUGIN_SIMULATOR(x) ((x) & LADSPA_GROUP_SIMULATOR)
  103. #define LADSPA_IS_PLUGIN_TIME(x) ((x) & LADSPA_GROUP_TIME)
  104. #define LADSPA_IS_PLUGIN_GENERATOR(x) ((x) & LADSPA_GROUP_GENERATOR)
  105. // Scale Point
  106. struct LADSPA_RDF_ScalePoint {
  107. LADSPA_Data Value;
  108. const char* Label;
  109. LADSPA_RDF_ScalePoint()
  110. : Value(0.0f),
  111. Label(nullptr) {}
  112. ~LADSPA_RDF_ScalePoint()
  113. {
  114. if (Label != nullptr)
  115. delete[] Label;
  116. }
  117. };
  118. // Port
  119. struct LADSPA_RDF_Port {
  120. LADSPA_Property Type;
  121. LADSPA_Property Hints;
  122. const char* Label;
  123. LADSPA_Data Default;
  124. LADSPA_Property Unit;
  125. unsigned long ScalePointCount;
  126. LADSPA_RDF_ScalePoint* ScalePoints;
  127. LADSPA_RDF_Port()
  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()
  136. {
  137. if (Label != nullptr)
  138. delete[] Label;
  139. if (ScalePoints != nullptr)
  140. delete[] ScalePoints;
  141. }
  142. };
  143. // Plugin
  144. struct LADSPA_RDF_Descriptor {
  145. LADSPA_PluginType Type;
  146. unsigned long UniqueID;
  147. const char* Title;
  148. const char* Creator;
  149. unsigned long PortCount;
  150. LADSPA_RDF_Port* Ports;
  151. LADSPA_RDF_Descriptor()
  152. : Type(0x0),
  153. UniqueID(0),
  154. Title(nullptr),
  155. Creator(nullptr),
  156. PortCount(0),
  157. Ports(nullptr) {}
  158. ~LADSPA_RDF_Descriptor()
  159. {
  160. if (Title != nullptr)
  161. delete[] Title;
  162. if (Creator != nullptr)
  163. delete[] Creator;
  164. if (Ports != nullptr)
  165. delete[] Ports;
  166. }
  167. };
  168. #endif // LADSPA_RDF_INCLUDED