aboutsummaryrefslogtreecommitdiffstats
path: root/abcontroller.py
diff options
context:
space:
mode:
authorEddy Pedroni <eddy@0xf7.com>2022-01-01 16:37:14 +0100
committerEddy Pedroni <eddy@0xf7.com>2022-01-01 16:37:14 +0100
commitd3be030dd3bc1e737870c676f9179e6fdd106a5d (patch)
treefaf9ffb6aa4a67b6fdcad762a52f9982952ed49f /abcontroller.py
parentb04c158210b816af3ad423a3a823c5a25591ac78 (diff)
Added current index getter to AB controller
Diffstat (limited to 'abcontroller.py')
-rw-r--r--abcontroller.py8
1 files changed, 7 insertions, 1 deletions
diff --git a/abcontroller.py b/abcontroller.py
index c04b8db..e4088b4 100644
--- a/abcontroller.py
+++ b/abcontroller.py
@@ -7,7 +7,8 @@ class ABController:
self._setPositionCallback = callback
self._limits = dict() # dictionary of all songs
self._songLimits = None # list of limits for selected song
- self._currentLimits = _AB(0.0, 0.0) # a/b positions of selected limit
+ self._currentLimits = _AB(0.0, 0.0) # a/b positions of active limit
+ self._loadedIndex = None
self._enabled = enabled
def _ensureSongExists(self, path):
@@ -37,9 +38,11 @@ class ABController:
if index >= 0 and index < len(self._songLimits):
self._currentLimits = self._songLimits[index]
+ self._loadedIndex = index
def setLimits(self, aLimit, bLimit):
self._currentLimits = _AB(aLimit, bLimit)
+ self._loadedIndex = None
def positionChanged(self, position):
if position > self._currentLimits.b and self._setPositionCallback and self._enabled:
@@ -54,5 +57,8 @@ class ABController:
def getCurrentLimits(self):
return self._currentLimits
+ def getLoadedIndex(self):
+ return self._loadedIndex
+
def clear(self):
self.__init__(enabled=self._enabled, callback=self._setPositionCallback)