Skip to content

Commit

Permalink
Merge pull request #41 from tildebyte/wip_encs_seq_length_rotate_2
Browse files Browse the repository at this point in the history
Add encoder 2 changes sequence length
  • Loading branch information
millxing authored Feb 26, 2020
2 parents 8318c0b + 60ace70 commit 0354427
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 4 deletions.
1 change: 1 addition & 0 deletions .luacheckrc
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ stds.norns = {
'key',
'metro',
'midi',
'norns',
'params',
'redraw',
'screen',
Expand Down
29 changes: 25 additions & 4 deletions quence.lua
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,10 @@ function init()
grid_device:rotation(0)
opening_animation()
math.randomseed(os.time())
for knob = 2, 3 do
norns.enc.accel(knob, false)
norns.enc.sens(knob, 3)
end

-- initalize variables
for track = 1, 4 do
Expand Down Expand Up @@ -953,14 +957,31 @@ function key(n, z)
end

function enc(n, delta)
if n == 2 then
if n == 2 then -- change seq length, with wrap
if delta > 0 then
shift_right()
seqlen[page] = seqlen[page] + 1
if seqlen[page] > 16 then
seqlen[page] = 1
end
elseif delta < 0 then
shift_left()
seqlen[page] = seqlen[page] - 1
if seqlen[page] < 1 then
seqlen[page] = 16
end
end
redraw()
tpage = -99 -- hack
grid_redraw()
elseif n == 3 then -- shift sequence L/R
if pause == 0 then -- doesn't seem to work well unless we're playing
if delta > 0 then
shift_right()
elseif delta < 0 then
shift_left()
end
end
end
end
end

function shift_left()
-- shifts the sequence to the left, wrapping the first note to the end of the sequence
Expand Down

0 comments on commit 0354427

Please sign in to comment.