summaryrefslogtreecommitdiff
path: root/libs/ardour/plugin.cc
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2008-01-10 21:20:59 +0000
committerDavid Robillard <d@drobilla.net>2008-01-10 21:20:59 +0000
commitbb457bb960c5bd7ed538f9d31477293415739f68 (patch)
tree84324a63b87c03589cd165b9e474296eaebb4772 /libs/ardour/plugin.cc
parent73dd9d37e7d715e0d78c0e51569968f9494dac7f (diff)
Merge libs/ardour and gtk2_ardour with 2.0-ongoing R2837.
git-svn-id: svn://localhost/ardour2/trunk@2883 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'libs/ardour/plugin.cc')
-rw-r--r--libs/ardour/plugin.cc48
1 files changed, 39 insertions, 9 deletions
diff --git a/libs/ardour/plugin.cc b/libs/ardour/plugin.cc
index bc5688c318..7f3f21b1fe 100644
--- a/libs/ardour/plugin.cc
+++ b/libs/ardour/plugin.cc
@@ -40,6 +40,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"
@@ -66,7 +70,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) {
@@ -108,6 +126,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;
@@ -126,7 +158,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)) {
@@ -149,7 +181,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;
@@ -162,14 +194,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
@@ -178,10 +208,10 @@ 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);
}
}