enough with umpteen "i18n.h" files. Consolidate on pbd/i18n.h
[ardour.git] / libs / ardour / plugin.cc
index 93ef60e639f4b263bd9a60d867ac940692c33c43..884ac0d53efbfc8b0f2607a2e55453483045219a 100644 (file)
@@ -65,7 +65,7 @@
 
 #include "pbd/stl_delete.h"
 
-#include "i18n.h"
+#include "pbd/i18n.h"
 #include <locale.h>
 
 using namespace std;
@@ -164,10 +164,7 @@ ARDOUR::find_plugin(Session& session, string identifier, PluginType type)
 
        switch (type) {
        case ARDOUR::Lua:
-               {
-                       PluginPtr plugin (new LuaProc (session.engine(), session, ""));
-                       return plugin;
-               }
+               plugs = mgr.lua_plugin_info();
                break;
 
        case ARDOUR::LADSPA:
@@ -257,9 +254,52 @@ Plugin::input_streams () const
        return ChanCount::ZERO;
 }
 
+Plugin::IOPortDescription
+Plugin::describe_io_port (ARDOUR::DataType dt, bool input, uint32_t id) const
+{
+       std::stringstream ss;
+       switch (dt) {
+               case DataType::AUDIO:
+                       ss << _("Audio") << " ";
+                       break;
+               case DataType::MIDI:
+                       ss << _("Midi") << " ";
+                       break;
+               default:
+                       ss << _("?") << " ";
+                       break;
+       }
+       if (input) {
+               ss << _("In") << " ";
+       } else {
+               ss << _("Out") << " ";
+       }
+
+       ss << (id + 1);
+
+       Plugin::IOPortDescription iod (ss.str());
+       return iod;
+}
+
+PluginOutputConfiguration
+Plugin::possible_output () const
+{
+       PluginOutputConfiguration oc;
+       if (_info) {
+               oc.insert (_info->n_outputs.n_audio ());
+       }
+       return oc;
+}
+
 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) {
@@ -273,6 +313,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;
@@ -283,8 +329,9 @@ Plugin::preset_by_uri (const string& uri)
 
 int
 Plugin::connect_and_run (BufferSet& bufs,
-                        ChanMapping /*in_map*/, ChanMapping /*out_map*/,
-                        pframes_t /* nframes */, framecnt_t /*offset*/)
+               framepos_t /*start*/, framepos_t /*end*/, double /*speed*/,
+               ChanMapping /*in_map*/, ChanMapping /*out_map*/,
+               pframes_t /* nframes */, framecnt_t /*offset*/)
 {
        if (bufs.count().n_midi() > 0) {
 
@@ -435,7 +482,7 @@ XMLNode &
 Plugin::get_state ()
 {
        XMLNode* root = new XMLNode (state_node_name ());
-       LocaleGuard lg (X_("C"));
+       LocaleGuard lg;
 
        root->add_property (X_("last-preset-uri"), _last_preset.uri);
        root->add_property (X_("last-preset-label"), _last_preset.label);