Skip to content

Commit 645a43d

Browse files
committed
Merge pull request #25 from spatialaudio/xrun-callback
include xrun_delayed_usecs into xrun callback
2 parents 5aca3a0 + f98bcc8 commit 645a43d

File tree

2 files changed

+6
-14
lines changed

2 files changed

+6
-14
lines changed

examples/chatty_client.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,8 +89,8 @@ def graph_order():
8989

9090

9191
@client.set_xrun_callback
92-
def xrun():
93-
print("xrun; delay", client.xrun_delayed_usecs, "microseconds")
92+
def xrun(delay):
93+
print("xrun; delay", delay, "microseconds")
9494

9595

9696
print("activating JACK")

jack.py

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -483,16 +483,6 @@ def last_frame_time(self):
483483
"""
484484
return _lib.jack_last_frame_time(self._ptr)
485485

486-
@property
487-
def xrun_delayed_usecs(self):
488-
"""Delay in microseconds due to the most recent XRUN occurrence.
489-
490-
This probably only makes sense when queried from a callback
491-
defined using :meth:`set_xrun_callback`.
492-
493-
"""
494-
return _lib.jack_get_xrun_delayed_usecs(self._ptr)
495-
496486
@property
497487
def inports(self):
498488
"""A list of audio input :class:`Ports`.
@@ -1284,8 +1274,10 @@ def set_xrun_callback(self, callback):
12841274
User-supplied function that is called whenever an xrun has
12851275
occured. It must have this signature::
12861276
1287-
callback() -> None
1277+
callback(delayed_usecs:float) -> None
12881278
1279+
The callback argument is the delay in microseconds due to
1280+
the most recent XRUN occurrence.
12891281
The `callback` is supposed to raise :class:`CallbackExit` on
12901282
error.
12911283
@@ -1297,7 +1289,7 @@ def set_xrun_callback(self, callback):
12971289
@self._callback("JackXRunCallback", error=_FAILURE)
12981290
def callback_wrapper(_):
12991291
try:
1300-
callback()
1292+
callback(_lib.jack_get_xrun_delayed_usecs(self._ptr))
13011293
except CallbackExit:
13021294
return _FAILURE
13031295
return _SUCCESS

0 commit comments

Comments
 (0)