gephex--main--0.4--patch-1813

[email protected]
Newsgroups gmane.comp.video.gephex.devel
Message-ID <[email protected]>
Archive: [email protected]
New revision: gephex--main--0.4--patch-1813

--
Revision: gephex--main--0.4--patch-1813
Archive: [email protected]
Creator: GePhex <[email protected]>
Date: Mon Nov  8 17:56:35 CET 2004
Standard-date: 2004-11-08 16:56:35 GMT
New-files: engine/src/dllloader/.arch-ids/frei0r.h.id
    engine/src/dllloader/.arch-ids/frei0r.xpm.id
    engine/src/dllloader/.arch-ids/frei0rwrapper.cpp.id
    engine/src/dllloader/.arch-ids/frei0rwrapper.h.id
    engine/src/dllloader/frei0r.h
    engine/src/dllloader/frei0r.xpm
    engine/src/dllloader/frei0rwrapper.cpp
    engine/src/dllloader/frei0rwrapper.h
Modified-files: configure.ac data/Makefile.am
    data/gephex.conf.default.in
    engine/src/dllloader/Makefile.am
    engine/src/dllloader/c_moduleclass.cpp
    engine/src/dllloader/c_moduleclass.h
    engine/src/dllloader/dllloader.cpp
    engine/src/dllloader/dllloader.h
    engine/src/engine/controller.cpp
    engine/src/engine/main.cpp
New-patches: [email protected]/gephex--georg--0.4--patch-348
    [email protected]/gephex--georg--0.4--patch-349
    [email protected]/gephex--georg--0.4--patch-350
    [email protected]/gephex--georg--0.4--patch-351
    [email protected]/gephex--frei0r--0.4--base-0
    [email protected]/gephex--frei0r--0.4--patch-1
    [email protected]/gephex--frei0r--0.4--patch-2
    [email protected]/gephex--frei0r--0.4--patch-3
    [email protected]/gephex--frei0r--0.4--patch-4
    [email protected]/gephex--main--0.4--patch-1813
    [email protected]/gephex--frei0r--0.4--base-0
    [email protected]/gephex--frei0r--0.4--patch-1
Summary: add frei0r loader support
Keywords: 

Patches applied:

 * [email protected]/gephex--georg--0.4--patch-348
   Applied frei0r support patch

 * [email protected]/gephex--georg--0.4--patch-349
   Allow frei0r parameter names with spaces

 * [email protected]/gephex--georg--0.4--patch-350
   Add frei0r_path to gephex.conf.default and create frei0rs path on install

 * [email protected]/gephex--georg--0.4--patch-351
   newer frei0r.h version

 * [email protected]/gephex--frei0r--0.4--base-0
   tag of [email protected]/gephex--frei0r--0.4--patch-1

 * [email protected]/gephex--frei0r--0.4--patch-1
   Fix some frei0r support stuff

 * [email protected]/gephex--frei0r--0.4--patch-2
   Remove some frei0r debug output

 * [email protected]/gephex--frei0r--0.4--patch-3
   added missing frei0r files to dist and improved frei0r loader

 * [email protected]/gephex--frei0r--0.4--patch-4
   Some frei0r fixes...

 * [email protected]/gephex--frei0r--0.4--base-0
   tag of [email protected]/gephex--main--0.4--patch-1811

 * [email protected]/gephex--frei0r--0.4--patch-1
   initial version of frei0r plugins

* added directories

    {arch}/gephex/gephex--frei0r
    {arch}/gephex/gephex--frei0r/gephex--frei0r--0.4
    {arch}/gephex/gephex--frei0r/gephex--frei0r--0.4/[email protected]
    {arch}/gephex/gephex--frei0r/gephex--frei0r--0.4/[email protected]/patch-log
    {arch}/gephex/gephex--frei0r/gephex--frei0r--0.4/[email protected]
    {arch}/gephex/gephex--frei0r/gephex--frei0r--0.4/[email protected]/patch-log

