diff options
author | Eddy Pedroni <eddy@0xf7.com> | 2022-01-03 18:52:33 +0100 |
---|---|---|
committer | Eddy Pedroni <eddy@0xf7.com> | 2022-01-03 18:52:33 +0100 |
commit | e35f7280760bf8ed37c76fffc4d53529aea5e168 (patch) | |
tree | 3f8b2b2f4fa186fe053f89837be73baf4823a9b8 | |
parent | 91cbf23d3acc3e44b333cac95d45575bc7bacb1c (diff) |
Took event system into use in MIDI controller
-rw-r--r-- | midi_controller_launchpad_mini.py | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/midi_controller_launchpad_mini.py b/midi_controller_launchpad_mini.py index 3bcef13..cb3bc37 100644 --- a/midi_controller_launchpad_mini.py +++ b/midi_controller_launchpad_mini.py @@ -25,7 +25,7 @@ class MidiController: self._midiWrapper = MidiWrapper() self._registerHandlers() - + self._soloTool.registerPlayingStateCallback(self._updatePlayPauseButton) def _registerHandlers(self): self._handlers = { @@ -61,14 +61,17 @@ class MidiController: def _playPause(self): if self._soloTool.isPlaying(): self._soloTool.pause() - self._setButtonLED(7, 0, MidiController.LED_YELLOW) else: self._soloTool.play() - self._setButtonLED(7, 0, MidiController.LED_GREEN) def _stop(self): self._soloTool.stop() - self._setButtonLED(7, 0, MidiController.LED_YELLOW) + + def _updatePlayPauseButton(self): + if self._soloTool.isPlaying(): + self._setButtonLED(7, 0, MidiController.LED_GREEN) + else: + self._setButtonLED(7, 0, MidiController.LED_YELLOW) def _createSetPlaybackRateCallback(self, rate, column): def f(): |