merge (with conflict fixes) with master (even against rgareus' recommendation)
[ardour.git] / libs / ardour / vst_plugin.cc
index c385e71a5af0393a90fcf7f936d5690832ec62b9..168bd0506ec25c83e0dc13e970eeb654eef6ac17 100644 (file)
@@ -197,14 +197,15 @@ int
 VSTPlugin::set_state (const XMLNode& node, int version)
 {
        LocaleGuard lg (X_("POSIX"));
+       int ret = -1;
 
        if (node.name() != state_node_name()) {
                error << _("Bad node sent to VSTPlugin::set_state") << endmsg;
                return 0;
        }
 
+#ifndef NO_PLUGIN_STATE
        XMLNode* child;
-       int ret = -1;
 
        if ((child = find_named_node (node, X_("chunk"))) != 0) {
 
@@ -237,6 +238,7 @@ VSTPlugin::set_state (const XMLNode& node, int version)
                ret = 0;
 
        }
+#endif
 
        Plugin::set_state (node, version);
        return ret;
@@ -296,7 +298,7 @@ VSTPlugin::get_parameter_descriptor (uint32_t which, ParameterDescriptor& desc)
 
                char label[64];
                /* some VST plugins expect this buffer to be zero-filled */
-               memset (label, sizeof (label), 0);
+               memset (label, 0, sizeof (label));
 
                _plugin->dispatcher (_plugin, effGetParamName, which, 0, label, 0);
                
@@ -484,7 +486,7 @@ string
 VSTPlugin::describe_parameter (Evoral::Parameter param)
 {
        char name[64];
-       memset (name, sizeof (name), 0);
+       memset (name, 0, sizeof (name));
 
        /* some VST plugins expect this buffer to be zero-filled */
 
@@ -526,8 +528,9 @@ VSTPlugin::connect_and_run (BufferSet& bufs,
 {
        Plugin::connect_and_run (bufs, in_map, out_map, nframes, offset);
 
-       float *ins[_plugin->numInputs];
-       float *outs[_plugin->numOutputs];
+       // VC++ doesn't support this C99 extension. Use alloca instead of dynamic array (rather than std::vector which allocs on the heap)
+       float** ins = (float**)alloca(_plugin->numInputs*sizeof(float*));
+       float** outs = (float**)alloca(_plugin->numInputs*sizeof(float*));
        int32_t i;
 
        const uint32_t nbufs = bufs.count().n_audio();
@@ -550,7 +553,7 @@ VSTPlugin::connect_and_run (BufferSet& bufs,
        }
 
        /* we already know it can support processReplacing */
-       _plugin->processReplacing (_plugin, ins, outs, nframes);
+       _plugin->processReplacing (_plugin, &ins[0], &outs[0], nframes);
 
        return 0;
 }