* added files

    engine/src/dllloader/.arch-ids/frei0r.h.id
    engine/src/dllloader/.arch-ids/frei0r.xpm.id
    engine/src/dllloader/.arch-ids/frei0rwrapper.cpp.id
    engine/src/dllloader/.arch-ids/frei0rwrapper.h.id
    engine/src/dllloader/frei0r.h
    engine/src/dllloader/frei0r.xpm
    engine/src/dllloader/frei0rwrapper.cpp
    engine/src/dllloader/frei0rwrapper.h
    {arch}/gephex/gephex--frei0r/gephex--frei0r--0.4/[email protected]/patch-log/base-0
    {arch}/gephex/gephex--frei0r/gephex--frei0r--0.4/[email protected]/patch-log/patch-1
    {arch}/gephex/gephex--frei0r/gephex--frei0r--0.4/[email protected]/patch-log/patch-2
    {arch}/gephex/gephex--frei0r/gephex--frei0r--0.4/[email protected]/patch-log/patch-3
    {arch}/gephex/gephex--frei0r/gephex--frei0r--0.4/[email protected]/patch-log/patch-4
    {arch}/gephex/gephex--frei0r/gephex--frei0r--0.4/[email protected]/patch-log/base-0
    {arch}/gephex/gephex--frei0r/gephex--frei0r--0.4/[email protected]/patch-log/patch-1
    {arch}/gephex/gephex--georg/gephex--georg--0.4/[email protected]/patch-log/patch-348
    {arch}/gephex/gephex--georg/gephex--georg--0.4/[email protected]/patch-log/patch-349
    {arch}/gephex/gephex--georg/gephex--georg--0.4/[email protected]/patch-log/patch-350
    {arch}/gephex/gephex--georg/gephex--georg--0.4/[email protected]/patch-log/patch-351
    {arch}/gephex/gephex--main/gephex--main--0.4/[email protected]/patch-log/patch-1813

* modified files

--- orig/configure.ac
+++ mod/configure.ac
@@ -369,9 +369,10 @@
  cd contrib/ffmpeg/ && ${FFMPEG_CONFIG_DIR}/configure $FFMPEG_CONFIGURE_FLAGS && cd ../..
 fi
 
-# set gphx_module_lib_dir and gphx_type_lib_dir
+# set gphx_module_lib_dir, gphx_frei0r_lib_dir, and gphx_type_lib_dir
 test "x$prefix" = xNONE && prefix=$ac_default_prefix
 AC_SUBST(gphx_module_lib_dir, "${prefix}/lib/gephex-0.4/modules")
