From d59428c81d9036a65ee52b38bc05c12ba2eed952 Mon Sep 17 00:00:00 2001 From: falkTX Date: Mon, 29 Apr 2013 10:38:43 +0100 Subject: [PATCH] Add Plugin menu group with some useful macros (closes #42) --- resources/ui/carla.ui | 51 ++++++++++++++++- source/carla.py | 111 ++++++++++++++++++++++++++++++++++++ source/carla_shared.py | 2 +- source/theme/CarlaStyle.cpp | 2 + 4 files changed, 164 insertions(+), 2 deletions(-) diff --git a/resources/ui/carla.ui b/resources/ui/carla.ui index e6e2e89d3..fd764fa87 100644 --- a/resources/ui/carla.ui +++ b/resources/ui/carla.ui @@ -297,9 +297,23 @@ &Plugin + + + Macros (all plugins) + + + + + + + + + + - + + @@ -674,6 +688,41 @@ Ctrl+Shift+F + + + Enable + + + + + Disable + + + + + Bypass + + + + + 100% Wet + + + + + Mute + + + + + 100% Volume + + + + + Center Balance + + diff --git a/source/carla.py b/source/carla.py index bbec5003f..e0c1efe4d 100755 --- a/source/carla.py +++ b/source/carla.py @@ -765,6 +765,14 @@ class CarlaMainW(QMainWindow): #self.connect(self.ui.act_plugin_refresh, SIGNAL("triggered()"), SLOT("slot_pluginRefresh()")) self.connect(self.ui.act_plugin_remove_all, SIGNAL("triggered()"), SLOT("slot_pluginRemoveAll()")) + self.connect(self.ui.act_plugins_enable, SIGNAL("triggered()"), SLOT("slot_pluginsEnable()")) + self.connect(self.ui.act_plugins_volume100, SIGNAL("triggered()"), SLOT("slot_pluginsVolume100()")) + self.connect(self.ui.act_plugins_wet100, SIGNAL("triggered()"), SLOT("slot_pluginsWet100()")) + self.connect(self.ui.act_plugins_center, SIGNAL("triggered()"), SLOT("slot_pluginsCenter()")) + self.connect(self.ui.act_plugins_disable, SIGNAL("triggered()"), SLOT("slot_pluginsDisable()")) + self.connect(self.ui.act_plugins_mute, SIGNAL("triggered()"), SLOT("slot_pluginsMute()")) + self.connect(self.ui.act_plugins_bypass, SIGNAL("triggered()"), SLOT("slot_pluginsBypass()")) + self.connect(self.ui.act_transport_play, SIGNAL("triggered(bool)"), SLOT("slot_transportPlayPause(bool)")) self.connect(self.ui.act_transport_stop, SIGNAL("triggered()"), SLOT("slot_transportStop()")) self.connect(self.ui.act_transport_backwards, SIGNAL("triggered()"), SLOT("slot_transportBackwards()")) @@ -845,6 +853,109 @@ class CarlaMainW(QMainWindow): else: QTimer.singleShot(0, self, SLOT("slot_engineStart()")) + @pyqtSlot() + def slot_pluginsEnable(self): + if not self.fEngineStarted: + return + + for i in range(self.fPluginCount): + pwidget = self.fPluginList[i] + + if pwidget is None: + break + + pwidget.setActive(True, True, True) + + @pyqtSlot() + def slot_pluginsVolume100(self): + if not self.fEngineStarted: + return + + for i in range(self.fPluginCount): + pwidget = self.fPluginList[i] + + if pwidget is None: + break + + if pwidget.fPluginInfo["hints"] & PLUGIN_CAN_VOLUME: + pwidget.ui.edit_dialog.setParameterValue(PARAMETER_VOLUME, 1.0) + Carla.host.set_volume(i, 1.0) + + @pyqtSlot() + def slot_pluginsWet100(self): + if not self.fEngineStarted: + return + + for i in range(self.fPluginCount): + pwidget = self.fPluginList[i] + + if pwidget is None: + break + + if pwidget.fPluginInfo["hints"] & PLUGIN_CAN_DRYWET: + pwidget.ui.edit_dialog.setParameterValue(PARAMETER_DRYWET, 1.0) + Carla.host.set_drywet(i, 1.0) + + @pyqtSlot() + def slot_pluginsCenter(self): + if not self.fEngineStarted: + return + + for i in range(self.fPluginCount): + pwidget = self.fPluginList[i] + + if pwidget is None: + break + + if pwidget.fPluginInfo["hints"] & PLUGIN_CAN_BALANCE: + pwidget.ui.edit_dialog.setParameterValue(PARAMETER_BALANCE_LEFT, -1.0) + pwidget.ui.edit_dialog.setParameterValue(PARAMETER_BALANCE_RIGHT, 1.0) + Carla.host.set_balance_left(i, -1.0) + Carla.host.set_balance_right(i, 1.0) + + @pyqtSlot() + def slot_pluginsDisable(self): + if not self.fEngineStarted: + return + + for i in range(self.fPluginCount): + pwidget = self.fPluginList[i] + + if pwidget is None: + break + + pwidget.setActive(False, True, True) + + @pyqtSlot() + def slot_pluginsMute(self): + if not self.fEngineStarted: + return + + for i in range(self.fPluginCount): + pwidget = self.fPluginList[i] + + if pwidget is None: + break + + if pwidget.fPluginInfo["hints"] & PLUGIN_CAN_VOLUME: + pwidget.ui.edit_dialog.setParameterValue(PARAMETER_VOLUME, 0.0) + Carla.host.set_volume(i, 0.0) + + @pyqtSlot() + def slot_pluginsBypass(self): + if not self.fEngineStarted: + return + + for i in range(self.fPluginCount): + pwidget = self.fPluginList[i] + + if pwidget is None: + break + + if pwidget.fPluginInfo["hints"] & PLUGIN_CAN_DRYWET: + pwidget.ui.edit_dialog.setParameterValue(PARAMETER_DRYWET, 0.0) + Carla.host.set_drywet(i, 0.0) + @pyqtSlot(int) def slot_diskFolderChanged(self, index): if index < 0: diff --git a/source/carla_shared.py b/source/carla_shared.py index 0631f1ab6..ae59f0a65 100644 --- a/source/carla_shared.py +++ b/source/carla_shared.py @@ -2070,7 +2070,7 @@ class PluginWidget(QFrame): self.ui.b_edit.setChecked(False) def recheckPluginHints(self, hints): - self.fPluginInfo['hints'] = hints + self.fPluginInfo["hints"] = hints self.ui.b_gui.setEnabled(hints & PLUGIN_HAS_GUI) def setActive(self, active, sendGui=False, sendCallback=True): diff --git a/source/theme/CarlaStyle.cpp b/source/theme/CarlaStyle.cpp index a5d9e9184..521b3a798 100644 --- a/source/theme/CarlaStyle.cpp +++ b/source/theme/CarlaStyle.cpp @@ -2165,6 +2165,8 @@ void CarlaStyle::drawControl(ControlElement element, const QStyleOption *option, x2 = y2; y2 = temp; } +#else + Q_UNUSED(flip); #endif painter->setRenderHint(QPainter::Antialiasing, true);