aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorgretchen <gretchen@gnar.cool>2020-07-24 00:05:03 -0700
committergretchen <gretchen@gnar.cool>2020-07-24 00:05:43 -0700
commitd8d2b617f3ccc9491dc519403a28f599c621def3 (patch)
tree36b4eb634485230c33b306536bc93a5b59b62ff4
parenta38250123d31df15177ae51b2fb16d6ff21c7abe (diff)
downloadrhodes-d8d2b617f3ccc9491dc519403a28f599c621def3.tar.gz
rhodes-d8d2b617f3ccc9491dc519403a28f599c621def3.zip
Lazy jewel light level meterHEADmaster
-rw-r--r--README.org3
-rw-r--r--rhodes.lua24
2 files changed, 26 insertions, 1 deletions
diff --git a/README.org b/README.org
index f4ca030..cb4b5ff 100644
--- a/README.org
+++ b/README.org
@@ -4,4 +4,5 @@ midi FM rhodes simulation for norns.
Adapted for norns from [[https://sccode.org/1-522][this supercollider snippet]] by user 'snapizz', which is adapted from [[https://github.com/thestk/stk/blob/master/include/Rhodey.h][STK's rhodey]], which Perry R. Cook and Gary P. Scavone adapted from a Yamaha TX81z algorithm.
-Needs some visualization and more parameters (chorus? brightness? tube amp?). Email patches to [[mailto:gretchen@gnar.cool][<gretchen@gnar.cool>]].
+Needs some more parameters (chorus? brightness? tube amp?). Email
+patches to [[mailto:gretchen@gnar.cool][<gretchen@gnar.cool>]].
diff --git a/rhodes.lua b/rhodes.lua
index 04a8b1a..fdd92af 100644
--- a/rhodes.lua
+++ b/rhodes.lua
@@ -19,6 +19,16 @@ end
function redraw(level)
screen.clear();
screen.display_png(dir("rhodes.png"), 0, 0);
+
+ -- draw the jewel light level meter
+ -- do this here so it won't overdraw the screen
+ screen.circle(104, 32, 6)
+ screen.level(math.floor(level or 0))
+ screen.fill()
+ screen.circle(104, 32, 6)
+ screen.level(15)
+ screen.stroke()
+
screen.update()
end
@@ -124,7 +134,21 @@ function init ()
end
end})
params:default()
+
redraw()
+
+ -- set a poll to draw the jewel light level meter
+ p = poll.set("amp_out_l")
+ p.callback = function (val)
+ -- log this so it trails off naturally
+ level = math.log(10 * val + 1) * 15;
+ -- actually draw it in redraw, so it won't
+ -- draw over the menu
+ redraw(level)
+ end
+ p.time = 0.025
+ p:start()
+
end
function key (n, x)