+AC_SUBST(gphx_frei0r_lib_dir, "${prefix}/lib/gephex-0.4/frei0rs")
 AC_SUBST(gphx_type_lib_dir, "${prefix}/lib/gephex-0.4/types")
 
 AC_CONFIG_FILES([Makefile


--- orig/data/Makefile.am
+++ mod/data/Makefile.am
@@ -8,6 +8,7 @@
 EXTRA_DIST = $(icon_DATA) run_in_terminal.sh gephex-wrapper.in gephex.conf.default.in gephexw.conf.default
 
 install-exec-hook:
+	if [ ! -e @gphx_frei0r_lib_dir@ ]; then mkdir @gphx_frei0r_lib_dir@; fi
 	chmod ug+x $(DESTDIR)$(bindir)/gephex-wrapper
 	rm -rf $(DESTDIR)$(bindir)/gephex-engine
 	rm -rf $(DESTDIR)$(bindir)/gephex-gui


--- orig/data/gephex.conf.default.in
+++ mod/data/gephex.conf.default.in
@@ -4,6 +4,7 @@
 
 engine {
     module_path          = [@gphx_module_lib_dir@/]
+    module_path          = [@gphx_frei0r_lib_dir@/]
     type_path            = [@gphx_type_lib_dir@/]
     graph_path           = [__CONF_DIR__/graphs/]
     ipc_unix_node_prefix = [/tmp/gephex_socket_]


--- orig/engine/src/dllloader/Makefile.am
+++ mod/engine/src/dllloader/Makefile.am
@@ -42,7 +42,11 @@
 	moduleclassspec.h \
 	moduleinfoutils.h \
 	nameresolver.h \
-	module.h
+	module.h \
+	frei0rwrapper.cpp \
+	frei0rwrapper.h \
+	frei0r.h \
+	frei0r.xpm
 
 
 


--- orig/engine/src/dllloader/c_moduleclass.cpp
+++ mod/engine/src/dllloader/c_moduleclass.cpp
@@ -41,19 +41,22 @@
 
 CModuleClass::CModuleClass(const CModuleFunctionTable& ftab_,
 			   const CModuleAttributes& attr_,
-			   const std::string& name)
+			   const std::string& name,
+			   frei0r_funs_t* frei0r)
   : functionTable(new CModuleFunctionTable(ftab_)), 
   attributes(new CModuleAttributes(attr_)), 
   defaultInputValues(attr_.inputs.size()),
-  m_name(name)
+    m_name(name), m_frei0r(0)
 {
+  if (frei0r)
+    m_frei0r = new frei0r_funs_t(*frei0r);
 }
 
 IModuleClass* CModuleClass::clone() const
 {
   CModuleClass* newClass = new CModuleClass(*this->functionTable,
-	  *this->attributes,
-	  this->m_name);
+					    *this->attributes,
+					    this->m_name, this->m_frei0r);
   newClass->defaultInputValues = defaultInputValues;
   return newClass;
 }
@@ -64,13 +67,25 @@
 {
   delete functionTable;
   delete attributes;
+
+  if (m_frei0r)
+    delete m_frei0r;
 }
 
 
 IModule* CModuleClass::buildInstance(const ITypeFactory& tFactory) const
 
 {
-  void* instance = functionTable->newInstance();
+  void* instance;
+  if (m_frei0r)
+    {
+      typedef void* (*harr_t)(void*, int);
+      harr_t harr = (harr_t) functionTable->newInstance;
+
+      instance = harr(m_frei0r, defaultInputValues.size());
+    }
+  else
+    instance = functionTable->newInstance();
   if (instance == 0)
     {
       throw std::runtime_error("Ungute Sache vorgefallen.");


--- orig/engine/src/dllloader/c_moduleclass.h
+++ mod/engine/src/dllloader/c_moduleclass.h
@@ -29,6 +29,8 @@
 
 #include "utils/autoptr.h"
 
+#include "frei0rwrapper.h"
+
 class CModuleFunctionTable;
 class CModuleAttributes;
 class IType;
@@ -43,7 +45,8 @@
 
 	CModuleClass(const CModuleFunctionTable&,
 		     const CModuleAttributes& attr_,
-			 const std::string& name);
+		     const std::string& name,
+		     frei0r_funs_t* frei0r);
 
 	virtual IModuleClass* clone() const;
 
@@ -58,6 +61,7 @@
 	typedef utils::AutoPtr<IType> ITypePtr;
 	mutable std::vector<ITypePtr> defaultInputValues;
 	std::string m_name;
+	frei0r_funs_t* m_frei0r;
 };
 
 #endif


--- orig/engine/src/dllloader/dllloader.cpp
+++ mod/engine/src/dllloader/dllloader.cpp
@@ -59,7 +59,7 @@
 #include "interfaces/itypeclassinforeceiver.h"
 #include "interfaces/itypeclassnamereceiver.h"
 
-
+#include "frei0rwrapper.h"
 
 namespace dllloader
 {
@@ -68,6 +68,32 @@
     void moduleLog(int level, const char* sender, const char* msg);
   };
 
+
+
+  void readFrei0rFuns(DllLoader::SharedLibraryPtr sl, frei0r_funs_t& f0r)
+  {
+    f0r.init            = (f0r_init_t) sl->loadSymbol("f0r_init");
+    f0r.deinit          = (f0r_deinit_t) sl->loadSymbol("f0r_deinit");
+    f0r.get_plugin_info = (f0r_get_plugin_info_t) 
+      sl->loadSymbol("f0r_get_plugin_info");
+    f0r.get_param_info  = (f0r_get_param_info_t)
+      sl->loadSymbol("f0r_get_param_info");
+    f0r.construct       = (f0r_construct_t) sl->loadSymbol("f0r_construct");
+    f0r.destruct        = (f0r_destruct_t) sl->loadSymbol("f0r_destruct");
+    f0r.set_param_value = (f0r_set_param_value_t) sl->loadSymbol("f0r_set_param_value");
+    f0r.get_param_value = (f0r_get_param_value_t)
+      sl->loadSymbol("f0r_get_param_value");
+    f0r.update          = (f0r_update_t) sl->loadSymbol("f0r_update");
+	  
+    if (f0r.init == 0 || f0r.deinit == 0 || f0r.get_plugin_info == 0 ||
+	f0r.get_param_info == 0 || f0r.construct == 0 || f0r.destruct == 0 ||
+	f0r.set_param_value == 0 || f0r.get_param_value == 0 ||
+	f0r.update == 0)
+      {
+	throw std::runtime_error("Funkti0rs are missing!");
+      }
+  }
+
   //TODO: ugly
   static utils::AutoPtr<utils::ILogger> s_logger(0);
 
@@ -112,10 +138,12 @@
 
   namespace
   {
-    void postLoadModule(CModuleFunctionTable& ft)
+    void postLoadModule(CModuleFunctionTable& ft, bool is_frei0r)
     {
-      if (ft.newInstance == 0 || ft.deleteInstance == 0
-	  || ft.update == 0 || ft.getSpec == 0 || ft.getInfo == 0) //TODO
+      if (ft.newInstance == 0 || ft.deleteInstance == 0 ||
+	  ft.update == 0 ||
+	  (!is_frei0r && ft.getSpec == 0) ||
+	  (!is_frei0r && ft.getInfo == 0)) //TODO
 	throw std::runtime_error("Benoetigte Funktion fehlt");
 		
       if (ft.init == 0)
@@ -173,7 +201,8 @@
   }
 
   void DllLoader::readDlls(const std::vector<std::string>& modules,
-			   const std::vector<std::string>& types)
+			   const std::vector<std::string>& types,
+			   const std::vector<std::string>& frei0rs)
   {
     for (std::vector<std::string>::const_iterator it = types.begin();
 	 it != types.end(); ++it)
@@ -203,6 +232,19 @@
 	    std::cerr << e.what() << std::endl;
 	  }
       }		
