Skip to content
Snippets Groups Projects
Commit ea20912c authored by rorist's avatar rorist
Browse files

Add bpm control

parent dce667cd
No related branches found
No related tags found
No related merge requests found
...@@ -36,8 +36,8 @@ class EndlessSequencer(Application): ...@@ -36,8 +36,8 @@ class EndlessSequencer(Application):
'bark.wav', 'bark.wav',
'nya.wav', 'nya.wav',
] ]
#self.sample_names = [ self.sample_names = [
# 'close.wav' ] 'close.wav' ]
self.current_sample = None self.current_sample = None
self.current_note = 0 self.current_note = 0
self.startTime = time.ticks_ms() self.startTime = time.ticks_ms()
...@@ -55,7 +55,7 @@ class EndlessSequencer(Application): ...@@ -55,7 +55,7 @@ class EndlessSequencer(Application):
).fill() ).fill()
ctx.save() ctx.save()
ctx.move_to(0, 0) ctx.move_to(0, -10)
ctx.text_baseline = ctx.MIDDLE ctx.text_baseline = ctx.MIDDLE
ctx.text_align = ctx.CENTER ctx.text_align = ctx.CENTER
ctx.rgb(*colours.GO_GREEN) ctx.rgb(*colours.GO_GREEN)
...@@ -75,6 +75,7 @@ class EndlessSequencer(Application): ...@@ -75,6 +75,7 @@ class EndlessSequencer(Application):
# Main UI # Main UI
ctx.rgb(*colours.WHITE) ctx.rgb(*colours.WHITE)
# Buttons
ctx.move_to(0, -80) ctx.move_to(0, -80)
ctx.font_size = 80 ctx.font_size = 80
ctx.text("^") ctx.text("^")
...@@ -91,12 +92,22 @@ class EndlessSequencer(Application): ...@@ -91,12 +92,22 @@ class EndlessSequencer(Application):
ctx.text("reset") ctx.text("reset")
ctx.rotate(0.45) ctx.rotate(0.45)
# CURRENT SAMPLE
if self.current_sample != None and self.current_sample < len(self.sample_names): if self.current_sample != None and self.current_sample < len(self.sample_names):
ctx.move_to(0, 40) ctx.move_to(0, 25)
ctx.rgb(*colours.RED) ctx.rgb(*colours.RED)
ctx.font_size = 20 ctx.font_size = 20
ctx.text(self.sample_names[self.current_sample]) ctx.text(self.sample_names[self.current_sample])
# BPM
ctx.move_to(0, 60)
ctx.rgb(*colours.WHITE)
ctx.font_size = 24
ctx.text("BPM: {}".format(self.bpm))
ctx.move_to(0, 80)
ctx.font_size = 14
ctx.text("left btn to adjust")
ctx.restore() ctx.restore()
def think(self, ins: InputState, delta_ms: int) -> None: def think(self, ins: InputState, delta_ms: int) -> None:
...@@ -120,6 +131,12 @@ class EndlessSequencer(Application): ...@@ -120,6 +131,12 @@ class EndlessSequencer(Application):
ct = captouch.read() ct = captouch.read()
# Input command # Input command
btn = self.input.buttons.app
if btn.left.repeated or btn.left.pressed:
self.bpm -= 1
if btn.right.repeated or btn.right.pressed:
self.bpm += 1
if ct.petals[9].pressed: #reset if ct.petals[9].pressed: #reset
if self.DEBUG: if self.DEBUG:
print("CLEAR SEQ") print("CLEAR SEQ")
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment