From 704b59914f8a0ea2702659b4e2c52b4d723b1c51 Mon Sep 17 00:00:00 2001 From: falkTX Date: Sun, 2 Feb 2014 14:22:29 +0000 Subject: [PATCH] Make the keys send notes to the selected plugin(s) --- source/carla_patchbay.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/source/carla_patchbay.py b/source/carla_patchbay.py index cb74a6de9..da4d9294f 100644 --- a/source/carla_patchbay.py +++ b/source/carla_patchbay.py @@ -69,6 +69,7 @@ class CarlaPatchbayW(QFrame): self.fParent = parent self.fPluginCount = 0 self.fPluginList = [] + self.fSelectedPlugins = [] self.fCanvasWidth = 0 self.fCanvasHeight = 0 @@ -107,6 +108,9 @@ class CarlaPatchbayW(QFrame): self.fMiniCanvasPreview.miniCanvasMoved.connect(self.slot_miniCanvasMoved) + self.fKeys.keyboard.noteOn.connect(self.slot_noteOn) + self.fKeys.keyboard.noteOff.connect(self.slot_noteOff) + if not doSetup: return parent.ui.act_plugins_enable.triggered.connect(self.slot_pluginsEnable) @@ -352,6 +356,7 @@ class CarlaPatchbayW(QFrame): @pyqtSlot(list) def slot_canvasPluginSelected(self, pluginList): self.fKeys.setEnabled(len(pluginList) != 0) + self.fSelectedPlugins = pluginList @pyqtSlot(float, float) def slot_miniCanvasMoved(self, xp, yp): @@ -363,6 +368,18 @@ class CarlaPatchbayW(QFrame): # ----------------------------------------------------------------- + @pyqtSlot(int) + def slot_noteOn(self, note): + for pluginId in self.fSelectedPlugins: + Carla.host.send_midi_note(pluginId, 0, note, 100) + + @pyqtSlot(int) + def slot_noteOff(self, note): + for pluginId in self.fSelectedPlugins: + Carla.host.send_midi_note(pluginId, 0, note, 0) + + # ----------------------------------------------------------------- + @pyqtSlot() def slot_pluginsEnable(self): if not Carla.host.is_engine_running():