/usr/include/CLAM/RunTimeFaustLibraryLoader.hxx is in libclam-dev 1.4.0-6.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 | #ifndef RunTimeFaustLibraryLoader_hxx
#define RunTimeFaustLibraryLoader_hxx
#include <dirent.h>
#include "RunTimeLibraryLoader.hxx"
#include "LadspaWrapperCreator.hxx"
#include <ladspa.h>
class RunTimeFaustLibraryLoader : public RunTimeLibraryLoader
{
public:
virtual void Load() const
{
std::string examplesDir = CompletePathFor("examples/ladspadir");
LoadLibrariesFromPath(examplesDir);
RunTimeLibraryLoader::Load(); // needed??
}
void LoadPlugin(const std::string & pluginFullPath) const
{
LoadLibrariesFromPath(pluginFullPath);
}
// overload as workaround of Load() overload and path issues
virtual std::list<std::string> GetUsedLibraries()
{
std::list<std::string> loadedLibraries=LoadedLibraries();
LoadedLibraries().clear();
return loadedLibraries;
}
protected:
virtual const bool needReleaseHandlerOnReload() const {return false; }
void SetupLibrary(void* handle, const std::string & pluginFullFilename) const
{
LADSPA_Descriptor_Function descriptorTable = 0;
descriptorTable = (LADSPA_Descriptor_Function)GetSymbol(handle, "ladspa_descriptor");
if (!descriptorTable)
{
// std::cout << "[FAUST-LADSPA Plugin] Warning: trying to open non ladspa plugin: " << pluginFullFilename << std::endl;
return;
}
LoadedLibraries().push_back(pluginFullFilename);
CLAM::ProcessingFactory& factory = CLAM::ProcessingFactory::GetInstance();
for (unsigned long i=0; descriptorTable(i); i++)
{
LADSPA_Descriptor* descriptor = (LADSPA_Descriptor*)descriptorTable(i);
std::ostringstream oss;
oss << descriptor->Label << i;
factory.AddCreatorWarningRepetitions(oss.str(),
new CLAM::LadspaWrapperCreator(pluginFullFilename,
i,
oss.str()));
factory.AddAttribute(oss.str(), "category", "FAUST");
factory.AddAttribute(oss.str(), "description", descriptor->Name);
factory.AddAttribute(oss.str(), "library", pluginFullFilename);
std::string pluginName=descriptor->Label;
const std::string diagramMainSufix=".dsp-svg/process.svg";
std::string svgFileDir = CompletePathFor( "examples/" + pluginName + diagramMainSufix);
if (svgFileDir != "")
{
factory.AddAttribute(oss.str(), "faust_diagram", svgFileDir);
}
if (!factory.AttributeExists(oss.str(), "embedded_svg"))
factory.AddAttribute(oss.str(), "embedded_svg", ":icons/images/faustlogo.svg");
if (!factory.AttributeExists(oss.str(), "icon"))
factory.AddAttribute(oss.str(), "icon", "faustlogo.svg");
std::string sourcePath=CompletePathFor( "examples/"+pluginName+".dsp");
if (sourcePath != "")
factory.AddAttribute(oss.str(), "faust_source_file", sourcePath);
}
if (ReleaseLibraryHandler(handle, pluginFullFilename))
{
std::cout<<"[FAUST-LADSPA] error unloading library handle of: " << pluginFullFilename<<std::endl;
std::cout<<LibraryLoadError()<<std::endl;
}
}
const char ** standardPaths() const
{
static const char * result[] =
{
/* "/usr/share/doc/faust",
"/usr/local/share/doc/faust",*/
0
};
return result;
}
const char * homePath() const { return "/.faust"; }
const char * pathEnvironmentVar() const { return "CLAM_FAUST_PATH"; }
const char * libraryType() const { return "LADSPA"; }
private:
static std::list<std::string> & LoadedLibraries()
{
static std::list<std::string> sLoadedLibraries;
return sLoadedLibraries;
}
};
#endif // RunTimeFaustLibraryLoader_hxx
|