diff --git a/Makefile b/Makefile index 4352652ea..0ca934230 100644 --- a/Makefile +++ b/Makefile @@ -98,6 +98,7 @@ UIs = \ source/ui_carla_edit.py \ source/ui_carla_host.py \ source/ui_carla_parameter.py \ + source/ui_carla_plugin_basic_fx.py \ source/ui_carla_plugin_default.py \ source/ui_carla_plugin_calf.py \ source/ui_carla_plugin_zita.py \ diff --git a/resources/bitmaps/background_noise1.png b/resources/bitmaps/background_noise1.png new file mode 100644 index 000000000..b6e386540 Binary files /dev/null and b/resources/bitmaps/background_noise1.png differ diff --git a/resources/resources.qrc b/resources/resources.qrc index 044c0d3fb..227a08079 100644 --- a/resources/resources.qrc +++ b/resources/resources.qrc @@ -48,6 +48,7 @@ bitmaps/carla_about.png bitmaps/background_calf.png + bitmaps/background_noise1.png bitmaps/background_zynfx.png bitmaps/button_calf1.png bitmaps/button_calf2.png diff --git a/resources/ui/carla_edit.ui b/resources/ui/carla_edit.ui index 91d386020..9af6f9443 100644 --- a/resources/ui/carla_edit.ui +++ b/resources/ui/carla_edit.ui @@ -108,7 +108,7 @@ - + 34 @@ -125,10 +125,10 @@ Qt::CustomContextMenu - Output volume (100%) + Output dry/wet (100%) - 1270 + 1000 1000 @@ -136,7 +136,7 @@ - + 34 @@ -153,10 +153,10 @@ Qt::CustomContextMenu - Output dry/wet (100%) + Output volume (100%) - 1000 + 1270 1000 diff --git a/resources/ui/carla_plugin_basic_fx.ui b/resources/ui/carla_plugin_basic_fx.ui new file mode 100644 index 000000000..db8d96361 --- /dev/null +++ b/resources/ui/carla_plugin_basic_fx.ui @@ -0,0 +1,415 @@ + + + PluginWidget + + + Qt::CustomContextMenu + + + Frame + + + + 1 + + + 2 + + + 1 + + + 2 + + + 0 + + + + + 1 + + + + + Qt::Horizontal + + + QSizePolicy::Fixed + + + + 20 + 1 + + + + + + + + + 24 + 24 + + + + + 24 + 24 + + + + + + + + :/bitmaps/button_off.png:/bitmaps/button_off.png + + + + 24 + 24 + + + + true + + + true + + + + + + + + 24 + 24 + + + + + 24 + 24 + + + + + + + + :/bitmaps/button_gui.png:/bitmaps/button_gui.png + + + + 24 + 24 + + + + true + + + true + + + + + + + + 24 + 24 + + + + + 24 + 24 + + + + + + + + :/bitmaps/button_edit.png:/bitmaps/button_edit.png + + + + 24 + 24 + + + + true + + + true + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + PluginName + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + TYPE + + + + + + + Qt::Horizontal + + + QSizePolicy::Fixed + + + + 20 + 1 + + + + + + + + + + 0 + + + 1 + + + Qt::Horizontal + + + + + + + 10 + + + 2 + + + + + + 20 + 0 + + + + + 20 + 16777215 + + + + + + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + 34 + 34 + + + + + 34 + 34 + + + + Qt::CustomContextMenu + + + Output dry/wet (100%) + + + 1000 + + + 1000 + + + + + + + + 34 + 34 + + + + + 34 + 34 + + + + Qt::CustomContextMenu + + + Output volume (100%) + + + 1270 + + + 1000 + + + + + + + 1 + + + 0 + + + 0 + + + 0 + + + 4 + + + + + + 150 + 0 + + + + + 150 + 16777215 + + + + + + + + + 150 + 0 + + + + + 150 + 16777215 + + + + + + + + + + + 20 + 0 + + + + + 20 + 16777215 + + + + + + + + + + + DigitalPeakMeter + QWidget +
digitalpeakmeter.h
+ 1 +
+ + PixmapButton + QPushButton +
pixmapbutton.h
+
+ + PixmapDial + QDial +
pixmapdial.h
+
+
+ + + + +
diff --git a/resources/ui/carla_plugin_calf.ui b/resources/ui/carla_plugin_calf.ui index 0d25f4197..ecc633d67 100644 --- a/resources/ui/carla_plugin_calf.ui +++ b/resources/ui/carla_plugin_calf.ui @@ -279,14 +279,14 @@ 1 - PixmapButton + LEDButton QPushButton -
pixmapbutton.h
+
ledbutton.h
- LEDButton + PixmapButton QPushButton -
ledbutton.h
+
pixmapbutton.h
diff --git a/resources/ui/carla_plugin_default.ui b/resources/ui/carla_plugin_default.ui index 60ea64e21..28bead933 100644 --- a/resources/ui/carla_plugin_default.ui +++ b/resources/ui/carla_plugin_default.ui @@ -54,14 +54,14 @@ - 22 - 22 + 24 + 24 - 22 - 22 + 24 + 24 @@ -89,14 +89,14 @@ - 22 - 22 + 24 + 24 - 22 - 22 + 24 + 24 @@ -124,14 +124,14 @@ - 22 - 22 + 24 + 24 - 22 - 22 + 24 + 24 diff --git a/source/backend/engine/CarlaEngineJack.cpp b/source/backend/engine/CarlaEngineJack.cpp index 0133f259c..dc9c6c0f4 100644 --- a/source/backend/engine/CarlaEngineJack.cpp +++ b/source/backend/engine/CarlaEngineJack.cpp @@ -1511,7 +1511,9 @@ protected: } } +#ifndef BUILD_BRIDGE carla_fill(fRackPorts, kRackPortCount, nullptr); +#endif fClient = nullptr; callback(ENGINE_CALLBACK_QUIT, 0, 0, 0, 0.0f, nullptr); diff --git a/source/backend/plugin/CarlaPluginThread.cpp b/source/backend/plugin/CarlaPluginThread.cpp index b4c3b6392..fc7657c28 100644 --- a/source/backend/plugin/CarlaPluginThread.cpp +++ b/source/backend/plugin/CarlaPluginThread.cpp @@ -258,15 +258,11 @@ void CarlaPluginThread::run() CARLA_ASSERT(fProcess->state() == QProcess::NotRunning); if (fProcess->exitCode() != 0 || fProcess->exitStatus() == QProcess::CrashExit) - { carla_stderr("CarlaPluginThread::run() - GUI crashed while opening"); - fEngine->callback(CarlaBackend::ENGINE_CALLBACK_UI_STATE_CHANGED, fPlugin->getId(), -1, 0, 0.0f, nullptr); - } else - { - carla_debug("CarlaPluginThread::run() - GUI timeout"); - fEngine->callback(CarlaBackend::ENGINE_CALLBACK_UI_STATE_CHANGED, fPlugin->getId(), 0, 0, 0.0f, nullptr); - } + carla_stdout("CarlaPluginThread::run() - GUI timeout"); + + fEngine->callback(CarlaBackend::ENGINE_CALLBACK_UI_STATE_CHANGED, fPlugin->getId(), 0, 0, 0.0f, nullptr); } break; diff --git a/source/carla_rack.py b/source/carla_rack.py index d0fe57694..292ac4cb1 100644 --- a/source/carla_rack.py +++ b/source/carla_rack.py @@ -19,7 +19,7 @@ # ------------------------------------------------------------------------------------------------------------ # Imports (Global) -from PyQt4.QtCore import QSize, QTimer +from PyQt4.QtCore import Qt, QSize, QTimer from PyQt4.QtGui import QApplication, QListWidget, QListWidgetItem # ------------------------------------------------------------------------------------------------------------ @@ -39,6 +39,7 @@ class CarlaRackItem(QListWidgetItem): self.widget = createPluginSlot(parent, pluginId) self.widget.setFixedHeight(self.widget.getFixedHeight()) + self.setFlags(Qt.ItemIsSelectable|Qt.ItemIsEnabled) # Qt.ItemIsDragEnabled|Qt.ItemIsDropEnabled self.setSizeHint(QSize(300, self.widget.getFixedHeight())) parent.setItemWidget(self, self.widget) @@ -55,6 +56,20 @@ class CarlaRackItem(QListWidgetItem): #self.widget.ui.label_name.setText(newName) #self.widget.ui.edit_dialog.setName(newName) + # ----------------------------------------------------------------- + + #def paintEvent(self, event): + #painter = QPainter(self) + #painter.save() + + #painter.setPen(QPen(Qt.black, 3)) + #painter.setBrush(Qt.black) + #painter.drawRect(0, 0, self.width(), self.height()) + #painter.drawLine(0, self.height()-4, self.width(), self.height()-4) + + #painter.restore() + #QListWidgetItem.paintEvent(self, event) + # ------------------------------------------------------------------------------------------------------------ # Rack widget @@ -69,28 +84,33 @@ class CarlaRackW(QListWidget): self.fPluginCount = 0 self.fPluginList = [] + self.fCurrentRow = -1 + self.fLastSelectedItem = None + # ------------------------------------------------------------- # Set-up GUI stuff - self.setMinimumWidth(640) # required by zita, 591 was old value + self.setMinimumWidth(644) # required by zita, 591 was old value self.setSortingEnabled(False) - app = QApplication.instance() - pal1 = app.palette().base().color() - pal2 = app.palette().button().color() - col1 = "stop:0 rgb(%i, %i, %i)" % (pal1.red(), pal1.green(), pal1.blue()) - col2 = "stop:1 rgb(%i, %i, %i)" % (pal2.red(), pal2.green(), pal2.blue()) - - self.setStyleSheet(""" - QListWidget { - background-color: qlineargradient(spread:pad, - x1:0.0, y1:0.0, - x2:0.2, y2:1.0, - %s, - %s - ); - } - """ % (col1, col2)) + self.currentRowChanged.connect(self.slot_currentRowChanged) + + #app = QApplication.instance() + #pal1 = app.palette().base().color() + #pal2 = app.palette().button().color() + #col1 = "stop:0 rgb(%i, %i, %i)" % (pal1.red(), pal1.green(), pal1.blue()) + #col2 = "stop:1 rgb(%i, %i, %i)" % (pal2.red(), pal2.green(), pal2.blue()) + + #self.setStyleSheet(""" + #QListWidget { + #background-color: qlineargradient(spread:pad, + #x1:0.0, y1:0.0, + #x2:0.2, y2:1.0, + #%s, + #%s + #); + #} + #""" % (col1, col2)) # ------------------------------------------------------------- # Connect actions to functions @@ -507,3 +527,19 @@ class CarlaRackW(QListWidget): pitem.widget.fEditDialog.reloadAll() # ----------------------------------------------------------------- + + def slot_currentRowChanged(self, row): + self.fCurrentRow = row + + if self.fLastSelectedItem is not None: + self.fLastSelectedItem.setSelected(False) + + if row < 0 or row >= self.fPluginCount or self.fPluginList[row] is None: + self.fLastSelectedItem = None + return + + pitem = self.fPluginList[row] + pitem.widget.setSelected(True) + self.fLastSelectedItem = pitem.widget + + # ----------------------------------------------------------------- diff --git a/source/carla_shared.py b/source/carla_shared.py index 6ccafcdf7..b7dd320cc 100644 --- a/source/carla_shared.py +++ b/source/carla_shared.py @@ -621,6 +621,38 @@ def getAndSetPath(self_, currentPath, lineEdit): lineEdit.setText(newPath) return newPath +# ------------------------------------------------------------------------------------------------------------ +# Get plugin type as string + +def getPluginTypeAsString(ptype): + if ptype == PLUGIN_INTERNAL: + return "Internal" + if ptype == PLUGIN_LADSPA: + return "LADSPA" + if ptype == PLUGIN_DSSI: + return "DSSI" + if ptype == PLUGIN_LV2: + return "LV2" + if ptype == PLUGIN_VST: + return "VST" + if ptype == PLUGIN_VST3: + return "VST3" + if ptype == PLUGIN_AU: + return "AU" + if ptype == PLUGIN_JACK: + return "JACK" + if ptype == PLUGIN_REWIRE: + return "ReWire" + if ptype == PLUGIN_FILE_CSD: + return "CSD" + if ptype == PLUGIN_FILE_GIG: + return "GIG" + if ptype == PLUGIN_FILE_SF2: + return "SF2" + if ptype == PLUGIN_FILE_SFZ: + return "SFZ" + return "Unknown" + # ------------------------------------------------------------------------------------------------------------ # Custom MessageBox diff --git a/source/carla_skin.py b/source/carla_skin.py index 527cd9e37..cb94d28d1 100644 --- a/source/carla_skin.py +++ b/source/carla_skin.py @@ -19,12 +19,14 @@ # ------------------------------------------------------------------------------------------------------------ # Imports (Global) -from PyQt4.QtGui import QFont, QFrame, QPushButton +from PyQt4.QtCore import Qt +from PyQt4.QtGui import QFont, QFrame, QPen, QPushButton # ------------------------------------------------------------------------------------------------------------ # Imports (Custom) import ui_carla_plugin_default +import ui_carla_plugin_basic_fx import ui_carla_plugin_calf import ui_carla_plugin_zita import ui_carla_plugin_zynfx @@ -59,6 +61,7 @@ class AbstractPluginSlot(QFrame): # Internal stuff self.fIsActive = False + self.fIsSelected = False self.fLastGreenLedState = False self.fLastBlueLedState = False @@ -97,7 +100,9 @@ class AbstractPluginSlot(QFrame): self.cb_presets = None - self.label_name = None + self.label_name = None + self.label_type = None + self.led_control = None self.led_midi = None self.led_audio_in = None @@ -130,6 +135,9 @@ class AbstractPluginSlot(QFrame): if self.label_name is not None: self.label_name.setText(self.fPluginInfo['name']) + if self.label_type is not None: + self.label_type.setText(getPluginTypeAsString(self.fPluginInfo['type'])) + if self.led_control is not None: self.led_control.setColor(self.led_control.YELLOW) self.led_control.setEnabled(False) @@ -158,7 +166,9 @@ class AbstractPluginSlot(QFrame): for paramIndex, paramWidget in self.fParameterList: paramWidget.valueChanged.connect(self.slot_parameterValueChanged) - paramWidget.setValue(Carla.host.get_current_parameter_value(self.fPluginId, paramIndex) * 1000) + + if paramIndex >= 0 and Carla.host is not None: + paramWidget.setValue(Carla.host.get_current_parameter_value(self.fPluginId, paramIndex) * 1000) #------------------------------------------------------------------ @@ -186,6 +196,13 @@ class AbstractPluginSlot(QFrame): if self.label_name is not None: self.label_name.setText(name) + def setSelected(self, yesNo): + if self.fIsSelected == yesNo: + return + + self.fIsSelected = yesNo + self.update() + #------------------------------------------------------------------ def setActive(self, active, sendGui=False, sendCallback=True): @@ -420,6 +437,18 @@ class AbstractPluginSlot(QFrame): #------------------------------------------------------------------ + def drawOutline(self): + painter = QPainter(self) + + if self.fIsSelected: + painter.setPen(QPen(Qt.cyan, 4)) + painter.setBrush(Qt.transparent) + painter.drawRect(0, 0, self.width(), self.height()) + else: + painter.setPen(QPen(Qt.black, 1)) + painter.setBrush(Qt.black) + painter.drawLine(0, self.height()-1, self.width(), self.height()-1) + def showDefaultCustomMenu(self, isEnabled, bEdit = None, bGui = None): menu = QMenu(self) @@ -513,8 +542,11 @@ class AbstractPluginSlot(QFrame): index = self.sender().getIndex() value = float(value)/1000.0 - Carla.host.set_parameter_value(self.fPluginId, index, value) - self.setParameterValue(index, value, False) + if index < 0: + self.setInternalParameter(index, value) + else: + Carla.host.set_parameter_value(self.fPluginId, index, value) + self.setParameterValue(index, value, False) @pyqtSlot(int) def slot_programChanged(self, index): @@ -526,6 +558,12 @@ class AbstractPluginSlot(QFrame): Carla.host.set_midi_program(self.fPluginId, index) self.setMidiProgram(index, False) + #------------------------------------------------------------------ + + def paintEvent(self, event): + self.drawOutline() + QFrame.paintEvent(self, event) + # ------------------------------------------------------------------------------------------------------------ class PluginSlot_Default(AbstractPluginSlot): @@ -606,7 +644,7 @@ class PluginSlot_Default(AbstractPluginSlot): #------------------------------------------------------------------ def getFixedHeight(self): - return 48 + return 36 #------------------------------------------------------------------ @@ -657,6 +695,166 @@ class PluginSlot_Default(AbstractPluginSlot): # ------------------------------------------------------------------------------------------------------------ +class PluginSlot_BasicFX(AbstractPluginSlot): + def __init__(self, parent, pluginId): + AbstractPluginSlot.__init__(self, parent, pluginId) + self.ui = ui_carla_plugin_basic_fx.Ui_PluginWidget() + self.ui.setupUi(self) + + # ------------------------------------------------------------- + # Set-up GUI + + labelFont = QFont() + labelFont.setBold(True) + labelFont.setPointSize(9) + + self.ui.label_name.setFont(labelFont) + self.ui.label_type.setFont(labelFont) + + r = 40 + g = 40 + b = 40 + + if self.fPluginInfo['category'] == PLUGIN_CATEGORY_MODULATOR: + r += 10 + elif self.fPluginInfo['category'] == PLUGIN_CATEGORY_EQ: + g += 10 + elif self.fPluginInfo['category'] == PLUGIN_CATEGORY_FILTER: + b += 10 + elif self.fPluginInfo['category'] == PLUGIN_CATEGORY_DELAY: + r += 15 + b -= 15 + elif self.fPluginInfo['category'] == PLUGIN_CATEGORY_DISTORTION: + g += 10 + b += 10 + elif self.fPluginInfo['category'] == PLUGIN_CATEGORY_DYNAMICS: + r += 10 + b += 10 + elif self.fPluginInfo['category'] == PLUGIN_CATEGORY_UTILITY: + r += 10 + g += 10 + + self.setStyleSheet(""" + QFrame#PluginWidget { + background-color: rgb(%i, %i, %i); + background-image: url(:/bitmaps/background_noise1.png); + background-repeat: repeat-xy; + }""" % (r, g, b)) + + self.ui.b_enable.setPixmaps(":/bitmaps/button_off.png", ":/bitmaps/button_on.png", ":/bitmaps/button_off.png") + self.ui.b_edit.setPixmaps(":/bitmaps/button_edit.png", ":/bitmaps/button_edit_down.png", ":/bitmaps/button_edit_hover.png") + + if self.fPluginInfo['iconName'] == "distrho": + self.ui.b_gui.setPixmaps(":/bitmaps/button_distrho.png", ":/bitmaps/button_distrho_down.png", ":/bitmaps/button_distrho_hover.png") + elif self.fPluginInfo['iconName'] == "file": + self.ui.b_gui.setPixmaps(":/bitmaps/button_file.png", ":/bitmaps/button_file_down.png", ":/bitmaps/button_file_hover.png") + else: + self.ui.b_gui.setPixmaps(":/bitmaps/button_gui.png", ":/bitmaps/button_gui_down.png", ":/bitmaps/button_gui_hover.png") + + # ------------------------------------------------------------- + # Set-up parameters + + parameterCount = Carla.host.get_parameter_count(self.fPluginId) if Carla.host is not None else 0 + + index = 0 + for i in range(min(parameterCount, 8)): + paramInfo = Carla.host.get_parameter_info(self.fPluginId, i) + paramData = Carla.host.get_parameter_data(self.fPluginId, i) + paramRanges = Carla.host.get_parameter_ranges(self.fPluginId, i) + + if paramData['type'] != PARAMETER_INPUT: + continue + + paramName = charPtrToString(paramInfo['name']).split("/", 1)[0].split(" (", 1)[0].strip() + paramLow = paramName.lower() + + if "Bandwidth" in paramName: + paramName = paramName.replace("Bandwidth", "Bw") + elif "Frequency" in paramName: + paramName = paramName.replace("Frequency", "Freq") + elif "Output" in paramName: + paramName = paramName.replace("Output", "Out") + elif paramLow == "threshold": + paramName = "Thres" + + if len(paramName) > 9: + paramName = paramName[:9] + + #if self.fPluginInfo['category'] == PLUGIN_CATEGORY_FILTER: + #_r = 55 + float(i)/8*200 + #_g = 255 - float(i)/8*200 + #_b = 127 - r*2 + #elif self.fPluginInfo['category'] == PLUGIN_CATEGORY_DELAY: + #_r = 127 + #_g = 55 + float(i)/8*200 + #_b = 255 - float(i)/8*200 + #elif r < b < g: + #_r = 55 + float(i)/8*200 + #_g = 127 + #_b = 255 - float(i)/8*200 + #else: + _r = 255 - float(i)/8*200 + _g = 55 + float(i)/8*200 + _b = (r-40)*4 + + #if _r < 140: _r = 140 + #if _g < 140: _g = 140 + #if _b < 140: _b = 140 + + widget = PixmapDial(self, i) + widget.setPixmap(3) + widget.setLabel(paramName) + widget.setCustomColor(QColor(_r, _g, _b)) + widget.setCustomPaint(PixmapDial.CUSTOM_PAINT_COLOR) + + widget.setSingleStep(paramRanges['step']*1000) + widget.setMinimum(paramRanges['min']*1000) + widget.setMaximum(paramRanges['max']*1000) + + if (paramData['hints'] & PARAMETER_IS_ENABLED) == 0: + widget.setEnabled(False) + + self.ui.w_knobs.layout().insertWidget(index, widget) + index += 1 + + self.fParameterList.append([i, widget]) + + self.ui.dial_drywet.setIndex(PARAMETER_DRYWET) + self.ui.dial_drywet.setPixmap(3) + self.ui.dial_drywet.setLabel("Dry/Wet") + self.ui.dial_drywet.setCustomPaint(PixmapDial.CUSTOM_PAINT_CARLA_WET) + + self.ui.dial_vol.setIndex(PARAMETER_VOLUME) + self.ui.dial_vol.setPixmap(3) + self.ui.dial_vol.setLabel("Volume") + self.ui.dial_vol.setCustomPaint(PixmapDial.CUSTOM_PAINT_CARLA_VOL) + + self.fParameterList.append([PARAMETER_DRYWET, self.ui.dial_drywet]) + self.fParameterList.append([PARAMETER_VOLUME, self.ui.dial_vol]) + + # ------------------------------------------------------------- + + self.b_enable = self.ui.b_enable + self.b_gui = self.ui.b_gui + self.b_edit = self.ui.b_edit + + self.label_name = self.ui.label_name + self.label_type = self.ui.label_type + + self.peak_in = self.ui.peak_in + self.peak_out = self.ui.peak_out + + self.ready() + + self.customContextMenuRequested.connect(self.slot_showDefaultCustomMenu) + + #------------------------------------------------------------------ + + def getFixedHeight(self): + return 79 + +# ------------------------------------------------------------------------------------------------------------ + class PluginSlot_Calf(AbstractPluginSlot): def __init__(self, parent, pluginId): AbstractPluginSlot.__init__(self, parent, pluginId) @@ -677,13 +875,15 @@ class PluginSlot_Calf(AbstractPluginSlot): # Set-up GUI self.setStyleSheet(""" - QLabel#label_name, QLabel#label_audio_in, QLabel#label_audio_out, QLabel#label_midi { - color: black; - } - QFrame#PluginWidget { - background-image: url(:/bitmaps/background_calf.png); - background-repeat: repeat-xy; - }""") + QLabel#label_name, QLabel#label_audio_in, QLabel#label_audio_out, QLabel#label_midi { + color: black; + } + QFrame#PluginWidget { + background-image: url(:/bitmaps/background_calf.png); + background-repeat: repeat-xy; + border: 2px; + } + """) self.ui.b_gui.setPixmaps(":/bitmaps/button_calf2.png", ":/bitmaps/button_calf2_down.png", ":/bitmaps/button_calf2_hover.png") self.ui.b_edit.setPixmaps(":/bitmaps/button_calf2.png", ":/bitmaps/button_calf2_down.png", ":/bitmaps/button_calf2_hover.png") @@ -741,7 +941,7 @@ class PluginSlot_Calf(AbstractPluginSlot): #------------------------------------------------------------------ def getFixedHeight(self): - return 75 + return 70 #------------------------------------------------------------------ @@ -772,24 +972,25 @@ class PluginSlot_ZitaRev(AbstractPluginSlot): self.setMinimumWidth(640) self.setStyleSheet(""" - QFrame#PluginWidget { - background-color: #404040; - } - QWidget#w_revsect { - background-image: url(:/bitmaps/zita-rev/revsect.png); - } - QWidget#w_eq1sect { - background-image: url(:/bitmaps/zita-rev/eq1sect.png); - } - QWidget#w_eq2sect { - background-image: url(:/bitmaps/zita-rev/eq2sect.png); - } - QWidget#w_ambmixsect { - background-image: url(:/bitmaps/zita-rev/%s.png); - } - QWidget#w_redzita { - background-image: url(:/bitmaps/zita-rev/redzita.png); - } + QFrame#PluginWidget { + background-color: #404040; + border: 2px solid transparent; + } + QWidget#w_revsect { + background-image: url(:/bitmaps/zita-rev/revsect.png); + } + QWidget#w_eq1sect { + background-image: url(:/bitmaps/zita-rev/eq1sect.png); + } + QWidget#w_eq2sect { + background-image: url(:/bitmaps/zita-rev/eq2sect.png); + } + QWidget#w_ambmixsect { + background-image: url(:/bitmaps/zita-rev/%s.png); + } + QWidget#w_redzita { + background-image: url(:/bitmaps/zita-rev/redzita.png); + } """ % ("mixsect" if audioCount['outs'] == 2 else "ambsect")) # ------------------------------------------------------------- @@ -875,19 +1076,25 @@ class PluginSlot_ZitaRev(AbstractPluginSlot): #------------------------------------------------------------------ def getFixedHeight(self): - return 75 + return 79 + + #------------------------------------------------------------------ + + def paintEvent(self, event): + AbstractPluginSlot.paintEvent(self, event) + self.drawOutline() def resizeEvent(self, event): - self.fKnobDelay.move(self.ui.w_revsect.x()+31, 33) - self.fKnobXover.move(self.ui.w_revsect.x()+93, 18) - self.fKnobRtLow.move(self.ui.w_revsect.x()+148, 18) - self.fKnobRtMid.move(self.ui.w_revsect.x()+208, 18) - self.fKnobDamping.move(self.ui.w_revsect.x()+268, 18) - self.fKnobEq1Freq.move(self.ui.w_eq1sect.x()+20, 33) - self.fKnobEq1Gain.move(self.ui.w_eq1sect.x()+69, 18) - self.fKnobEq2Freq.move(self.ui.w_eq2sect.x()+20, 33) - self.fKnobEq2Gain.move(self.ui.w_eq2sect.x()+69, 18) - self.fKnobMix.move(self.ui.w_ambmixsect.x()+24, 33) + self.fKnobDelay.move(self.ui.w_revsect.x()+31, self.ui.w_revsect.y()+33) + self.fKnobXover.move(self.ui.w_revsect.x()+93, self.ui.w_revsect.y()+18) + self.fKnobRtLow.move(self.ui.w_revsect.x()+148, self.ui.w_revsect.y()+18) + self.fKnobRtMid.move(self.ui.w_revsect.x()+208, self.ui.w_revsect.y()+18) + self.fKnobDamping.move(self.ui.w_revsect.x()+268, self.ui.w_revsect.y()+18) + self.fKnobEq1Freq.move(self.ui.w_eq1sect.x()+20, self.ui.w_eq1sect.y()+33) + self.fKnobEq1Gain.move(self.ui.w_eq1sect.x()+69, self.ui.w_eq1sect.y()+18) + self.fKnobEq2Freq.move(self.ui.w_eq2sect.x()+20, self.ui.w_eq2sect.y()+33) + self.fKnobEq2Gain.move(self.ui.w_eq2sect.x()+69, self.ui.w_eq2sect.y()+18) + self.fKnobMix.move(self.ui.w_ambmixsect.x()+24, self.ui.w_ambmixsect.y()+33) AbstractPluginSlot.resizeEvent(self, event) # ------------------------------------------------------------------------------------------------------------ @@ -902,10 +1109,12 @@ class PluginSlot_ZynFX(AbstractPluginSlot): # Set-up GUI self.setStyleSheet(""" - QFrame#PluginWidget { - background-image: url(:/bitmaps/background_zynfx.png); - background-repeat: repeat-xy; - }""") + QFrame#PluginWidget { + background-image: url(:/bitmaps/background_zynfx.png); + background-repeat: repeat-xy; + border: 2px; + } + """) self.ui.b_enable.setPixmaps(":/bitmaps/button_off.png", ":/bitmaps/button_on.png", ":/bitmaps/button_off.png") self.ui.b_edit.setPixmaps(":/bitmaps/button_edit.png", ":/bitmaps/button_edit_down.png", ":/bitmaps/button_edit_hover.png") @@ -1088,7 +1297,7 @@ def createPluginSlot(parent, pluginId): if pluginName.split(" ", 1)[0].lower() == "calf": return PluginSlot_Calf(parent, pluginId) - #return PluginSlot_Pixmap(parent, pluginId) + return PluginSlot_BasicFX(parent, pluginId) return PluginSlot_Default(parent, pluginId) # ------------------------------------------------------------------------------------------------------------ @@ -1099,27 +1308,12 @@ if __name__ == '__main__': import resources_rc app = CarlaApplication("Carla-Skins") + #gui = PluginSlot_BasicFX(None, 0) #gui = PluginSlot_Calf(None, 0) + #gui = PluginSlot_Default(None, 0) + #gui = PluginSlot_ZitaRev(None, 0) gui = PluginSlot_ZynFX(None, 0) + gui.setSelected(True) gui.show() app.exec_() - -#if (self.pinfo['category'] == PLUGIN_CATEGORY_SYNTH): -#self.set_plugin_widget_color(PALETTE_COLOR_WHITE) -#elif (self.pinfo['category'] == PLUGIN_CATEGORY_DELAY): -#self.set_plugin_widget_color(PALETTE_COLOR_ORANGE) -#elif (self.pinfo['category'] == PLUGIN_CATEGORY_EQ): -#self.set_plugin_widget_color(PALETTE_COLOR_GREEN) -#elif (self.pinfo['category'] == PLUGIN_CATEGORY_FILTER): -#self.set_plugin_widget_color(PALETTE_COLOR_BLUE) -#elif (self.pinfo['category'] == PLUGIN_CATEGORY_DYNAMICS): -#self.set_plugin_widget_color(PALETTE_COLOR_PINK) -#elif (self.pinfo['category'] == PLUGIN_CATEGORY_MODULATOR): -#self.set_plugin_widget_color(PALETTE_COLOR_RED) -#elif (self.pinfo['category'] == PLUGIN_CATEGORY_UTILITY): -#self.set_plugin_widget_color(PALETTE_COLOR_YELLOW) -#elif (self.pinfo['category'] == PLUGIN_CATEGORY_OUTRO): -#self.set_plugin_widget_color(PALETTE_COLOR_BROWN) -#else: -#self.set_plugin_widget_color(PALETTE_COLOR_NONE) diff --git a/source/carla_widgets.py b/source/carla_widgets.py index 272f85bd8..d98c68fc9 100755 --- a/source/carla_widgets.py +++ b/source/carla_widgets.py @@ -549,33 +549,9 @@ class PluginEdit(QDialog): midiCountInfo = gFakePortCountInfo paramCountInfo = gFakePortCountInfo - pluginType = self.fPluginInfo['type'] pluginHints = self.fPluginInfo['hints'] - if pluginType == PLUGIN_INTERNAL: - self.ui.le_type.setText(self.tr("Internal")) - elif pluginType == PLUGIN_LADSPA: - self.ui.le_type.setText("LADSPA") - elif pluginType == PLUGIN_DSSI: - self.ui.le_type.setText("DSSI") - elif pluginType == PLUGIN_LV2: - self.ui.le_type.setText("LV2") - elif pluginType == PLUGIN_VST: - self.ui.le_type.setText("VST") - elif pluginType == PLUGIN_AU: - self.ui.le_type.setText("AU") - elif pluginType == PLUGIN_REWIRE: - self.ui.le_type.setText("ReWire") - elif pluginType == PLUGIN_FILE_CSD: - self.ui.le_type.setText("CSD") - elif pluginType == PLUGIN_FILE_GIG: - self.ui.le_type.setText("GIG") - elif pluginType == PLUGIN_FILE_SF2: - self.ui.le_type.setText("SF2") - elif pluginType == PLUGIN_FILE_SFZ: - self.ui.le_type.setText("SFZ") - else: - self.ui.le_type.setText(self.tr("Unknown")) + self.ui.le_type.setText(getPluginTypeAsString(self.fPluginInfo['type'])) if pluginName: self.ui.label_name.setEnabled(True) diff --git a/source/widgets/pixmapdial.py b/source/widgets/pixmapdial.py index 09fa74019..b09a07ffc 100644 --- a/source/widgets/pixmapdial.py +++ b/source/widgets/pixmapdial.py @@ -35,8 +35,9 @@ class PixmapDial(QDial): CUSTOM_PAINT_CARLA_VOL = 2 CUSTOM_PAINT_CARLA_L = 3 CUSTOM_PAINT_CARLA_R = 4 - CUSTOM_PAINT_ZITA = 5 - CUSTOM_PAINT_NO_GRADIENT = 6 + CUSTOM_PAINT_COLOR = 5 + CUSTOM_PAINT_ZITA = 6 + CUSTOM_PAINT_NO_GRADIENT = 7 # enum Orientation HORIZONTAL = 0 @@ -51,6 +52,8 @@ class PixmapDial(QDial): self.fIndex = index self.fPixmap = QPixmap(":/bitmaps/dial_01d.png") self.fPixmapNum = "01" + + self.fCustomColor = QColor(0, 0, 0) self.fCustomPaint = self.CUSTOM_PAINT_NULL self.fIsHovered = False @@ -89,10 +92,14 @@ class PixmapDial(QDial): def getSize(self): return self.fSize + def setCustomColor(self, color): + self.fCustomColor = color + #self.update() + def setCustomPaint(self, paint): self.fCustomPaint = paint self.fLabelPos.setY(self.fSize + self.fLabelHeight/2) - self.update() + #self.update() def setEnabled(self, enabled): if self.isEnabled() != enabled: @@ -121,7 +128,7 @@ class PixmapDial(QDial): self.fLabelGradient.setFinalStop(0, self.fSize + self.fLabelHeight + 5) self.fLabelGradientRect = QRectF(float(self.fSize)/8.0, float(self.fSize)/2.0, float(self.fSize*6)/8.0, self.fSize+self.fLabelHeight+5) - self.update() + #self.update() def setPixmap(self, pixmapId): self.fPixmapNum = "%02i" % pixmapId @@ -133,7 +140,7 @@ class PixmapDial(QDial): self.fOrientation = self.VERTICAL self.updateSizes() - self.update() + #self.update() def minimumSizeHint(self): return QSize(self.fSize, self.fSize) @@ -215,8 +222,8 @@ class PixmapDial(QDial): # Custom knobs (Dry/Wet and Volume) if self.fCustomPaint in (self.CUSTOM_PAINT_CARLA_WET, self.CUSTOM_PAINT_CARLA_VOL): # knob color - colorGreen = QColor(0x5D, 0xE7, 0x3D, 191 + self.fHoverStep*7) - colorBlue = QColor(0x3E, 0xB8, 0xBE, 191 + self.fHoverStep*7) + colorGreen = QColor(0x5D, 0xE7, 0x3D).lighter(100 + self.fHoverStep*6) + colorBlue = QColor(0x3E, 0xB8, 0xBE).lighter(100 + self.fHoverStep*6) # draw small circle ballRect = QRectF(8.0, 8.0, 15.0, 15.0) @@ -259,7 +266,7 @@ class PixmapDial(QDial): # Custom knobs (L and R) elif self.fCustomPaint in (self.CUSTOM_PAINT_CARLA_L, self.CUSTOM_PAINT_CARLA_R): # knob color - color = QColor(0xAD + self.fHoverStep*5, 0xD5 + self.fHoverStep*4, 0x4B + self.fHoverStep*5) + color = QColor(0xAD, 0xD5, 0x48).lighter(100 + self.fHoverStep*6) # draw small circle ballRect = QRectF(7.0, 8.0, 11.0, 12.0) @@ -287,6 +294,31 @@ class PixmapDial(QDial): painter.setPen(QPen(color, 2)) painter.drawArc(3.5, 4.5, 22.0, 22.0, startAngle, spanAngle) + # Custom knobs (Color) + elif self.fCustomPaint == self.CUSTOM_PAINT_COLOR: + # knob color + color = self.fCustomColor.lighter(100 + self.fHoverStep*6) + + # draw small circle + ballRect = QRectF(8.0, 8.0, 15.0, 15.0) + ballPath = QPainterPath() + ballPath.addEllipse(ballRect) + tmpValue = (0.375 + 0.75*value) + ballValue = tmpValue - floor(tmpValue) + ballPoint = ballPath.pointAtPercent(ballValue) + + # draw arc + startAngle = 216*16 + spanAngle = -252*16*value + + painter.setBrush(color) + painter.setPen(QPen(color, 0)) + painter.drawEllipse(QRectF(ballPoint.x(), ballPoint.y(), 2.2, 2.2)) + + painter.setBrush(color) + painter.setPen(QPen(color, 3)) + painter.drawArc(4.0, 4.0, 26.0, 26.0, startAngle, spanAngle) + # Custom knobs (Zita) elif self.fCustomPaint == self.CUSTOM_PAINT_ZITA: a = value * pi * 1.5 - 2.35