diff options
author | Eddy Pedroni <eddy@0xf7.com> | 2022-02-03 20:20:30 +0100 |
---|---|---|
committer | Eddy Pedroni <eddy@0xf7.com> | 2022-02-03 20:20:30 +0100 |
commit | b609b4ce55104c77a3f69366874a3e25e3061172 (patch) | |
tree | db0095a810acc63d34e1719f59fca668fa693bf0 /midi_controller_launchpad_mini.py | |
parent | 6debe39546e62d5796f22db2388341ae9132042d (diff) |
Added AB toggle button to MIDI interface
Diffstat (limited to 'midi_controller_launchpad_mini.py')
-rw-r--r-- | midi_controller_launchpad_mini.py | 21 |
1 files changed, 16 insertions, 5 deletions
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) |