Skip to content

Instantly share code, notes, and snippets.

@ryland
Created November 6, 2018 03:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ryland/1b0f9739d4ac5729ab4ccf9ed6f652a2 to your computer and use it in GitHub Desktop.
Save ryland/1b0f9739d4ac5729ab4ccf9ed6f652a2 to your computer and use it in GitHub Desktop.
-- Panning Test
--
-- ---------------------
--
--
engine.name = "SoftCut"
l = 0.5
r = 0.5
function init()
engine.loop_start(1,1)
engine.loop_end(1,5)
engine.pos(1,1)
engine.loop_on(1,1)
engine.pre(1,1)
engine.amp(1,1)
engine.rec_on(1,1)
engine.rec(1,1)
engine.adc_rec(1,1,0.8)
engine.adc_rec(2,1,0.8)
engine.play_dac(1,1,l)
engine.play_dac(1,2,r)
engine.rate(1,1)
engine.reset(1)
engine.clear()
end
-- keys
function key(n,z)
if n == 2 and z == 1 then
l = 1.0
r = 0.0
elseif n == 3 and z == 1 then
l = 0.0
r = 1.0
end
engine.play_dac(1, 1, l)
engine.play_dac(1, 2, r)
redraw()
end
-- encoders
function enc(n,d)
if n == 2 then
l = util.clamp(l + d/100, 0.0,1.0)
elseif n == 3 then
r = util.clamp(r + d/100, 0.0,1.0)
end
engine.play_dac(1, 1, l)
engine.play_dac(1, 2, r)
redraw()
end
function redraw()
screen.clear()
screen.level(5)
screen.move(0,40)
screen.text("Pan Test")
screen.move(0,50)
screen.text("L: " .. l)
screen.move(0,60)
screen.text("R: " .. r)
screen.update()
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment