From b015f93a58f8c0d4bc36b504a55b88468640b141 Mon Sep 17 00:00:00 2001 From: Eddy Pedroni Date: Sun, 10 Nov 2024 12:23:21 +0100 Subject: MIDI controller interface seeking --- .../solo_tool/midi_controller_launchpad_mini.py | 23 ++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) (limited to 'solo-tool-project/src') 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) -- cgit v1.2.3