use new action map API instead of ActionManager::get_action
[ardour.git] / scripts / noisegen.lua
index 684f421364c4e4c5bf32af9578671692a4783872..bf7b006160a8fee4b3d0b0945c62a799a717f57d 100644 (file)
@@ -19,7 +19,14 @@ function dsp_ioconfig ()
        return { [1] = { audio_in = -1, audio_out = -1}, }
 end
 
+local sr = 0
+
+function dsp_init (rate)
+       sr = rate
+end
+
 local ao = 0
+local draw = 0
 
 function dsp_run (ins, outs, n_samples)
 
@@ -57,15 +64,16 @@ function dsp_run (ins, outs, n_samples)
                end
        end
 
+       if (draw > (sr/15)) then
+               self:queue_draw()
+               draw = 0
+       end
+
        -- passes array a {} into buffer
        for c = 1,#outs do
                outs[c]:set_table(a, n_samples)
        end
-
-       if (a ~= ao) then
-               self:queue_draw()
-       end
-       ao = amplitude
+       draw = draw + n_samples
 end
 
 function render_inline (ctx, w, max_h) --inline display