From b609b4ce55104c77a3f69366874a3e25e3061172 Mon Sep 17 00:00:00 2001 From: Eddy Pedroni Date: Thu, 3 Feb 2022 20:20:30 +0100 Subject: Added AB toggle button to MIDI interface --- midi_controller_launchpad_mini.py | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) (limited to 'midi_controller_launchpad_mini.py') diff --git a/midi_controller_launchpad_mini.py b/midi_controller_launchpad_mini.py index 6790cec..0cc952c 100644 --- a/midi_controller_launchpad_mini.py +++ b/midi_controller_launchpad_mini.py @@ -28,12 +28,14 @@ class MidiController: self._soloTool.registerPlayingStateCallback(self._updatePlayPauseButton) self._soloTool.registerPlaybackVolumeCallback(self._updateVolumeRow) self._soloTool.registerPlaybackRateCallback(self._updateRateRow) + self._soloTool.registerAbLimitEnabledCallback(self._updateToggleAbLimitEnableButton) def _registerHandlers(self): self._handlers = { - 96 : self._stop, + 96 : self._soloTool.stop, + 99 : self._soloTool.jumpToA, 112 : self._playPause, - 101 : self._soloTool.jumpToA, + 101 : self._toggleAbLimitEnable, 102 : self._soloTool.previousStoredAbLimits, 103 : self._soloTool.nextStoredAbLimits, 118 : self._soloTool.previousSong, @@ -66,8 +68,8 @@ class MidiController: else: self._soloTool.play() - def _stop(self): - self._soloTool.stop() + def _toggleAbLimitEnable(self): + self._soloTool.setAbLimitEnable(not self._soloTool.isAbLimitEnabled()) def _updatePlayPauseButton(self, playing): if playing: @@ -75,6 +77,12 @@ class MidiController: else: self._setButtonLED(7, 0, MidiController.LED_YELLOW) + def _updateToggleAbLimitEnableButton(self, enabled): + if enabled: + self._setButtonLED(6, 5, MidiController.LED_GREEN) + else: + self._setButtonLED(6, 5, MidiController.LED_RED) + def _updateVolumeRow(self, volume): t1 = int(round(volume / MidiController.PLAYBACK_VOLUME_STEP, 1)) t2 = int(round(MidiController.MIN_PLAYBACK_VOLUME / MidiController.PLAYBACK_VOLUME_STEP, 1)) @@ -123,8 +131,11 @@ class MidiController: self._setButtonLED(6, 0, MidiController.LED_RED) self._updatePlayPauseButton(self._soloTool.isPlaying()) + # AB repeat toggle + self._updateToggleAbLimitEnableButton(self._soloTool.isAbLimitEnabled()) + # AB control - self._setButtonLED(6, 5, MidiController.LED_YELLOW) + self._setButtonLED(6, 3, MidiController.LED_YELLOW) self._setButtonLED(6, 6, MidiController.LED_RED) self._setButtonLED(6, 7, MidiController.LED_GREEN) -- cgit v1.2.3