From 2b3499b3057444de301e440cbf8bb5d5a55d3ea6 Mon Sep 17 00:00:00 2001
From: rorist <rorist@0xcafe.ch>
Date: Fri, 25 Aug 2023 21:17:54 +0200
Subject: [PATCH] Add time signature

---
 __init__.py | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/__init__.py b/__init__.py
index fb4f64b..bfd7c4f 100755
--- a/__init__.py
+++ b/__init__.py
@@ -36,7 +36,9 @@ class EndlessSequencer(Application):
         self.current_note = 0
         self.startTime = time.ticks_ms()
         self.SILENCE = 99
-        self.bpm = 240
+        self.bpm = 120
+        self.time_signature = [0.5, 1, 2] # 1/16, 1/8, 1/4
+        self.current_time_signature = 2 # 1/8
 
     def draw(self, ctx: Context) -> None:
         ctx.rgb(*colours.BLACK)
@@ -216,7 +218,7 @@ class EndlessSequencer(Application):
 
     def next_bpm(self):
         # taken from binarybrain code
-        beatTime = 60.0 * 1000.0 / self.bpm 
+        beatTime = 60.0 * 1000.0 / self.bpm / self.current_time_signature
         curRelTime = time.ticks_diff(time.ticks_ms(), self.startTime)
         return curRelTime / beatTime > 1
 
-- 
GitLab