Skip to content

Commit

Permalink
Merge branch 'link-start-stop-sync' of github.com:Bubobubobubobubo/sa…
Browse files Browse the repository at this point in the history
…rdine into link-start-stop-sync
  • Loading branch information
Bubobubobubobubo committed Jun 19, 2024
2 parents da77b18 + c524865 commit 27ee02c
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
2 changes: 1 addition & 1 deletion sardine_core/clock/link_clock.py
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ def tempo(self, new_tempo: float) -> None:
self.env.dispatch("tempo_change", self.tempo, new_tempo)
if self._link is not None:
session = self._link.captureSessionState()
session.setTempo(new_tempo, self.beats_per_bar)
session.setTempo(new_tempo, self._link_time)
self._link.commitSessionState(session)

## METHODS ##############################################################
Expand Down
8 changes: 7 additions & 1 deletion sardine_core/scheduler/async_runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -436,7 +436,7 @@ def start(self):
return

self._task = asyncio.create_task(self._runner())
self._task.add_done_callback(asyncio.Task.result)
self._task.add_done_callback(self._on_task_done)

def is_running(self) -> bool:
"""Returns True if the runner is running."""
Expand Down Expand Up @@ -867,3 +867,9 @@ def _skip_iteration(self) -> None:
def _jump_start_iteration(self) -> None:
self._jump_start = True
self._skip_iteration()

def _on_task_done(self, task: asyncio.Task) -> None:
if task.cancelled():
return # Suppress CancelledError

task.result() # Raise any exception if present

0 comments on commit 27ee02c

Please sign in to comment.