Oh boy!
[ardour.git] / libs / ardour / ladspa_plugin.cc
index f30925ac51f36865947fdedbaeb3e80ec13f0c27..075dc4b579b87a8a5977e8bc4f409f46fad08196 100644 (file)
@@ -51,7 +51,7 @@
 
 #include "pbd/stl_delete.h"
 
-#include "i18n.h"
+#include "pbd/i18n.h"
 #include <locale.h>
 
 using namespace std;
@@ -141,11 +141,8 @@ LadspaPlugin::init (string module_path, uint32_t index, framecnt_t rate)
                                *_latency_control_port = 0;
                        }
 
-                       if (!LADSPA_IS_PORT_INPUT(port_descriptor (i))) {
-                               continue;
-                       }
-
                        _shadow_data[i] = _default_value (i);
+                       _control_data[i] = _shadow_data[i];
                }
        }
 
@@ -350,8 +347,8 @@ void
 LadspaPlugin::add_state (XMLNode* root) const
 {
        XMLNode *child;
-       char buf[16];
-       LocaleGuard lg (X_("C"));
+       char buf[32];
+       LocaleGuard lg;
 
        for (uint32_t i = 0; i < parameter_count(); ++i){
 
@@ -377,14 +374,14 @@ LadspaPlugin::set_state (const XMLNode& node, int version)
 
 #ifndef NO_PLUGIN_STATE
        XMLNodeList nodes;
-       XMLProperty *prop;
+       XMLProperty const * prop;
        XMLNodeConstIterator iter;
        XMLNode *child;
        const char *port;
        const char *data;
        uint32_t port_id;
 #endif
-       LocaleGuard lg (X_("C"));
+       LocaleGuard lg;
 
        if (node.name() != state_node_name()) {
                error << _("Bad node sent to LadspaPlugin::set_state") << endmsg;
@@ -427,14 +424,14 @@ LadspaPlugin::set_state_2X (const XMLNode& node, int /* version */)
 {
 #ifndef NO_PLUGIN_STATE
        XMLNodeList nodes;
-       XMLProperty *prop;
+       XMLProperty const * prop;
        XMLNodeConstIterator iter;
        XMLNode *child;
        const char *port;
        const char *data;
        uint32_t port_id;
 #endif
-       LocaleGuard lg (X_("C"));
+       LocaleGuard lg;
 
        if (node.name() != state_node_name()) {
                error << _("Bad node sent to LadspaPlugin::set_state") << endmsg;
@@ -500,8 +497,13 @@ LadspaPlugin::get_parameter_descriptor (uint32_t which, ParameterDescriptor& des
                        desc.upper = prh.UpperBound;
                }
        } else {
-               desc.max_unbound = true;
-               desc.upper = 4; /* completely arbitrary */
+               if (LADSPA_IS_HINT_TOGGLED (prh.HintDescriptor)) {
+                       desc.max_unbound = false;
+                       desc.upper = 1;
+               } else {
+                       desc.max_unbound = true;
+                       desc.upper = 4; /* completely arbitrary */
+               }
        }
 
        if (LADSPA_IS_HINT_HAS_DEFAULT (prh.HintDescriptor)) {
@@ -569,10 +571,11 @@ LadspaPlugin::automatable () const
 
 int
 LadspaPlugin::connect_and_run (BufferSet& bufs,
+               framepos_t start, framepos_t end, double speed,
                ChanMapping in_map, ChanMapping out_map,
                pframes_t nframes, framecnt_t offset)
 {
-       Plugin::connect_and_run (bufs, in_map, out_map, nframes, offset);
+       Plugin::connect_and_run (bufs, start, end, speed, in_map, out_map, nframes, offset);
 
        cycles_t now;
        cycles_t then = get_cycles ();
@@ -805,6 +808,7 @@ LadspaPlugin::load_preset (PresetRecord r)
                for (uint32_t i = 0; i < (uint32_t) defs->count; ++i) {
                        if (parameter_is_input (defs->items[i].pid)) {
                                set_parameter(defs->items[i].pid, defs->items[i].value);
+                               PresetPortSetValue (defs->items[i].pid, defs->items[i].value); /* EMIT SIGNAL */
                        }
                }
                lrdf_free_setting_values(defs);