interface.cc 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146
  1. /*
  2. interface.cc
  3. Copyright 2004-11 Tim Goetze <tim@quitte.de>
  4. http://quitte.de/dsp/
  5. LADSPA descriptor factory, host interface.
  6. */
  7. /*
  8. This program is free software; you can redistribute it and/or
  9. modify it under the terms of the GNU General Public License
  10. as published by the Free Software Foundation; either version 2
  11. of the License, or (at your option) any later version.
  12. This program is distributed in the hope that it will be useful,
  13. but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  15. GNU General Public License for more details.
  16. You should have received a copy of the GNU General Public License
  17. along with this program; if not, write to the Free Software
  18. Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
  19. 02111-1307, USA or point your web browser to http://www.gnu.org.
  20. */
  21. /*
  22. LADSPA ID ranges 1761 - 1800 and 2581 - 2660
  23. (2541 - 2580 donated to artemio@kdemail.net)
  24. */
  25. #include <sys/time.h>
  26. #include "basics.h"
  27. #include "Cabinet.h"
  28. #include "Chorus.h"
  29. #include "Phaser.h"
  30. #include "Sin.h"
  31. #include "Lorenz.h"
  32. #include "Roessler.h"
  33. #include "Reverb.h"
  34. #include "Compress.h"
  35. #include "Click.h"
  36. #include "Eq.h"
  37. #include "Clip.h"
  38. #include "White.h"
  39. #include "SweepVF.h"
  40. #include "VCO.h"
  41. #include "Amp.h"
  42. #include "HRTF.h"
  43. #include "Pan.h"
  44. #include "Scape.h"
  45. #include "ToneStack.h"
  46. #include "Descriptor.h"
  47. #define N 39
  48. static DescriptorStub * descriptors [N];
  49. /*static inline void
  50. seed()
  51. {
  52. static struct timeval tv;
  53. gettimeofday (&tv, 0);
  54. srand (tv.tv_sec ^ tv.tv_usec);
  55. }*/
  56. extern "C" {
  57. __attribute__ ((constructor))
  58. void caps_so_init()
  59. {
  60. DescriptorStub ** d = descriptors;
  61. *d++ = new Descriptor<Eq>();
  62. *d++ = new Descriptor<Eq2x2>();
  63. *d++ = new Descriptor<Compress>();
  64. *d++ = new Descriptor<Pan>();
  65. *d++ = new Descriptor<Narrower>();
  66. *d++ = new Descriptor<PreampIII>();
  67. *d++ = new Descriptor<PreampIV>();
  68. *d++ = new Descriptor<ToneStack>();
  69. *d++ = new Descriptor<ToneStackLT>();
  70. *d++ = new Descriptor<AmpIII>();
  71. *d++ = new Descriptor<AmpIV>();
  72. *d++ = new Descriptor<AmpV>();
  73. *d++ = new Descriptor<AmpVTS>();
  74. *d++ = new Descriptor<CabinetI>();
  75. *d++ = new Descriptor<CabinetII>();
  76. *d++ = new Descriptor<Clip>();
  77. *d++ = new Descriptor<ChorusI>();
  78. *d++ = new Descriptor<StereoChorusI>();
  79. *d++ = new Descriptor<ChorusII>();
  80. *d++ = new Descriptor<StereoChorusII>();
  81. *d++ = new Descriptor<PhaserI>();
  82. *d++ = new Descriptor<PhaserII>();
  83. *d++ = new Descriptor<SweepVFI>();
  84. *d++ = new Descriptor<SweepVFII>();
  85. *d++ = new Descriptor<AutoWah>();
  86. *d++ = new Descriptor<Scape>();
  87. *d++ = new Descriptor<VCOs>();
  88. *d++ = new Descriptor<VCOd>();
  89. *d++ = new Descriptor<CEO>();
  90. *d++ = new Descriptor<Sin>();
  91. *d++ = new Descriptor<White>();
  92. *d++ = new Descriptor<Lorenz>();
  93. *d++ = new Descriptor<Roessler>();
  94. *d++ = new Descriptor<JVRev>();
  95. *d++ = new Descriptor<Plate>();
  96. *d++ = new Descriptor<Plate2x2>();
  97. *d++ = new Descriptor<Click>();
  98. *d++ = new Descriptor<Dirac>();
  99. *d++ = new Descriptor<HRTF>();
  100. /* make sure N is correct */
  101. assert (d - descriptors == N);
  102. //seed();
  103. }
  104. __attribute__ ((destructor))
  105. void caps_so_fini()
  106. {
  107. for (ulong i = 0; i < N; ++i)
  108. delete descriptors[i];
  109. }
  110. /* /////////////////////////////////////////////////////////////////////// */
  111. const LADSPA_Descriptor *
  112. ladspa_descriptor (unsigned long i)
  113. {
  114. if (i < N)
  115. return descriptors[i];
  116. return 0;
  117. }
  118. }; /* extern "C" */