From 27ba3bc396a2da4ffcc39e3e36da5f37df8f628e Mon Sep 17 00:00:00 2001 From: Eddy Pedroni Date: Sat, 1 Jan 2022 20:54:15 +0100 Subject: Added playback rate functionality to launchpad --- midi_controller_launchpad_mini.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'midi_controller_launchpad_mini.py') diff --git a/midi_controller_launchpad_mini.py b/midi_controller_launchpad_mini.py index adf18d5..960dd7d 100644 --- a/midi_controller_launchpad_mini.py +++ b/midi_controller_launchpad_mini.py @@ -11,14 +11,18 @@ class MidiController: self._midiWrapper = MidiWrapper() self._handlers = { + 96 : self._soloTool.stop, 112 : self._playPause, - 96 : self._soloTool.stop, 101 : self._soloTool.jumpToA, 102 : self._soloTool.previousStoredAbLimits, 103 : self._soloTool.nextStoredAbLimits, 118 : self._soloTool.previousSong, 119 : self._soloTool.nextSong } + + for i in range(16, 24): + rate = round(0.5 + (i - 16) * 0.1, 1) + self._handlers[i] = self._createSetPlaybackRateCallback(rate) def connect(self): self._midiWrapper.connect(MidiController.DEVICE_NAME) @@ -37,3 +41,8 @@ class MidiController: else: self._soloTool.play() + def _createSetPlaybackRateCallback(self, rate): + def f(): + self._soloTool.setPlaybackRate(rate) + return f + -- cgit v1.2.3