+
+    for (std::vector<std::string>::const_iterator it = frei0rs.begin();
+	 it != frei0rs.end(); ++it)
+      {	
+	try 
+	  {
+	    processFrei0rFile(*it);
+	  }
+	catch (std::runtime_error& e)
+	  {
+	    std::cerr << e.what() << std::endl;
+	  }
+      }		
   }
 	
   //TODO: Fehlerbehandlung!
@@ -246,14 +288,32 @@
 	
     try
       {
-	postLoadModule(fTable);			
-	this->constructModuleClass(&fTable, sl, moduleName);
+	postLoadModule(fTable, false);
+	this->constructModuleClass(&fTable, sl, moduleName, 0);
       }
     catch (std::runtime_error& e)
       {	
 		m_logger->error("DllLoader::loadModule", e.what());
       }
   }
+
+  void DllLoader::loadFrei0r(frei0r_funs_t& f0r, SharedLibraryPtr sl,
+			     const std::string moduleName)
+  {
+    CModuleFunctionTable fTable;
+
+    create_f0r_wrapper(fTable);
+	
+    try
+      {
+	postLoadModule(fTable, true);
+	this->constructModuleClass(&fTable, sl, moduleName, &f0r);
+      }
+    catch (std::runtime_error& e)
+      {	
+	m_logger->error("DllLoader::loadModule", e.what());
+      }
+  }
 	
   void DllLoader::loadModuleClass(const std::string& moduleName)
   {		
@@ -264,7 +324,20 @@
 
 		if (it == m_mod2fileName.end())
 		{
-			throw std::runtime_error("ModulClass gibts halt nicht");
+		  it = m_f0r2fileName.find(moduleName);
+
+		  if (it == m_f0r2fileName.end())
+		    throw std::runtime_error("ModuleClass gibts halt nicht");
+
+		  std::string filename = it->second;
+
+		  frei0r_funs_t f0r;
+		  SharedLibraryPtr sl = this->loadDll(filename);
+
+		  readFrei0rFuns(sl, f0r);
+
+		  loadFrei0r(f0r, sl, moduleName);
+		  return;
 		}
 		
 		std::string filename = it->second;
@@ -335,6 +408,13 @@
       }
 
 
