prepare fix for copying plugin state
[ardour.git] / libs / ardour / vst_plugin.cc
index 7544865af19b139cd908029a1e6c808bb677a093..83d7dc2ced1990eecdfb2a7430664666bf9f4c15 100644 (file)
@@ -18,7 +18,7 @@
 */
 
 #include <glib.h>
-#include <glib/gstdio.h>
+#include "pbd/gstdio_compat.h"
 
 #include <glibmm/fileutils.h>
 #include <glibmm/miscutils.h>
@@ -44,6 +44,8 @@ VSTPlugin::VSTPlugin (AudioEngine& engine, Session& session, VSTHandle* handle)
        , _handle (handle)
        , _state (0)
        , _plugin (0)
+       , _pi (0)
+       , _num (0)
 {
 
 }
@@ -568,19 +570,9 @@ VSTPlugin::connect_and_run (BufferSet& bufs,
                uint32_t  index;
                bool      valid = false;
                index = out_map.get(DataType::AUDIO, out_index++, &valid);
-#ifdef VST_IN_PLACE
                outs[i] = (valid)
-                                       ? bufs.get_audio(index).data(offset)
-                                       : scratch_bufs.get_audio(0).data(offset);
-#else
-               if (!valid) {
-                       outs[i] = scratch_bufs.get_audio(0).data(offset);
-               } else {
-                       // TODO if this fixes various VST issues,
-                       // maintain a dedicated buffer, the stack may not be large enough
-                       outs[i] = (float*)alloca (nframes * sizeof(float));
-               }
-#endif
+                       ? bufs.get_audio(index).data(offset)
+                       : scratch_bufs.get_audio(0).data(offset);
        }
 
        if (bufs.count().n_midi() > 0) {
@@ -607,18 +599,6 @@ VSTPlugin::connect_and_run (BufferSet& bufs,
        _plugin->processReplacing (_plugin, &ins[0], &outs[0], nframes);
        _midi_out_buf = 0;
 
-#ifndef VST_IN_PLACE
-       out_index = 0;
-       for (i = 0; i < (int32_t) _plugin->numOutputs; ++i) {
-               uint32_t  index;
-               bool      valid = false;
-               index = out_map.get(DataType::AUDIO, out_index++, &valid);
-               if (!valid) {
-                       continue;
-               }
-               copy_vector (bufs.get_audio(index).data(offset), outs[i], nframes * sizeof(float));
-       }
-#endif
        return 0;
 }
 
@@ -696,7 +676,7 @@ VSTPlugin::find_presets ()
 
        int const vst_version = _plugin->dispatcher (_plugin, effGetVstVersion, 0, 0, NULL, 0);
        for (int i = 0; i < _plugin->numPrograms; ++i) {
-               PresetRecord r (string_compose (X_("VST:%1:%2"), unique_id (), i), "", -1, false);
+               PresetRecord r (string_compose (X_("VST:%1:%2"), unique_id (), i), "", false);
 
                if (vst_version >= 2) {
                        char buf[256];
@@ -726,7 +706,7 @@ VSTPlugin::find_presets ()
                        assert (uri);
                        assert (label);
 
-                       PresetRecord r (uri->value(), label->value(), -1, true);
+                       PresetRecord r (uri->value(), label->value(), true);
                        _presets.insert (make_pair (r.uri, r));
                }
        }