From f7480bb96323b8466ad8e097475db2a7135c88e0 Mon Sep 17 00:00:00 2001 From: Eddy Pedroni Date: Sat, 1 Jan 2022 19:09:01 +0100 Subject: Added next/previous AB limit functionality --- abcontroller.py | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) (limited to 'abcontroller.py') diff --git a/abcontroller.py b/abcontroller.py index e4088b4..3604a85 100644 --- a/abcontroller.py +++ b/abcontroller.py @@ -35,11 +35,25 @@ class ABController: def loadLimits(self, index): if not self._songLimits: return - + if index >= 0 and index < len(self._songLimits): self._currentLimits = self._songLimits[index] self._loadedIndex = index + def nextStoredAbLimits(self): + if self._loadedIndex is None: + nextIndex = 0 + else: + nextIndex = self._loadedIndex + 1 + self.loadLimits(nextIndex) + + def previousStoredAbLimits(self): + if self._loadedIndex is None: + previousIndex = 0 + else: + previousIndex = self._loadedIndex - 1 + self.loadLimits(previousIndex) + def setLimits(self, aLimit, bLimit): self._currentLimits = _AB(aLimit, bLimit) self._loadedIndex = None @@ -62,3 +76,4 @@ class ABController: def clear(self): self.__init__(enabled=self._enabled, callback=self._setPositionCallback) + -- cgit v1.2.3