+    for (std::map<std::string,std::string>::const_iterator nameIt 
+	   = m_f0r2fileName.begin();
+	 nameIt != m_f0r2fileName.end(); ++nameIt)
+      {
+     	m_nameReceiver->moduleClassNameExists(nameIt->first);       
+      }
+
     for (std::map<std::string,utils::AutoPtr<utils::Buffer> >::const_iterator
 	   modIt = m_moduleInfos.begin();
 	 modIt != m_moduleInfos.end(); ++modIt)
@@ -437,20 +517,53 @@
 	
   void DllLoader::constructModuleClass(CModuleFunctionTable* fTable,
 				       SharedLibraryPtr sl,
-                                       const std::string& moduleName) 
+                                       const std::string& moduleName,
+				       frei0r_funs_t* frei0r)
   {
-    if (fTable->init != 0)
+    if (frei0r)
       {
-        if (fTable->init(moduleLog) == 0)
+	if (frei0r->init() == 0)
 	  {
-	    throw std::runtime_error("init of plugin " + moduleName
-                                     + " failed");
-          }
+	    throw std::runtime_error("init0r of plugin " + moduleName
+				     + " failed");
+	  }
       }
-		
-    std::string moduleSpec = fTable->getSpec();
-    utils::StructReader spec(moduleSpec);
+    else
+      {
+	if (fTable->init != 0)
+	  {
+	    if (fTable->init(moduleLog) == 0)
+	      {
+		throw std::runtime_error("init of plugin " + moduleName
+					 + " failed");
+	      }
+	  }
+      }
+
     int numInputs;
+    int numOutputs ;
+    std::string moduleSpec;
+    bool isDeterministic;
+    f0r_plugin_info_t f0r_info;
+    if (frei0r)
+      {
+	frei0r->get_plugin_info(&f0r_info);
+
+	// +1 for input frame, +1 for time
+	numInputs = 1 + f0r_info.num_params + 1;
+	numOutputs = 1;
+	isDeterministic = false;
+
+
+	moduleSpec = frei0r_create_spec(f0r_info);
+      }
+    else
+      {
+	moduleSpec = fTable->getSpec();
+      }
+
+    utils::StructReader spec(moduleSpec);
+
     try {
       numInputs = spec.getIntValue("number_of_inputs");
     }
@@ -458,9 +571,6 @@
       {
 	throw std::runtime_error("number_of_inputs nicht angegeben");
       }
