Compare commits
2 commits
8254bb042c
...
6b508ab86e
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
6b508ab86e | ||
|
|
ba8d57e7ab |
3 changed files with 9 additions and 3 deletions
2
VERSION
2
VERSION
|
|
@ -1 +1 @@
|
|||
0.0.63
|
||||
0.0.64
|
||||
|
|
|
|||
Binary file not shown.
|
|
@ -357,10 +357,16 @@ class App:
|
|||
self.bpm, self.lanes = parse_program(prog)
|
||||
self.master = self.lanes[0]
|
||||
self._reset_clock(); self.draw_bpm(); self.draw_status(); self.build_grid()
|
||||
def _lane_dur(self, L):
|
||||
beat = 60_000_000_000 / self.bpm
|
||||
if L['poly']: # ~ polymeter: fit this lane's whole cycle into lane 1's bar
|
||||
m = self.lanes[0]; master_bar = beat * (m['steps'] // m['sub'])
|
||||
return int(master_bar / L['steps'])
|
||||
return int(beat / L['sub']) # straight: a step = one beat / subdivision
|
||||
def _reset_clock(self):
|
||||
now = time.monotonic_ns()
|
||||
for L in self.lanes:
|
||||
L['next'] = now; L['step'] = -1; L['dur'] = int(60_000_000_000 / self.bpm / L['sub'])
|
||||
L['next'] = now; L['step'] = -1; L['dur'] = self._lane_dur(L)
|
||||
|
||||
# ---------- audio + light ----------
|
||||
def click(self, level):
|
||||
|
|
@ -388,7 +394,7 @@ class App:
|
|||
v = max(30, min(300, v))
|
||||
if v != self.bpm:
|
||||
self.bpm = v
|
||||
for L in self.lanes: L['dur'] = int(60_000_000_000 / self.bpm / L['sub'])
|
||||
for L in self.lanes: L['dur'] = self._lane_dur(L)
|
||||
self.draw_bpm()
|
||||
def goto(self, i):
|
||||
was = self.running; self.load(i); self._label("play")
|
||||
|
|
|
|||
Loading…
Reference in a new issue