diff options
author | Paul Davis <paul@linuxaudiosystems.com> | 2007-12-10 21:29:51 +0000 |
---|---|---|
committer | Paul Davis <paul@linuxaudiosystems.com> | 2007-12-10 21:29:51 +0000 |
commit | f3dd3e6b18be7d22ca31e5424c2a07922b44b74e (patch) | |
tree | eee9b59ceaee4530fdc7da0b2c1092a6a0353d68 /libs/ardour/plugin.cc | |
parent | c467d753066d7d01012adfd812e31870c5cf1f70 (diff) |
AU support, plus changes in Plugin to make unique_id a string
git-svn-id: svn://localhost/ardour2/branches/2.0-ongoing@2754 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'libs/ardour/plugin.cc')
-rw-r--r-- | libs/ardour/plugin.cc | 84 |
1 files changed, 75 insertions, 9 deletions
diff --git a/libs/ardour/plugin.cc b/libs/ardour/plugin.cc index 7b956b564b..2b193ab0e6 100644 --- a/libs/ardour/plugin.cc +++ b/libs/ardour/plugin.cc @@ -42,6 +42,10 @@ #include <ardour/ladspa_plugin.h> #include <ardour/plugin_manager.h> +#ifdef HAVE_AUDIOUNITS +#include <ardour/audio_unit.h> +#endif + #include <pbd/stl_delete.h> #include "i18n.h" @@ -192,7 +196,21 @@ vector<string> Plugin::get_presets() { vector<string> labels; - lrdf_uris* set_uris = lrdf_get_setting_uris(unique_id()); + uint32_t id; + std::string unique (unique_id()); + + /* XXX problem: AU plugins don't have numeric ID's. + Solution: they have a different method of providing presets. + XXX sub-problem: implement it. + */ + + if (!isdigit (unique[0])) { + return labels; + } + + id = atol (unique.c_str()); + + lrdf_uris* set_uris = lrdf_get_setting_uris(id); if (set_uris) { for (uint32_t i = 0; i < (uint32_t) set_uris->count; ++i) { @@ -234,6 +252,20 @@ Plugin::save_preset (string name, string domain) { lrdf_portvalue portvalues[parameter_count()]; lrdf_defaults defaults; + uint32_t id; + std::string unique (unique_id()); + + /* XXX problem: AU plugins don't have numeric ID's. + Solution: they have a different method of providing/saving presets. + XXX sub-problem: implement it. + */ + + if (!isdigit (unique[0])) { + return false; + } + + id = atol (unique.c_str()); + defaults.count = parameter_count(); defaults.items = portvalues; @@ -252,7 +284,7 @@ Plugin::save_preset (string name, string domain) string source(string_compose("file:%1/.%2/rdf/ardour-presets.n3", envvar, domain)); - free(lrdf_add_preset(source.c_str(), name.c_str(), unique_id(), &defaults)); + free(lrdf_add_preset(source.c_str(), name.c_str(), id, &defaults)); string path = string_compose("%1/.%2", envvar, domain); if (g_mkdir_with_parents (path.c_str(), 0775)) { @@ -275,7 +307,7 @@ Plugin::save_preset (string name, string domain) } PluginPtr -ARDOUR::find_plugin(Session& session, string name, long unique_id, PluginType type) +ARDOUR::find_plugin(Session& session, string identifier, PluginType type) { PluginManager *mgr = PluginManager::the_manager(); PluginInfoList plugs; @@ -288,14 +320,12 @@ ARDOUR::find_plugin(Session& session, string name, long unique_id, PluginType ty #ifdef VST_SUPPORT case ARDOUR::VST: plugs = mgr->vst_plugin_info(); - unique_id = 0; // VST plugins don't have a unique id. break; #endif #ifdef HAVE_AUDIOUNITS case ARDOUR::AudioUnit: - plugs = AUPluginInfo::discover (); - unique_id = 0; // Neither do AU. + plugs = mgr->au_plugin_info(); break; #endif @@ -304,13 +334,49 @@ ARDOUR::find_plugin(Session& session, string name, long unique_id, PluginType ty } PluginInfoList::iterator i; + for (i = plugs.begin(); i != plugs.end(); ++i) { - if ((name == "" || (*i)->name == name) && - (unique_id == 0 || (*i)->unique_id == unique_id)) { - return (*i)->load (session); + if (identifier == (*i)->unique_id){ + return (*i)->load (session); } } return PluginPtr ((Plugin*) 0); } +int32_t +Plugin::can_support_input_configuration (int32_t in) +{ + /* LADSPA & VST should not get here because they do not + return negative i/o counts. + */ + return -1; +} + +int32_t +Plugin::compute_output_streams (int32_t nplugins) +{ + /* LADSPA & VST should not get here because they do not + return negative i/o counts. + */ + return -1; +} + +uint32_t +Plugin::output_streams () const +{ + /* LADSPA & VST should not get here because they do not + return negative i/o counts. + */ + return 0; +} + +uint32_t +Plugin::input_streams () const +{ + /* LADSPA & VST should not get here because they do not + return negative i/o counts. + */ + return 0; +} + |