-		
-		
-    int numOutputs ;
     try
       {
 	numOutputs = spec.getIntValue("number_of_outputs");
@@ -469,23 +579,51 @@
       {
 	throw std::runtime_error("number_of_outputs nicht angegeben");
       }
-		
-    bool isDeterministic = spec.getBoolValue("deterministic", false);
+    
+    isDeterministic = spec.getBoolValue("deterministic", false);
+
+  std::vector<int> inputs(numInputs);
+  std::vector<utils::Buffer> 
+  defaultVals(numInputs,
+	      utils::Buffer(reinterpret_cast<const unsigned char*>(""),1));
+  std::vector<std::string> inputNames(numInputs);
+  std::vector<std::string> inputIDs(numInputs);
+		
+  std::vector<bool> isConst(numInputs);
+  std::vector<bool> isStrong(numInputs);
+  std::vector<const TypeAttributes*> fixedAttributes(numInputs);
+
+  std::vector<std::string> f0r_param_names;
+
+  for (int i = 0; i < numInputs; ++i)
+      {
+	std::string inSpec;
+	if (frei0r)
+	  {
+	    std::cout << "i = " << i << "
";
+	    if (i == 0)
+	      {
+		inSpec = frei0r_create_in_spec();
+	      }
+	    else if (i == numInputs-1)
+	      {
+		inSpec = frei0r_create_time_spec();
+	      }
+	    else
+	      {
+		f0r_param_info_t pinfo;
+		frei0r->get_param_info(&pinfo, i-1);
+		inSpec = frei0r_create_in_param_spec(pinfo);
+		std::cout << "param # " << i-1 << " name '" 
+			  << pinfo.name << "'
";
+		f0r_param_names.push_back(pinfo.name);
+	      }
+	  }
+	else
+	  {
+	    inSpec = fTable->getInputSpec(i);
+	  }
 
-    std::vector<int> inputs(numInputs);
-    std::vector<utils::Buffer> 
-      defaultVals(numInputs,
-		  utils::Buffer(reinterpret_cast<const unsigned char*>(""),1));
-    std::vector<std::string> inputNames(numInputs);
-    std::vector<std::string> inputIDs(numInputs);
-		
-    std::vector<bool> isConst(numInputs);
-    std::vector<bool> isStrong(numInputs);
-    std::vector<const TypeAttributes*> fixedAttributes(numInputs);
-		
-    for (int i = 0; i < numInputs; ++i)
-      {
-	std::string inSpec = fTable->getInputSpec(i);
 	utils::StructReader inputSpec(inSpec);
 	
 	try {
@@ -513,61 +651,69 @@
 	  }
 
 #if (ENGINE_VERBOSITY > 2)
-	std::cout << "inputNames[" << i << "] = \"" 
-		  << inputNames[i] << '"' << std::endl;
+    std::cout << "inputNames[" << i << "] = \"" 
+	      << inputNames[i] << '"' << std::endl;
 #endif
+	
+    try 
+      {
+	inputs[i] = resolver->getObjectID(inputNames[i]);
+      }
+    catch(std::runtime_error& e)
+      {
+	std::string msg = "Unbekannter Typ: \"";
+	msg += inputNames[i];
+	msg += '"';
+	msg += " beim Laden von ";
+	msg += spec.getStringValue("name");
+	throw std::runtime_error(msg.c_str());
+      }
 			
-	try 
-	  {
-	    inputs[i] = resolver->getObjectID(inputNames[i]);
-	  }
-	catch(std::runtime_error& e)
-	  {
-	    std::string msg = "Unbekannter Typ: \"";
-	    msg += inputNames[i];
-	    msg += '"';
-	    msg += " beim Laden von ";
-	    msg += spec.getStringValue("name");
-	    throw std::runtime_error(msg.c_str());
-	  }
-			
-			
-	try 
-	  {
-	    isConst[i] = (inputSpec.getBoolValue("const"));
-	  }
-	catch (...)
-	  {
-	    throw std::runtime_error("const nicht angegeben");
-	  }
+    
+    try 
+      {
+	isConst[i] = (inputSpec.getBoolValue("const"));
+      }
+    catch (...)
+      {
+	throw std::runtime_error("const nicht angegeben");
+      }
 			
-	try 
-	  {
-	    isStrong[i] = (inputSpec.getBoolValue("strong_dependency"));
-	  }
-	catch (...)
-	  {
-	    throw std::runtime_error("strong_dependency nicht angegeben");
-	  }
-
-	try
-	  {
-	    fixedAttributes[i] 
-	      = static_cast<TypeAttributes*>(fTable->getInputAttributes(i));
-	  }
-	catch (...)
-	  {
-	    throw std::runtime_error("darf net sein");
-	  }
+    try 
+      {
+	isStrong[i] = (inputSpec.getBoolValue("strong_dependency"));
+      }
+    catch (...)
+      {
+	throw std::runtime_error("strong_dependency nicht angegeben");
+      }
 
+    try
+      {
+	fixedAttributes[i] 
+	  = static_cast<TypeAttributes*>(fTable->getInputAttributes(i));
+      }
+    catch (...)
+      {
+	throw std::runtime_error("darf net sein");
+      }
       }
+ 
 		
     std::vector<int> outputs(numOutputs);
     std::vector<std::string> outputNames(numOutputs);
     std::vector<std::string> outputIDs(numOutputs);
     for (int j = 0; j < numOutputs; ++j)
       {
-	std::string outSpec = fTable->getOutputSpec(j);
+	std::string outSpec;
+	if (frei0r)
+	  {
+	    outSpec = frei0r_create_out_spec();
+	  }
+	else
+	  {
+	    outSpec = fTable->getOutputSpec(j);
+	  }
 	utils::StructReader outputSpec(outSpec);			
 			
 	try {
@@ -594,7 +740,7 @@
 	    throw std::runtime_error(msg.c_str());
 	  }
       }
-		
+      		
     CModuleAttributes attributes;
     attributes.inputs = inputs;
     attributes.outputs = outputs;
@@ -616,14 +762,27 @@
     std::cout << "Registriere Modul " << name << std::endl;
 #endif
 
-    int bufLen = fTable->getInfo(0,0);
-    char* data = new char[bufLen];
-    int len = fTable->getInfo(data,bufLen);
+    char* data = 0;
+    int bufLen = 0;
+    if (frei0r)
+      {
+	std::vector<char> buf = frei0r_create_info(f0r_info,
+						   f0r_param_names);
+	data = new char[buf.size()];
+	memcpy(data, &buf[0], buf.size());
+	bufLen = buf.size();
+      }
+    else
+      {
+	bufLen = fTable->getInfo(0,0);
+	data = new char[bufLen];
+	int len = fTable->getInfo(data,bufLen);
 	if (len == 0) {
-		//TODO: is it ok to throw here (probably some leaks)?		
-		delete[] data;
-		throw std::runtime_error("getInfo failed!");
+	  //TODO: is it ok to throw here (probably some leaks)?		
+	  delete[] data;
+	  throw std::runtime_error("getInfo failed!");
 	}
+      }
     try 
       {
 	utils::Buffer mi = 
@@ -638,7 +797,7 @@
 	m_infoReceiver->moduleClassLoaded(name,mi);
 
 	m_classReceiver->moduleClassLoaded(name,
-					   CModuleClass(*fTable,attributes,name));
+					   CModuleClass(*fTable,attributes,name, frei0r));
 
 	m_specReceiver->moduleClassLoaded(name,ModuleClassSpec(name,inputs,
 							       defaultVals,
@@ -655,7 +814,7 @@
 
     delete[] data;
     
-  }
+      }
   
 
   DllLoader::SharedLibraryPtr DllLoader::loadDll(const std::string& filename)
@@ -723,6 +882,39 @@
     m_nameReceiver->moduleClassNameExists(name);
   }
 
+
+
+  void DllLoader::processFrei0rFile(const std::string& fname)
+  {
+    frei0r_funs_t f0r;
+    SharedLibraryPtr sl = loadDll(fname);
+    readFrei0rFuns(sl, f0r);
+
+    if (!f0r.init())
+      throw std::runtime_error("init0r failed");
+
+    f0r_plugin_info_t inf0r;
+    f0r.get_plugin_info(&inf0r);
+    std::string name = std::string("mod_") + inf0r.name;
+
+    std::cout << "Nam0r = " << name << "
";
+
+    f0r.deinit();
+
+    std::map<std::string,std::string>::const_iterator 
+      it = m_f0r2fileName.find(name);
+
+    if (it != m_f0r2fileName.end())
+      {
+	throw std::runtime_error("Nam0r '" + name 
+				 + "'doppelt bei processFrei0rFile");
+      }
+
+    m_f0r2fileName[name] = fname;
+
+    m_nameReceiver->moduleClassNameExists(name);
+  }
+
   void DllLoader::processTypFile(const std::string& fname)
   {
     std::string name = getDllName(fname);


--- orig/engine/src/dllloader/dllloader.h
+++ mod/engine/src/dllloader/dllloader.h
@@ -41,6 +41,8 @@
 
 #include "utils/autoptr.h"
 
+struct frei0r_funs_t;
+
 namespace utils 
 {
   class Buffer;
@@ -72,6 +74,9 @@
     {
 
     public:
+      typedef utils::AutoPtr<utils::SharedLibrary> SharedLibraryPtr;
+
+
       /**
        * Erzeugt neuen DllLoader.
        * @param logger used for reporting errors
@@ -85,9 +90,12 @@
        * Davor sollte der ModuleClassNameReceiver registriert sein !!
        */
       void readDlls(const std::vector<std::string>& modules,
-		    const std::vector<std::string>& types);
+		    const std::vector<std::string>& types,
+		    const std::vector<std::string>& frei0rs);
 
       virtual void loadModuleClass(const std::string& name);
+      virtual void loadFrei0r(frei0r_funs_t&, SharedLibraryPtr sl,
+			      const std::string moduleName);
       virtual void unloadModuleClass(const std::string& name);
 
       //TODO: war mal const
@@ -111,8 +119,6 @@
       virtual void registerTypeClassNameReceiver(ITypeClassNameReceiver&);
 
     private:
-      typedef utils::AutoPtr<utils::SharedLibrary> SharedLibraryPtr;
-
       SharedLibraryPtr loadDll(const std::string& filename);
       std::string getDllName(const std::string& filename);
 
@@ -120,11 +126,13 @@
                       const std::string& moduleName);
 
       void processModFile(const std::string&);
+      void processFrei0rFile(const std::string&);
       void processTypFile(const std::string&);
 	
       void constructModuleClass(CModuleFunctionTable* fTable,
 				SharedLibraryPtr sl,
-                                const std::string& moduleName);
+                                const std::string& moduleName,
+				frei0r_funs_t*);
 
       NameResolver* resolver;
 
@@ -139,6 +147,8 @@
 
       std::map<std::string,std::string> m_mod2fileName;
       std::map<std::string,std::string> m_typ2fileName;
+      std::map<std::string,std::string> m_f0r2fileName;
+
       std::map<std::string,SharedLibraryPtr> m_moduleHandles;
       std::map<std::string,utils::AutoPtr<utils::Buffer> > m_moduleInfos;
 


--- orig/engine/src/engine/controller.cpp
+++ mod/engine/src/engine/controller.cpp
@@ -316,10 +316,16 @@
     std::string type_path = config.get_string_param("type_path");
     std::vector<std::string> types = getFilesInDir(type_path,
                                                    TYPE_ENDING);
-	
+
+
+    std::string frei0r_path = config.get_string_param("frei0r_path");
+    std::vector<std::string> frei0rs = getFilesInDir(frei0r_path,
+						     MODULE_ENDING);
+
+    
     std::cout << "Reading plugins...";
     std::cout.flush();
-    pDllLoader.readDlls(modules, types);
+    pDllLoader.readDlls(modules, types, frei0rs);
     std::cout << "   done
";
 
     if (config.get_bool_param("headless"))


--- orig/engine/src/engine/main.cpp
+++ mod/engine/src/engine/main.cpp
@@ -203,6 +203,12 @@
                                    "Directory that contains gephex modules",
                                       0));
 
+      params.push_back(config_param_t("frei0r_path",
+				      config_param_t::STRING_PARAM,
+				      "engine",
+				      "Directory that contains frei0r effects",
+                                      0));
+
       params.push_back(config_param_t("type_path",
                                    config_param_t::STRING_PARAM,
                                    "engine",
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.