diff options
author | Eddy Pedroni <epedroni@pm.me> | 2024-11-10 12:23:21 +0100 |
---|---|---|
committer | Eddy Pedroni <epedroni@pm.me> | 2024-11-10 12:23:21 +0100 |
commit | b015f93a58f8c0d4bc36b504a55b88468640b141 (patch) | |
tree | f3f76e510d5a3fc892b5f9c3a874653cbc80c93c /solo-tool-project/src/solo_tool | |
parent | 85b0116f80515c71e0250e4910c721b9e4fabca1 (diff) |
MIDI controller interface seeking
Diffstat (limited to 'solo-tool-project/src/solo_tool')
-rw-r--r-- | solo-tool-project/src/solo_tool/midi_controller_launchpad_mini.py | 23 |
1 files changed, 21 insertions, 2 deletions
diff --git a/solo-tool-project/src/solo_tool/midi_controller_launchpad_mini.py b/solo-tool-project/src/solo_tool/midi_controller_launchpad_mini.py index ee77d21..fb6e385 100644 --- a/solo-tool-project/src/solo_tool/midi_controller_launchpad_mini.py +++ b/solo-tool-project/src/solo_tool/midi_controller_launchpad_mini.py @@ -44,7 +44,13 @@ class MidiController: 116 : self._setALimit, 117 : self._setBLimit, 48 : self._soloTool.previousSong, - 55 : self._soloTool.nextSong + 49 : self._createSeekHandler(-0.25), + 50 : self._createSeekHandler(-0.05), + 51 : self._createSeekHandler(-0.01), + 52 : self._createSeekHandler(0.01), + 53 : self._createSeekHandler(0.05), + 54 : self._createSeekHandler(0.25), + 55 : self._soloTool.nextSong, } for i in range(0, 8): @@ -75,7 +81,14 @@ class MidiController: self._soloTool.pause() else: self._soloTool.play() - + + def _createSeekHandler(self, delta): + def f(): + newPosition = self._soloTool.getPlaybackPosition() + delta + newPosition = min(1.0, max(0.0, newPosition)) + self._soloTool.setPlaybackPosition(newPosition) + return f + def _setALimit(self): self._aLimit = self._soloTool.getPlaybackPosition() self._soloTool.setAbLimits(self._aLimit, self._bLimit) @@ -159,5 +172,11 @@ class MidiController: # Song control self._setButtonLED(3, 0, MidiController.LED_RED) + self._setButtonLED(3, 1, MidiController.LED_RED) + self._setButtonLED(3, 2, MidiController.LED_RED) + self._setButtonLED(3, 3, MidiController.LED_RED) + self._setButtonLED(3, 4, MidiController.LED_GREEN) + self._setButtonLED(3, 5, MidiController.LED_GREEN) + self._setButtonLED(3, 6, MidiController.LED_GREEN) self._setButtonLED(3, 7, MidiController.LED_GREEN) |