Skip to content

Commit

Permalink
feat: reset runner iterators when setting LinkClock.beat
Browse files Browse the repository at this point in the history
  • Loading branch information
thegamecracks committed Jun 18, 2024
1 parent 449d46f commit c524865
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
1 change: 1 addition & 0 deletions sardine_core/clock/link_clock.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ def beat(self) -> int:
def beat(self, beat: int) -> None:
self._last_capture.requestBeatAtTime(beat, self._link_time, self.beats_per_bar)
self._link.commitSessionState(self._last_capture)
self.env.dispatch("reset_iterator", 0)

@property
def beat_duration(self) -> float:
Expand Down
3 changes: 3 additions & 0 deletions sardine_core/scheduler/scheduler.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,3 +136,6 @@ def hook(self, event: str, *args):
self.reset()
if event == "tempo_change":
self._react_to_tempo_change(*args)
if event == "reset_iterator":
for runner in self.runners:
runner.iter = args[0]

0 comments on commit c524865

Please sign in to comment.