diff options
author | Eddy Pedroni <epedroni@pm.me> | 2024-11-10 09:39:29 +0100 |
---|---|---|
committer | Eddy Pedroni <epedroni@pm.me> | 2024-11-10 09:39:29 +0100 |
commit | 85b0116f80515c71e0250e4910c721b9e4fabca1 (patch) | |
tree | f046e140c13c3be744b041193e9100ea748c582b /solo-tool-project/src | |
parent | 7c00f418caf8f1e9fcb235563127a9c8cea22bb4 (diff) |
Set A and B limits via MIDI controller
Diffstat (limited to 'solo-tool-project/src')
-rw-r--r-- | solo-tool-project/src/solo_tool/midi_controller_launchpad_mini.py | 41 |
1 files changed, 28 insertions, 13 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 8f32650..ee77d21 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 @@ -30,16 +30,21 @@ class MidiController: self._soloTool.registerPlaybackRateCallback(self._updateRateRow) self._soloTool.registerAbLimitEnabledCallback(self._updateToggleAbLimitEnableButton) + self._aLimit = 0.0 + self._bLimit = 0.0 + def _registerHandlers(self): self._handlers = { 96 : self._soloTool.stop, - 99 : self._soloTool.jumpToA, + 114 : self._soloTool.jumpToA, 112 : self._playPause, - 101 : self._toggleAbLimitEnable, - 102 : self._soloTool.previousStoredAbLimits, - 103 : self._soloTool.nextStoredAbLimits, - 118 : self._soloTool.previousSong, - 119 : self._soloTool.nextSong + 98 : self._toggleAbLimitEnable, + 118 : self._soloTool.previousStoredAbLimits, + 119 : self._soloTool.nextStoredAbLimits, + 116 : self._setALimit, + 117 : self._setBLimit, + 48 : self._soloTool.previousSong, + 55 : self._soloTool.nextSong } for i in range(0, 8): @@ -71,6 +76,14 @@ class MidiController: else: self._soloTool.play() + def _setALimit(self): + self._aLimit = self._soloTool.getPlaybackPosition() + self._soloTool.setAbLimits(self._aLimit, self._bLimit) + + def _setBLimit(self): + self._bLimit = self._soloTool.getPlaybackPosition() + self._soloTool.setAbLimits(self._aLimit, self._bLimit) + def _toggleAbLimitEnable(self): self._soloTool.setAbLimitEnable(not self._soloTool.isAbLimitEnabled()) @@ -82,9 +95,9 @@ class MidiController: def _updateToggleAbLimitEnableButton(self, enabled): if enabled: - self._setButtonLED(6, 5, MidiController.LED_GREEN) + self._setButtonLED(6, 2, MidiController.LED_GREEN) else: - self._setButtonLED(6, 5, MidiController.LED_RED) + self._setButtonLED(6, 2, MidiController.LED_RED) def _updateVolumeRow(self, volume): t1 = int(round(volume / MidiController.PLAYBACK_VOLUME_STEP, 1)) @@ -138,11 +151,13 @@ class MidiController: self._updateToggleAbLimitEnableButton(self._soloTool.isAbLimitEnabled()) # AB control - self._setButtonLED(6, 3, MidiController.LED_YELLOW) - self._setButtonLED(6, 6, MidiController.LED_RED) - self._setButtonLED(6, 7, MidiController.LED_GREEN) - - # Song control + self._setButtonLED(7, 2, MidiController.LED_YELLOW) self._setButtonLED(7, 6, MidiController.LED_RED) self._setButtonLED(7, 7, MidiController.LED_GREEN) + self._setButtonLED(7, 4, MidiController.LED_YELLOW) + self._setButtonLED(7, 5, MidiController.LED_YELLOW) + + # Song control + self._setButtonLED(3, 0, MidiController.LED_RED) + self._setButtonLED(3, 7, MidiController.LED_GREEN) |