From e35f7280760bf8ed37c76fffc4d53529aea5e168 Mon Sep 17 00:00:00 2001 From: Eddy Pedroni Date: Mon, 3 Jan 2022 18:52:33 +0100 Subject: Took event system into use in MIDI controller --- midi_controller_launchpad_mini.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'midi_controller_launchpad_mini.py') 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(): -- cgit v1.2.3