summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorNikolaus Gullotta <nikolaus.gullotta@gmail.com>2018-06-19 13:53:55 -0500
committerNikolaus Gullotta <nikolaus.gullotta@gmail.com>2018-06-19 13:54:16 -0500
commitc2d162c33e30a9b0a395da46bf28a4085f99df2b (patch)
tree7ddbc6e67ff2ebfc203b9aea5052173e315d4a55 /scripts
parente6a67784668a3ad398e5cc6d9f3ccc637f208d6f (diff)
cap redrawing at 15 times /s
Diffstat (limited to 'scripts')
-rw-r--r--scripts/noisegen.lua18
1 files changed, 13 insertions, 5 deletions
diff --git a/scripts/noisegen.lua b/scripts/noisegen.lua
index 684f421364..a4a5df8ff8 100644
--- a/scripts/noisegen.lua
+++ b/scripts/noisegen.lua
@@ -19,7 +19,14 @@ function dsp_ioconfig ()
return { [1] = { audio_in = -1, audio_out = -1}, }
end
+local rate = 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