LadspaLibrary.hxx

Go to the documentation of this file.
00001 #ifndef LadspaLibrary_hxx
00002 #define LadspaLibrary_hxx
00003 
00004 #include <ladspa.h>
00005 #include <vector>
00006 
00007 namespace CLAM
00008 {
00009 
00019 class LadspaLibrary
00020 {
00021         std::vector<LADSPA_Descriptor * > _descriptors;
00022         static void CleanUpDescriptor(LADSPA_Descriptor *& descriptor)
00023         {
00024                 if (not descriptor) return;
00025                 delete[] descriptor->Label;
00026                 delete[] descriptor->Name;
00027                 delete[] descriptor->Maker;
00028                 delete[] descriptor->Copyright;
00029                 delete[] descriptor->PortDescriptors;
00030 
00031                 for (unsigned long lIndex = 0; lIndex < descriptor->PortCount; lIndex++)
00032                         delete[] descriptor->PortNames[lIndex];
00033 
00034                 delete[] descriptor->PortNames;
00035                 delete[] descriptor->PortRangeHints;
00036                 delete descriptor;
00037                 descriptor = 0;
00038         }
00039 public:
00040         LadspaLibrary()
00041         {
00042         }
00043         ~LadspaLibrary()
00044         {
00045                 for (unsigned i=0; i<_descriptors.size(); i++)
00046                         CleanUpDescriptor(_descriptors[i]);
00047         }
00048         void AddPluginType(LADSPA_Descriptor * descriptor)
00049         {
00050                 _descriptors.push_back(descriptor);
00051         }
00052         LADSPA_Descriptor * pluginAt(unsigned long i)
00053         {
00054                 if (i>=_descriptors.size()) return 0;
00055                 return _descriptors[i];
00056         }
00057         static char *dupstr( char const *args )
00058         {
00059                 const size_t v = strlen(args) + 1;
00060                 char * s = new char[v];
00061                 memcpy( s, args, v);
00062                 return s;
00063         } 
00064 
00065 };
00066 }
00067 
00068 #endif//LadspaLibrary_hxx
00069 
Generated by  doxygen 1.6.3