fix crashes for plugin using maxBlockLength during latency compute.
[ardour.git] / libs / ardour / lv2_plugin.cc
index b32d61dbc2f279b5217a2194d642434d85a04de2..fe214e965959485cf3f55760b48cf617d01e1572 100644 (file)
@@ -1895,8 +1895,9 @@ LV2Plugin::latency_compute_run()
        uint32_t in_index   = 0;
        uint32_t out_index  = 0;
 
-       const framecnt_t bufsize = 1024;
-       float            buffer[bufsize];
+       // this is done in the main thread. non realtime.
+       const framecnt_t bufsize = _engine.samples_per_cycle();
+       float            *buffer = (float*) malloc(_engine.samples_per_cycle() * sizeof(float));
 
        memset(buffer, 0, sizeof(float) * bufsize);
 
@@ -1922,6 +1923,7 @@ LV2Plugin::latency_compute_run()
        if (was_activated) {
                activate();
        }
+       free(buffer);
 }
 
 const LilvPort*