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

12 years ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197
  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 modify
  6. * it under the terms of the GNU General Public License as published by
  7. * the Free Software Foundation; either version 2 of the License, or
  8. * 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 COPYING file
  16. */
  17. #ifndef LADSPA_RDF_INCLUDED
  18. #define LADSPA_RDF_INCLUDED
  19. #include <cstdlib>
  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()
  111. : Value(0.0f),
  112. Label(nullptr) {}
  113. ~LADSPA_RDF_ScalePoint()
  114. {
  115. if (Label)
  116. ::free((void*)Label);
  117. }
  118. };
  119. // Port
  120. struct LADSPA_RDF_Port {
  121. LADSPA_Property Type;
  122. LADSPA_Property Hints;
  123. const char* Label;
  124. LADSPA_Data Default;
  125. LADSPA_Property Unit;
  126. unsigned long ScalePointCount;
  127. LADSPA_RDF_ScalePoint* ScalePoints;
  128. LADSPA_RDF_Port()
  129. : Type(0x0),
  130. Hints(0x0),
  131. Label(nullptr),
  132. Default(0.0f),
  133. Unit(0),
  134. ScalePointCount(0),
  135. ScalePoints(nullptr) {}
  136. ~LADSPA_RDF_Port()
  137. {
  138. if (Label)
  139. ::free((void*)Label);
  140. if (ScalePoints)
  141. delete[] ScalePoints;
  142. }
  143. };
  144. // Plugin
  145. struct LADSPA_RDF_Descriptor {
  146. LADSPA_PluginType Type;
  147. unsigned long UniqueID;
  148. const char* Title;
  149. const char* Creator;
  150. unsigned long PortCount;
  151. LADSPA_RDF_Port* Ports;
  152. LADSPA_RDF_Descriptor()
  153. : Type(0x0),
  154. UniqueID(0),
  155. Title(nullptr),
  156. Creator(nullptr),
  157. PortCount(0),
  158. Ports(nullptr) {}
  159. ~LADSPA_RDF_Descriptor()
  160. {
  161. if (Title)
  162. ::free((void*)Title);
  163. if (Creator)
  164. ::free((void*)Creator);
  165. if (Ports)
  166. delete[] Ports;
  167. }
  168. };
  169. #endif // LADSPA_RDF_INCLUDED