handle sidechain input changes
[ardour.git] / libs / ardour / plugin.cc
index 047e1517105ec156fc4f8a7d32df8371838fa763..4bb5b02c77be15a04d440e136ed2e2d5c834b506 100644 (file)
@@ -46,6 +46,7 @@
 #include "ardour/chan_count.h"
 #include "ardour/chan_mapping.h"
 #include "ardour/data_type.h"
+#include "ardour/luaproc.h"
 #include "ardour/midi_buffer.h"
 #include "ardour/midi_state_tracker.h"
 #include "ardour/plugin.h"
@@ -122,7 +123,7 @@ Plugin::remove_preset (string name)
 {
        Plugin::PresetRecord const * p = preset_by_label (name);
        if (!p->user) {
-               PBD::error << _("Cannot remove plugin factory preset.") << PBD::endmsg;
+               PBD::error << _("Cannot remove plugin factory preset.") << endmsg;
                return;
        }
 
@@ -140,7 +141,7 @@ Plugin::PresetRecord
 Plugin::save_preset (string name)
 {
        if (preset_by_label (name)) {
-               PBD::error << _("Preset with given name already exists.") << PBD::endmsg;
+               PBD::error << _("Preset with given name already exists.") << endmsg;
                return Plugin::PresetRecord ();
        }
 
@@ -162,6 +163,13 @@ ARDOUR::find_plugin(Session& session, string identifier, PluginType type)
        PluginInfoList plugs;
 
        switch (type) {
+       case ARDOUR::Lua:
+               {
+                       PluginPtr plugin (new LuaProc (session.engine(), session, ""));
+                       return plugin;
+               }
+               break;
+
        case ARDOUR::LADSPA:
                plugs = mgr.ladspa_plugin_info();
                break;
@@ -252,6 +260,12 @@ Plugin::input_streams () const
 const Plugin::PresetRecord *
 Plugin::preset_by_label (const string& label)
 {
+#ifndef NO_PLUGIN_STATE
+       if (!_have_presets) {
+               find_presets ();
+               _have_presets = true;
+       }
+#endif
        // FIXME: O(n)
        for (map<string, PresetRecord>::const_iterator i = _presets.begin(); i != _presets.end(); ++i) {
                if (i->second.label == label) {
@@ -265,6 +279,12 @@ Plugin::preset_by_label (const string& label)
 const Plugin::PresetRecord *
 Plugin::preset_by_uri (const string& uri)
 {
+#ifndef NO_PLUGIN_STATE
+       if (!_have_presets) {
+               find_presets ();
+               _have_presets = true;
+       }
+#endif
        map<string, PresetRecord>::const_iterator pr = _presets.find (uri);
        if (pr != _presets.end()) {
                return &pr->second;