diff options
author | Eddy Pedroni <eddy@0xf7.com> | 2021-12-21 22:56:14 +0100 |
---|---|---|
committer | Eddy Pedroni <eddy@0xf7.com> | 2021-12-21 22:56:14 +0100 |
commit | 6bdde28f33b3e27349731291ee94c043ec238e4d (patch) | |
tree | 1f165897eba916bf9293f2ecf23ec1767ffadb5c /solo_tool.py | |
parent | 663970d0165e226147d95fb92c617714dfbd7553 (diff) |
AB controller integration test added
Diffstat (limited to 'solo_tool.py')
-rw-r--r-- | solo_tool.py | 22 |
1 files changed, 20 insertions, 2 deletions
diff --git a/solo_tool.py b/solo_tool.py index b1edba6..ff0f768 100644 --- a/solo_tool.py +++ b/solo_tool.py @@ -7,11 +7,15 @@ class SoloTool: def __init__(self, player=None): self._player = Player() if player is None else player self._playlist = Playlist(self._playlistCallback) - self._abController = ABController() + self._abController = ABController(callback=self._abControllerCallback) self._sessionManager = SessionManager(self._playlist, self._abController) def _playlistCallback(self, path): - self._player.setCurrentSong("") + self._player.setCurrentSong(path) + self._abController.setCurrentSong(path) + + def _abControllerCallback(self, position): + self._player.setPlaybackPosition(position) def addSong(self, path): self._sessionManager.addSong(path) @@ -19,6 +23,20 @@ class SoloTool: def setSong(self, index): self._playlist.setCurrentSong(index) + def addAbLimit(self, aLimit, bLimit): + self._abController.addLimits(aLimit, bLimit) + + def setAbLimit(self, index): + self._abController.setCurrentLimits(0) + + def tick(self): + position = self._player.getPlaybackPosition() + self._abController.positionChanged(position) + + def loadSession(self, path): + with open(path, "r") as f: + self._sessionManager.loadSession(f) + # Playback control def play(self): self._player.play() |