Skip to content

Commit f1a9f61

Browse files
committed
Add transport_frame property, deprecate transport_locate
See #33.
1 parent 1c913e1 commit f1a9f61

File tree

1 file changed

+23
-6
lines changed

1 file changed

+23
-6
lines changed

jack.py

Lines changed: 23 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
import errno as _errno
2929
import platform as _platform
3030
from cffi import FFI as _FFI
31+
import warnings as _warnings
3132

3233
_ffi = _FFI()
3334
_ffi.cdef("""
@@ -685,18 +686,34 @@ def transport_state(self):
685686
"""
686687
return TransportState(_lib.jack_transport_query(self._ptr, _ffi.NULL))
687688

688-
def transport_locate(self, frame):
689-
"""Reposition the JACK transport to a new frame number.
689+
@property
690+
def transport_frame(self):
691+
"""Get/set current JACK transport frame.
690692
691-
Parameters
692-
----------
693-
frame : int
694-
Frame number.
693+
Return an estimate of the current transport frame, including any
694+
time elapsed since the last transport positional update.
695+
Assigning a frame number repositions the JACK transport.
695696
696697
"""
698+
return _lib.jack_get_current_transport_frame(self._ptr)
699+
700+
@transport_frame.setter
701+
def transport_frame(self, frame):
697702
_check(_lib.jack_transport_locate(self._ptr, frame),
698703
"Error locating JACK transport")
699704

705+
def transport_locate(self, frame):
706+
"""
707+
708+
.. deprecated:: 0.4.1
709+
Use :attr:`transport_frame` instead
710+
711+
"""
712+
_warnings.warn(
713+
'transport_locate() is deprecated, use transport_frame',
714+
DeprecationWarning)
715+
self.transport_frame = frame
716+
700717
def transport_query(self):
701718
"""Query the current transport state and position.
702719

0 commit comments

Comments
 (0)