Ejemplo n.º 1
0
int main(int argc, char *argv[])
{
    const char *rdf_uris[] = {
	"file:ladspa.rdfs",
	NULL
    };
    const char *src = "test:add";

    lrdf_init();
    if (lrdf_read_files(rdf_uris)) {
	fprintf(stderr, "failed to open a file\n");
	exit(1);
    }

    lrdf_add_triple(src, "test:id1", "test:foo", "1", lrdf_literal);
    lrdf_add_triple(src, "test:id1", "test:bar", "2", lrdf_literal);
    lrdf_add_triple(src, "test:id1", "test:baz", "3", lrdf_literal);
    lrdf_add_triple(src, "test:id2", "test:like", "test:id1", lrdf_uri);
    lrdf_add_triple(src, "test:id2", "test:foo", "4", lrdf_literal);
    lrdf_add_triple(src, "test:id2", "test:bar", "5", lrdf_literal);
    lrdf_add_triple(src, "test:id2", "test:baz", "6", lrdf_literal);

    lrdf_rebuild_caches();

    lrdf_add_triple(src, "test:id2", "test:bar", "5", lrdf_literal);
    lrdf_add_triple(src, "test:id2", "test:baz", "6", lrdf_literal);

    lrdf_rebuild_caches();

    lrdf_export_by_source(src, "test-out.n3");

    lrdf_cleanup();

    return 0;
}
Ejemplo n.º 2
0
static gboolean
plugin_init (GstPlugin * plugin)
{
  GST_DEBUG_CATEGORY_INIT (ladspa_debug, "ladspa",
      GST_DEBUG_FG_GREEN | GST_DEBUG_BG_BLACK | GST_DEBUG_BOLD, "LADSPA");

  gst_plugin_add_dependency_simple (plugin,
      "LADSPA_PATH",
      GST_LADSPA_DEFAULT_PATH, NULL, GST_PLUGIN_DEPENDENCY_FLAG_NONE);

#ifdef HAVE_LRDF
  lrdf_init ();
#endif

  parent_class = g_type_class_ref (GST_TYPE_SIGNAL_PROCESSOR);

  ladspa_plugin = plugin;
  descriptor_quark = g_quark_from_static_string ("ladspa-descriptor");

  if (!ladspa_plugin_path_search ()) {
    GST_WARNING ("no ladspa plugins found, check LADSPA_PATH");
  }

  /* we don't want to fail, even if there are no elements registered */
  return TRUE;
}
Ejemplo n.º 3
0
int main(int argc, char*argv[])
{
    const char *rdf_uris[] = {
        "file:ladspa.rdfs",
        "file:sample.rdf",
        "file:example.rdf",
        NULL
    };
    lrdf_uris *ulist;
    unsigned int i;
    lrdf_statement p1, p2;

    lrdf_init();
    if (lrdf_read_files(rdf_uris)) {
        fprintf(stderr, "failed to open a file\n");
        exit(1);
    }

    printf("Matches for (?, ladspa:hasLabel, gain)\n");
    p1.subject = "?";
    p1.predicate = "http://ladspa.org/ontology#hasLabel";
    p1.object = "gain";
    p1.next = NULL;
    ulist = lrdf_match_multi(&p1);
    for (i = 0; ulist && i < ulist->count; i++) {
        printf("  %s\n", ulist->items[i]);
    }
    printf("\n");
    lrdf_free_uris(ulist);

    printf("Matches for (?, ladspa:hasLabel, freq), (?, ladspa:hasUnits, ladspa:Hz)\n");
    p1.subject = "?";
    p1.predicate = "http://ladspa.org/ontology#hasLabel";
    p1.object = "freq";
    p1.next = &p2;
    p2.subject = "?";
    p2.predicate = "http://ladspa.org/ontology#hasUnits";
    p2.object = "http://ladspa.org/ontology#Hz";
    p2.next = NULL;
    ulist = lrdf_match_multi(&p1);
    for (i = 0; ulist && i < ulist->count; i++) {
        printf("  %s\n", ulist->items[i]);
    }
    printf("\n");
    lrdf_free_uris(ulist);

    lrdf_cleanup();

    return 0;
}
Ejemplo n.º 4
0
int main(int argc, char*argv[])
{
    const char *rdf_uris[] = {
        "file:ladspa.rdfs",
        "file:test-in.n3",
        NULL
    };

    lrdf_init();
    if (lrdf_read_files(rdf_uris)) {
        fprintf(stderr, "failed to open a file\n");
        exit(1);
    }

    lrdf_export_by_source("file:test-in.n3", "file:test-out.n3");

    lrdf_cleanup();

    return 0;
}
Ejemplo n.º 5
0
int main(int argc, char*argv[])
{
	const char *rdf_uris[] = {
		"file:ladspa.rdfs",
	       	"file:example.rdf",
		 NULL
	};
	const char *external_rdf_uris[] = {
	       	 NULL,
		 NULL
	};
	lrdf_statement *s;
	lrdf_statement *it;

	lrdf_init();
	if (argc == 1) {
		if (lrdf_read_files(rdf_uris)) {
			fprintf(stderr, "failed to open a file\n");
			exit(1);
		}
	} else {
		external_rdf_uris[0] = argv[1];
		if (lrdf_read_files(external_rdf_uris)) {
			fprintf(stderr, "failed to open a file\n");
			exit(1);
		}
	}

	s = lrdf_all_statements();
	for (it = s; it != NULL; it = it->next) {
		printf("(%s, %s, %s)\n", it->subject, it->predicate,
				it->object);
	}

	lrdf_cleanup();

	return 0;
}
Ejemplo n.º 6
0
void LoadLadspaPlugins()
{
   wxArrayString audacityPathList = wxGetApp().audacityPathList;
   wxArrayString pathList;
   wxArrayString files;
   wxSortedArrayString uniq;
   wxString pathVar;
   unsigned int i;

#if defined(USE_LIBLRDF) && defined(EFFECT_CATEGORIES)
   
   EffectManager& em = EffectManager::Get();
   wxArrayString rdfPathList;
   wxString rdfPathVar;
   wxArrayString rdfFiles;

   InitCategoryMap();
   lrdf_init();

   rdfPathVar = wxGetenv(wxT("LADSPA_RDF_PATH"));
   if (rdfPathVar != wxT(""))
      wxGetApp().AddMultiPathsToPathList(rdfPathVar, rdfPathList);

#ifdef __WXGTK__
   wxGetApp().AddUniquePathToPathList(wxT("/usr/share/ladspa/rdf"), 
                                      rdfPathList);
   wxGetApp().AddUniquePathToPathList(wxT("/usr/local/share/ladspa/rdf"), 
                                      rdfPathList);
#endif

#ifdef __WXMAC__
   wxGetApp().AddUniquePathToPathList(wxT("/usr/share/ladspa/rdf"), 
                                      rdfPathList);
   // XXX Maybe other Mac paths here?
#endif

#ifdef __WXMSW__
   //wxGetApp().AddUniquePathToPathList(wxT("WINDOWS LRDF PATH"), 
   //                                   rdfPathList);
   // XXX Other Windows paths here.
#endif
   
   // Add the Audacity paths so we get ladspa.rdfs if we are using a local
   // liblrdf
   for(i=0; i<audacityPathList.GetCount(); i++) {
      wxString prefix = audacityPathList[i] + wxFILE_SEP_PATH;
      wxGetApp().AddUniquePathToPathList(prefix + wxT("rdf"),
                                         rdfPathList);
   }

   wxGetApp().FindFilesInPathList(wxT("*.rdf"), rdfPathList, rdfFiles);
   wxGetApp().FindFilesInPathList(wxT("*.rdfs"), rdfPathList, rdfFiles);
   for(size_t i = 0; i < rdfFiles.GetCount(); ++i) {
      wxString fileUri(wxT("file://"));
      fileUri += rdfFiles[i];
      lrdf_read_file(fileUri.mb_str(wxConvUTF8));
   }
   
   
   // Add all plugin categories found by LRDF
   lrdf_uris* cats = 
      lrdf_get_all_subclasses("http://ladspa.org/ontology#Plugin");
   if (cats) {
    
      // Add the categories and find the plugins belonging to them
      for (size_t i = 0; i < cats->count; ++i) {
         char* label = lrdf_get_label(cats->items[i]);
         if (!label)
            continue;
         wxString uri = MapCategoryUri(wxString::FromAscii(cats->items[i]));
         em.AddCategory(uri, wxString::FromUTF8(label));
         std::free(label);

         lrdf_uris* plugs = lrdf_get_instances(cats->items[i]);
         if (plugs) {
            for (size_t j = 0; j < plugs->count; ++j) {
               unsigned long uid = lrdf_get_uid(plugs->items[j]);
               gPluginCategories.insert(std::make_pair(uid, uri));
            }
            lrdf_free_uris(plugs);
         }
      }
      
      // And their relationships
      for (size_t i = 0; i < cats->count; ++i) {
         EffectCategory* p = 
            em.LookupCategory(MapCategoryUri(wxString::FromAscii(cats->
                                                                 items[i])));
         if (!p)
            continue;
         lrdf_uris* subs = lrdf_get_subclasses(cats->items[i]);
         if (subs) {
            for (size_t j = 0; j < subs->count; ++j) {
               EffectCategory* c = 
                  em.LookupCategory(MapCategoryUri(wxString::FromAscii(subs->items[j])));
               if (c)
                  em.AddCategoryParent(c, p);
            }
            lrdf_free_uris(subs);
         }
      }
      
      lrdf_free_uris(cats);
      
   }
   
#endif

   pathVar = wxGetenv(wxT("LADSPA_PATH"));
   if (pathVar != wxT(""))
      wxGetApp().AddMultiPathsToPathList(pathVar, pathList);

   #ifdef __WXGTK__
   wxGetApp().AddUniquePathToPathList(wxT(INSTALL_PREFIX) wxT("/ladspa"), pathList);
   wxGetApp().AddUniquePathToPathList(wxT("/usr/local/lib/ladspa"), pathList);
   wxGetApp().AddUniquePathToPathList(wxT(LIBDIR) wxT("/ladspa"), pathList);
   #endif

   #ifdef __WXMAC__
   wxGetApp().AddUniquePathToPathList(wxT("~/Library/Audio/Plug-Ins/LADSPA"), pathList);
   wxGetApp().AddUniquePathToPathList(wxT("/Library/Audio/Plug-Ins/LADSPA"), pathList);
   #endif

   for(i=0; i<audacityPathList.GetCount(); i++) {
      wxString prefix = audacityPathList[i] + wxFILE_SEP_PATH;
      wxGetApp().AddUniquePathToPathList(prefix + wxT("ladspa"),
                                         pathList);
      wxGetApp().AddUniquePathToPathList(prefix + wxT("plugins"),
                                         pathList);
      wxGetApp().AddUniquePathToPathList(prefix + wxT("plug-ins"),
                                         pathList);
   }

   #ifdef __WXMSW__
   wxGetApp().FindFilesInPathList(wxT("*.dll"), pathList, files);   
   #else
   wxGetApp().FindFilesInPathList(wxT("*.so"), pathList, files);
   #endif

   for(i=0; i<files.GetCount(); i++)
      LoadLadspaEffect(uniq, files[i], ladspa_dls);
}
Ejemplo n.º 7
0
static gboolean
plugin_init (GstPlugin * plugin)
{
  gboolean res = FALSE;
  gint n = 0;

  GST_DEBUG_CATEGORY_INIT (ladspa_debug, "ladspa", 0, "LADSPA plugins");

#ifdef ENABLE_NLS
  GST_DEBUG_OBJECT (plugin, "binding text domain %s to locale dir %s",
      GETTEXT_PACKAGE, LOCALEDIR);
  bindtextdomain (GETTEXT_PACKAGE, LOCALEDIR);
  bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
#endif

  gst_plugin_add_dependency_simple (plugin,
      "LADSPA_PATH",
      GST_LADSPA_DEFAULT_PATH, NULL, GST_PLUGIN_DEPENDENCY_FLAG_NONE);

#ifdef HAVE_LRDF
  lrdf_init ();
#endif

  ladspa_meta_all = (GstStructure *) gst_plugin_get_cache_data (plugin);
  if (ladspa_meta_all) {
    n = gst_structure_n_fields (ladspa_meta_all);
  }
  GST_INFO_OBJECT (plugin, "%d entries in cache", n);
  if (!n) {
    ladspa_meta_all = gst_structure_new_empty ("ladspa");
    if ((res = ladspa_plugin_path_search (plugin))) {
      n = gst_structure_n_fields (ladspa_meta_all);
      GST_INFO_OBJECT (plugin, "%d entries after scanning", n);
      gst_plugin_set_cache_data (plugin, ladspa_meta_all);
    }
  } else {
    res = TRUE;
  }

  if (n) {
    gint i;
    const gchar *name;
    const GValue *value;

    GST_INFO_OBJECT (plugin, "register types");

    for (i = 0; i < n; i++) {
      name = gst_structure_nth_field_name (ladspa_meta_all, i);
      value = gst_structure_get_value (ladspa_meta_all, name);
      if (G_VALUE_TYPE (value) == GST_TYPE_STRUCTURE) {
        GstStructure *ladspa_meta = g_value_get_boxed (value);

        ladspa_plugin_register_element (plugin, ladspa_meta);
      }
    }
  }

  if (!res) {
    GST_WARNING_OBJECT (plugin, "no LADSPA plugins found, check LADSPA_PATH");
  }

  /* we don't want to fail, even if there are no elements registered */
  return TRUE;
}
Ejemplo n.º 8
0
wxArrayString LadspaEffectsModule::FindPlugins(PluginManagerInterface & pm)
{
#if defined(USE_LIBLRDF) && defined(EFFECT_CATEGORIES)

   EffectManager& em = EffectManager::Get();
   wxArrayString rdfPathList;
   wxString rdfPathVar;
   wxArrayString rdfFiles;

   InitCategoryMap();
   lrdf_init();

   rdfPathVar = wxGetenv(wxT("LADSPA_RDF_PATH"));
   if (rdfPathVar != wxT(""))
      wxGetApp().AddMultiPathsToPathList(rdfPathVar, rdfPathList);

#ifdef __WXGTK__
   wxGetApp().AddUniquePathToPathList(wxT("/usr/share/ladspa/rdf"),
                                      rdfPathList);
   wxGetApp().AddUniquePathToPathList(wxT("/usr/local/share/ladspa/rdf"),
                                      rdfPathList);
#endif

#ifdef __WXMAC__
   wxGetApp().AddUniquePathToPathList(wxT("/usr/share/ladspa/rdf"),
                                      rdfPathList);
   // XXX Maybe other Mac paths here?
#endif

#ifdef __WXMSW__
   //wxGetApp().AddUniquePathToPathList(wxT("WINDOWS LRDF PATH"),
   //                                   rdfPathList);
   // XXX Other Windows paths here.
#endif

   // Add the Audacity paths so we get ladspa.rdfs if we are using a local
   // liblrdf
   for(i=0; i<audacityPathList.GetCount(); i++) {
      wxString prefix = audacityPathList[i] + wxFILE_SEP_PATH;
      wxGetApp().AddUniquePathToPathList(prefix + wxT("rdf"),
                                         rdfPathList);
   }

   wxGetApp().FindFilesInPathList(wxT("*.rdf"), rdfPathList, rdfFiles);
   wxGetApp().FindFilesInPathList(wxT("*.rdfs"), rdfPathList, rdfFiles);
   for(size_t i = 0; i < rdfFiles.GetCount(); ++i) {
      wxString fileUri(wxT("file://"));
      fileUri += rdfFiles[i];
      lrdf_read_file(fileUri.mb_str(wxConvUTF8));
   }


   // Add all plugin categories found by LRDF
   lrdf_uris* cats =
      lrdf_get_all_subclasses("http://ladspa.org/ontology#Plugin");
   if (cats) {

      // Add the categories and find the plugins belonging to them
      for (size_t i = 0; i < cats->count; ++i) {
         char* label = lrdf_get_label(cats->items[i]);
         if (!label)
            continue;
         wxString uri = MapCategoryUri(wxString::FromAscii(cats->items[i]));
         em.AddCategory(uri, wxString::FromUTF8(label));
         std::free(label);

         lrdf_uris* plugs = lrdf_get_instances(cats->items[i]);
         if (plugs) {
            for (size_t j = 0; j < plugs->count; ++j) {
               unsigned long uid = lrdf_get_uid(plugs->items[j]);
               gPluginCategories.insert(std::make_pair(uid, uri));
            }
            lrdf_free_uris(plugs);
         }
      }

      // And their relationships
      for (size_t i = 0; i < cats->count; ++i) {
         EffectCategory* p =
            em.LookupCategory(MapCategoryUri(wxString::FromAscii(cats->
                                                                 items[i])));
         if (!p)
            continue;
         lrdf_uris* subs = lrdf_get_subclasses(cats->items[i]);
         if (subs) {
            for (size_t j = 0; j < subs->count; ++j) {
               EffectCategory* c =
                  em.LookupCategory(MapCategoryUri(wxString::FromAscii(subs->items[j])));
               if (c)
                  em.AddCategoryParent(c, p);
            }
            lrdf_free_uris(subs);
         }
      }

      lrdf_free_uris(cats);

   }

#endif

   wxArrayString pathList;
   wxArrayString files;
   wxString pathVar;

   // Check for the LADSPA_PATH environment variable
   pathVar = wxString::FromUTF8(getenv("LADSPA_PATH"));
   if (!pathVar.empty())
   {
      wxStringTokenizer tok(pathVar);
      while (tok.HasMoreTokens())
      {
         pathList.Add(tok.GetNextToken());
      }
   }

#if defined(__WXMAC__)
#define LADSPAPATH wxT("/Library/Audio/Plug-Ins/LADSPA")

   // Look in ~/Library/Audio/Plug-Ins/LADSPA and /Library/Audio/Plug-Ins/LADSPA
   pathList.Add(wxGetHomeDir() + wxFILE_SEP_PATH + LADSPAPATH);
   pathList.Add(LADSPAPATH);

   // Recursively scan for all shared objects
   pm.FindFilesInPathList(wxT("*.so"), pathList, files, true);

#elif defined(__WXMSW__)

   // Recursively scan for all DLLs
   pm.FindFilesInPathList(wxT("*.dll"), pathList, files, true);

#else
   
   pathList.Add(wxGetHomeDir() + wxFILE_SEP_PATH + wxT(".ladspa"));
   pathList.Add(wxT("/usr/local/lib/ladspa"));
   pathList.Add(wxT("/usr/lib/ladspa"));
   pathList.Add(wxT(LIBDIR) wxT("/ladspa"));

   // Recursively scan for all shared objects
   pm.FindFilesInPathList(wxT("*.so"), pathList, files, true);

#endif

   return files;
}