diff options
author | Eddy Pedroni <eddy@0xf7.com> | 2022-01-01 19:09:01 +0100 |
---|---|---|
committer | Eddy Pedroni <eddy@0xf7.com> | 2022-01-01 19:09:01 +0100 |
commit | f7480bb96323b8466ad8e097475db2a7135c88e0 (patch) | |
tree | ce588932ed3afd93ecdb21941d357c7fe56c40df /abcontroller.py | |
parent | d28a1b91afa86b6e39ac4df24d8bada7e795b20b (diff) |
Added next/previous AB limit functionality
Diffstat (limited to 'abcontroller.py')
-rw-r--r-- | abcontroller.py | 17 |
1 files changed, 16 insertions, 1 deletions
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) + |