CLAM-Development  1.4.0
LadspaLibrary.hxx
Go to the documentation of this file.
1 #ifndef LadspaLibrary_hxx
2 #define LadspaLibrary_hxx
3 
4 #include <ladspa.h>
5 #include <vector>
6 
7 namespace CLAM
8 {
9 
20 {
21  std::vector<LADSPA_Descriptor * > _descriptors;
22  static void CleanUpDescriptor(LADSPA_Descriptor *& descriptor)
23  {
24  if (not descriptor) return;
25  delete[] descriptor->Label;
26  delete[] descriptor->Name;
27  delete[] descriptor->Maker;
28  delete[] descriptor->Copyright;
29  delete[] descriptor->PortDescriptors;
30 
31  for (unsigned long lIndex = 0; lIndex < descriptor->PortCount; lIndex++)
32  delete[] descriptor->PortNames[lIndex];
33 
34  delete[] descriptor->PortNames;
35  delete[] descriptor->PortRangeHints;
36  delete descriptor;
37  descriptor = 0;
38  }
39 public:
41  {
42  }
44  {
45  for (unsigned i=0; i<_descriptors.size(); i++)
46  CleanUpDescriptor(_descriptors[i]);
47  }
48  void AddPluginType(LADSPA_Descriptor * descriptor)
49  {
50  _descriptors.push_back(descriptor);
51  }
52  LADSPA_Descriptor * pluginAt(unsigned long i)
53  {
54  if (i>=_descriptors.size()) return 0;
55  return _descriptors[i];
56  }
57  static char *dupstr( char const *args )
58  {
59  const size_t v = strlen(args) + 1;
60  char * s = new char[v];
61  memcpy( s, args, v);
62  return s;
63  }
64 
65 };
66 }
67 
68 #endif//LadspaLibrary_hxx
69