Audio plugin host https://kx.studio/carla
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

1861 lines
67KB

  1. #!/usr/bin/env python3
  2. # -*- coding: utf-8 -*-
  3. # Carla plugin/slot skin code
  4. # Copyright (C) 2013-2014 Filipe Coelho <falktx@falktx.com>
  5. #
  6. # This program is free software; you can redistribute it and/or
  7. # modify it under the terms of the GNU General Public License as
  8. # published by the Free Software Foundation; either version 2 of
  9. # the License, or any later version.
  10. #
  11. # This program is distributed in the hope that it will be useful,
  12. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. # GNU General Public License for more details.
  15. #
  16. # For a full copy of the GNU General Public License see the doc/GPL.txt file.
  17. # ------------------------------------------------------------------------------------------------------------
  18. # Imports (Config)
  19. from carla_config import *
  20. # ------------------------------------------------------------------------------------------------------------
  21. # Imports (Global)
  22. if config_UseQt5:
  23. from PyQt5.QtCore import Qt, QRectF
  24. from PyQt5.QtGui import QFont, QFontDatabase, QPen, QPixmap
  25. from PyQt5.QtWidgets import QFrame, QPushButton
  26. else:
  27. from PyQt4.QtCore import Qt, QRectF
  28. from PyQt4.QtGui import QFont, QFontDatabase, QFrame, QPen, QPixmap, QPushButton
  29. # ------------------------------------------------------------------------------------------------------------
  30. # Imports (Custom)
  31. import ui_carla_plugin_default
  32. import ui_carla_plugin_basic_fx
  33. import ui_carla_plugin_calf
  34. import ui_carla_plugin_sf2
  35. import ui_carla_plugin_zynfx
  36. from carla_widgets import *
  37. from digitalpeakmeter import DigitalPeakMeter
  38. from pixmapdial import PixmapDial
  39. # ------------------------------------------------------------------------------------------------------------
  40. # Try to "shortify" a parameter name
  41. def getParameterShortName(paramName):
  42. paramName = paramName.split("/",1)[0].split(" (",1)[0].split(" [",1)[0].strip()
  43. paramLow = paramName.lower()
  44. if paramLow.startswith("compressor "):
  45. paramName = paramName.replace("ompressor ", ".", 1)
  46. paramLow = paramName.lower()
  47. # Cut generic names
  48. if "attack" in paramLow:
  49. paramName = paramName.replace("ttack", "tk")
  50. elif "bandwidth" in paramLow:
  51. paramName = paramName.replace("andwidth", "w")
  52. elif "damping" in paramLow:
  53. paramName = paramName.replace("amping", "amp")
  54. elif "distortion" in paramLow:
  55. paramName = paramName.replace("istortion", "ist")
  56. elif "feedback" in paramLow:
  57. paramName = paramName.replace("eedback", "b")
  58. elif "frequency" in paramLow:
  59. paramName = paramName.replace("requency", "req")
  60. elif "makeup" in paramLow:
  61. paramName = paramName.replace("akeup", "kUp" if "Make" in paramName else "kup")
  62. elif "output" in paramLow:
  63. paramName = paramName.replace("utput", "ut")
  64. elif "random" in paramLow:
  65. paramName = paramName.replace("andom", "nd")
  66. elif "threshold" in paramLow:
  67. paramName = paramName.replace("hreshold", "hres")
  68. # Cut useless prefix
  69. elif paramLow.startswith("room "):
  70. paramName = paramName.split(" ",1)[1]
  71. # Cut useless suffix
  72. elif paramLow.endswith(" level"):
  73. paramName = paramName.rsplit(" ",1)[0]
  74. elif paramLow.endswith(" time"):
  75. paramName = paramName.rsplit(" ",1)[0]
  76. if len(paramName) > 7:
  77. paramName = paramName[:7]
  78. return paramName.strip()
  79. # ------------------------------------------------------------------------------------------------------------
  80. # Abstract plugin slot
  81. class AbstractPluginSlot(QFrame, PluginEditParentMeta):
  82. #class AbstractPluginSlot(QFrame, PluginEditParentMeta, metaclass=PyQtMetaClass):
  83. def __init__(self, parent, host, pluginId):
  84. QFrame.__init__(self, parent)
  85. self.host = host
  86. if False:
  87. # kdevelop likes this :)
  88. host = CarlaHostMeta()
  89. self.host = host
  90. # -------------------------------------------------------------
  91. # Get plugin info
  92. self.fPluginId = pluginId
  93. self.fPluginInfo = host.get_plugin_info(self.fPluginId)
  94. #if not gCarla.isLocal:
  95. #self.fPluginInfo['hints'] &= ~PLUGIN_HAS_CUSTOM_UI
  96. # -------------------------------------------------------------
  97. # Internal stuff
  98. self.fIsActive = bool(host.get_internal_parameter_value(self.fPluginId, PARAMETER_ACTIVE) >= 0.5)
  99. self.fIsSelected = False
  100. self.fLastGreenLedState = False
  101. self.fLastBlueLedState = False
  102. self.fParameterIconTimer = ICON_STATE_NULL
  103. self.fParameterList = [] # index, widget
  104. audioCountInfo = host.get_audio_port_count_info(self.fPluginId)
  105. self.fPeaksInputCount = int(audioCountInfo['ins'])
  106. self.fPeaksOutputCount = int(audioCountInfo['outs'])
  107. if self.fPeaksInputCount > 2:
  108. self.fPeaksInputCount = 2
  109. if self.fPeaksOutputCount > 2:
  110. self.fPeaksOutputCount = 2
  111. # used during testing
  112. self.fIdleTimerId = 0
  113. # -------------------------------------------------------------
  114. # Set-up GUI
  115. self.fEditDialog = PluginEdit(self, host, self.fPluginId)
  116. # -------------------------------------------------------------
  117. # Set-up common widgets (as none)
  118. self.b_enable = None
  119. self.b_gui = None
  120. self.b_edit = None
  121. self.b_remove = None
  122. self.cb_presets = None
  123. self.label_name = None
  124. self.label_type = None
  125. self.led_control = None
  126. self.led_midi = None
  127. self.led_audio_in = None
  128. self.led_audio_out = None
  129. self.peak_in = None
  130. self.peak_out = None
  131. # -------------------------------------------------------------
  132. # Set-up connections
  133. host.PluginRenamedCallback.connect(self.slot_handlePluginRenamedCallback)
  134. host.PluginUnavailableCallback.connect(self.slot_handlePluginUnavailableCallback)
  135. host.ParameterValueChangedCallback.connect(self.slot_handleParameterValueChangedCallback)
  136. host.ParameterDefaultChangedCallback.connect(self.slot_handleParameterDefaultChangedCallback)
  137. host.ParameterMidiChannelChangedCallback.connect(self.slot_handleParameterMidiChannelChangedCallback)
  138. host.ParameterMidiCcChangedCallback.connect(self.slot_handleParameterMidiCcChangedCallback)
  139. host.ProgramChangedCallback.connect(self.slot_handleProgramChangedCallback)
  140. host.MidiProgramChangedCallback.connect(self.slot_handleMidiProgramChangedCallback)
  141. host.OptionChangedCallback.connect(self.slot_handleOptionChangedCallback)
  142. host.UiStateChangedCallback.connect(self.slot_handleUiStateChangedCallback)
  143. # -----------------------------------------------------------------
  144. @pyqtSlot(int, str)
  145. def slot_handlePluginRenamedCallback(self, pluginId, newName):
  146. if self.fPluginId == pluginId:
  147. self.setName(newName)
  148. @pyqtSlot(int, str)
  149. def slot_handlePluginUnavailableCallback(self, pluginId, errorMsg):
  150. if self.fPluginId == pluginId:
  151. pass
  152. @pyqtSlot(int, int, float)
  153. def slot_handleParameterValueChangedCallback(self, pluginId, index, value):
  154. if self.fPluginId == pluginId:
  155. self.setParameterValue(index, value, True)
  156. @pyqtSlot(int, int, float)
  157. def slot_handleParameterDefaultChangedCallback(self, pluginId, index, value):
  158. if self.fPluginId == pluginId:
  159. self.setParameterDefault(index, value)
  160. @pyqtSlot(int, int, int)
  161. def slot_handleParameterMidiCcChangedCallback(self, pluginId, index, cc):
  162. if self.fPluginId == pluginId:
  163. self.setParameterMidiControl(index, cc)
  164. @pyqtSlot(int, int, int)
  165. def slot_handleParameterMidiChannelChangedCallback(self, pluginId, index, channel):
  166. if self.fPluginId == pluginId:
  167. self.setParameterMidiChannel(index, channel)
  168. @pyqtSlot(int, int)
  169. def slot_handleProgramChangedCallback(self, pluginId, index):
  170. if self.fPluginId == pluginId:
  171. self.setProgram(index, True)
  172. @pyqtSlot(int, int)
  173. def slot_handleMidiProgramChangedCallback(self, pluginId, index):
  174. if self.fPluginId == pluginId:
  175. self.setMidiProgram(index, True)
  176. @pyqtSlot(int, int, bool)
  177. def slot_handleOptionChangedCallback(self, pluginId, option, yesNo):
  178. if self.fPluginId == pluginId:
  179. self.setOption(option, yesNo)
  180. @pyqtSlot(int, int)
  181. def slot_handleUiStateChangedCallback(self, pluginId, state):
  182. if self.fPluginId == pluginId:
  183. self.customUiStateChanged(state)
  184. #------------------------------------------------------------------
  185. def ready(self):
  186. if self.b_enable is not None:
  187. self.b_enable.setChecked(self.fIsActive)
  188. self.b_enable.clicked.connect(self.slot_enableClicked)
  189. if self.b_gui is not None:
  190. self.b_gui.clicked.connect(self.slot_showCustomUi)
  191. self.b_gui.setEnabled(bool(self.fPluginInfo['hints'] & PLUGIN_HAS_CUSTOM_UI))
  192. if self.b_edit is None:
  193. # Edit dialog *must* be available
  194. self.b_edit = QPushButton(self)
  195. self.b_edit.setCheckable(True)
  196. self.b_edit.hide()
  197. self.b_edit.clicked.connect(self.slot_showEditDialog)
  198. if self.b_remove is not None:
  199. self.b_remove.clicked.connect(self.slot_removePlugin)
  200. if self.label_name is not None:
  201. self.label_name.setText(self.fPluginInfo['name'])
  202. if self.label_type is not None:
  203. self.label_type.setText(getPluginTypeAsString(self.fPluginInfo['type']))
  204. if self.led_control is not None:
  205. self.led_control.setColor(self.led_control.YELLOW)
  206. self.led_control.setEnabled(False)
  207. if self.led_midi is not None:
  208. self.led_midi.setColor(self.led_midi.RED)
  209. self.led_midi.setEnabled(False)
  210. if self.led_audio_in is not None:
  211. self.led_audio_in.setColor(self.led_audio_in.GREEN)
  212. self.led_audio_in.setEnabled(False)
  213. if self.led_audio_out is not None:
  214. self.led_audio_out.setColor(self.led_audio_out.BLUE)
  215. self.led_audio_out.setEnabled(False)
  216. if self.peak_in is not None:
  217. self.peak_in.setChannelCount(self.fPeaksInputCount)
  218. self.peak_in.setMeterColor(DigitalPeakMeter.COLOR_GREEN)
  219. self.peak_in.setMeterOrientation(DigitalPeakMeter.HORIZONTAL)
  220. if self.fPeaksInputCount == 0 and not isinstance(self, PluginSlot_Default):
  221. self.peak_in.hide()
  222. if self.peak_out is not None:
  223. self.peak_out.setChannelCount(self.fPeaksOutputCount)
  224. self.peak_out.setMeterColor(DigitalPeakMeter.COLOR_BLUE)
  225. self.peak_out.setMeterOrientation(DigitalPeakMeter.HORIZONTAL)
  226. if self.fPeaksOutputCount == 0 and not isinstance(self, PluginSlot_Default):
  227. self.peak_out.hide()
  228. for paramIndex, paramWidget in self.fParameterList:
  229. paramWidget.setContextMenuPolicy(Qt.CustomContextMenu)
  230. paramWidget.customContextMenuRequested.connect(self.slot_knobCustomMenu)
  231. paramWidget.realValueChanged.connect(self.slot_parameterValueChanged)
  232. paramWidget.setValue(self.host.get_internal_parameter_value(self.fPluginId, paramIndex))
  233. self.setWindowTitle(self.fPluginInfo['name'])
  234. #------------------------------------------------------------------
  235. def getFixedHeight(self):
  236. return 32
  237. def getHints(self):
  238. return self.fPluginInfo['hints']
  239. def getPluginId(self):
  240. return self.fPluginId
  241. #------------------------------------------------------------------
  242. def setPluginId(self, idx):
  243. self.fPluginId = idx
  244. self.fEditDialog.setPluginId(idx)
  245. def setName(self, name):
  246. self.fEditDialog.setName(name)
  247. if self.label_name is not None:
  248. self.label_name.setText(name)
  249. def setSelected(self, yesNo):
  250. if self.fIsSelected == yesNo:
  251. return
  252. self.fIsSelected = yesNo
  253. self.update()
  254. #------------------------------------------------------------------
  255. def setActive(self, active, sendCallback=False, sendHost=True):
  256. self.fIsActive = active
  257. if sendCallback:
  258. self.fParameterIconTimer = ICON_STATE_ON
  259. self.activeChanged(active)
  260. if sendHost:
  261. self.host.set_active(self.fPluginId, active)
  262. if active:
  263. self.fEditDialog.clearNotes()
  264. self.midiActivityChanged(False)
  265. # called from rack, checks if param is possible first
  266. def setInternalParameter(self, parameterId, value):
  267. if parameterId <= PARAMETER_MAX or parameterId >= PARAMETER_NULL:
  268. return
  269. elif parameterId == PARAMETER_ACTIVE:
  270. return self.setActive(bool(value), True, True)
  271. elif parameterId == PARAMETER_DRYWET:
  272. if (self.fPluginInfo['hints'] & PLUGIN_CAN_DRYWET) == 0: return
  273. self.host.set_drywet(self.fPluginId, value)
  274. elif parameterId == PARAMETER_VOLUME:
  275. if (self.fPluginInfo['hints'] & PLUGIN_CAN_VOLUME) == 0: return
  276. self.host.set_volume(self.fPluginId, value)
  277. elif parameterId == PARAMETER_BALANCE_LEFT:
  278. if (self.fPluginInfo['hints'] & PLUGIN_CAN_BALANCE) == 0: return
  279. self.host.set_balance_left(self.fPluginId, value)
  280. elif parameterId == PARAMETER_BALANCE_RIGHT:
  281. if (self.fPluginInfo['hints'] & PLUGIN_CAN_BALANCE) == 0: return
  282. self.host.set_balance_right(self.fPluginId, value)
  283. elif parameterId == PARAMETER_PANNING:
  284. if (self.fPluginInfo['hints'] & PLUGIN_CAN_PANNING) == 0: return
  285. self.host.set_panning(self.fPluginId, value)
  286. elif parameterId == PARAMETER_CTRL_CHANNEL:
  287. self.host.set_ctrl_channel(self.fPluginId, value)
  288. self.fEditDialog.setParameterValue(parameterId, value)
  289. #------------------------------------------------------------------
  290. def setParameterValue(self, parameterId, value, sendCallback):
  291. if parameterId == PARAMETER_ACTIVE:
  292. return self.setActive(bool(value), True, False)
  293. self.fEditDialog.setParameterValue(parameterId, value)
  294. if sendCallback:
  295. self.fParameterIconTimer = ICON_STATE_ON
  296. self.editDialogParameterValueChanged(self.fPluginId, parameterId, value)
  297. def setParameterDefault(self, parameterId, value):
  298. self.fEditDialog.setParameterDefault(parameterId, value)
  299. def setParameterMidiControl(self, parameterId, control):
  300. self.fEditDialog.setParameterMidiControl(parameterId, control)
  301. def setParameterMidiChannel(self, parameterId, channel):
  302. self.fEditDialog.setParameterMidiChannel(parameterId, channel)
  303. #------------------------------------------------------------------
  304. def setProgram(self, index, sendCallback):
  305. self.fEditDialog.setProgram(index)
  306. if sendCallback:
  307. self.fParameterIconTimer = ICON_STATE_ON
  308. self.editDialogProgramChanged(self.fPluginId, index)
  309. self.updateParameterValues()
  310. def setMidiProgram(self, index, sendCallback):
  311. self.fEditDialog.setMidiProgram(index)
  312. if sendCallback:
  313. self.fParameterIconTimer = ICON_STATE_ON
  314. self.editDialogMidiProgramChanged(self.fPluginId, index)
  315. self.updateParameterValues()
  316. #------------------------------------------------------------------
  317. def setOption(self, option, yesNo):
  318. self.fEditDialog.setOption(option, yesNo)
  319. #------------------------------------------------------------------
  320. def activeChanged(self, onOff):
  321. self.fIsActive = onOff
  322. if self.b_enable is None:
  323. return
  324. self.b_enable.blockSignals(True)
  325. self.b_enable.setChecked(onOff)
  326. self.b_enable.blockSignals(False)
  327. def customUiStateChanged(self, state):
  328. if self.b_gui is None:
  329. return
  330. self.b_gui.blockSignals(True)
  331. if state == 0:
  332. self.b_gui.setChecked(False)
  333. self.b_gui.setEnabled(True)
  334. elif state == 1:
  335. self.b_gui.setChecked(True)
  336. self.b_gui.setEnabled(True)
  337. elif state == -1:
  338. self.b_gui.setChecked(False)
  339. self.b_gui.setEnabled(False)
  340. self.b_gui.blockSignals(False)
  341. def parameterActivityChanged(self, onOff):
  342. if self.led_control is None:
  343. return
  344. self.led_control.setChecked(onOff)
  345. def midiActivityChanged(self, onOff):
  346. if self.led_midi is None:
  347. return
  348. self.led_midi.setChecked(onOff)
  349. def optionChanged(self, option, yesNo):
  350. pass
  351. # -----------------------------------------------------------------
  352. # PluginEdit callbacks
  353. def editDialogVisibilityChanged(self, pluginId, visible):
  354. if self.b_edit is None:
  355. return
  356. self.b_edit.blockSignals(True)
  357. self.b_edit.setChecked(visible)
  358. self.b_edit.blockSignals(False)
  359. def editDialogPluginHintsChanged(self, pluginId, hints):
  360. self.fPluginInfo['hints'] = hints
  361. for paramIndex, paramWidget in self.fParameterList:
  362. if paramIndex == PARAMETER_DRYWET:
  363. paramWidget.setVisible(hints & PLUGIN_CAN_DRYWET)
  364. elif paramIndex == PARAMETER_VOLUME:
  365. paramWidget.setVisible(hints & PLUGIN_CAN_VOLUME)
  366. if self.b_gui is not None:
  367. self.b_gui.setEnabled(bool(hints & PLUGIN_HAS_CUSTOM_UI))
  368. def editDialogParameterValueChanged(self, pluginId, parameterId, value):
  369. for paramIndex, paramWidget in self.fParameterList:
  370. if paramIndex != parameterId:
  371. continue
  372. paramWidget.blockSignals(True)
  373. paramWidget.setValue(value)
  374. paramWidget.blockSignals(False)
  375. break
  376. def editDialogProgramChanged(self, pluginId, index):
  377. if self.cb_presets is None:
  378. return
  379. self.cb_presets.blockSignals(True)
  380. self.cb_presets.setCurrentIndex(index)
  381. self.cb_presets.blockSignals(False)
  382. # FIXME
  383. self.updateParameterValues()
  384. def editDialogMidiProgramChanged(self, pluginId, index):
  385. if self.cb_presets is None:
  386. return
  387. self.cb_presets.blockSignals(True)
  388. self.cb_presets.setCurrentIndex(index)
  389. self.cb_presets.blockSignals(False)
  390. # FIXME
  391. self.updateParameterValues()
  392. def editDialogNotePressed(self, pluginId, note):
  393. pass
  394. def editDialogNoteReleased(self, pluginId, note):
  395. pass
  396. def editDialogMidiActivityChanged(self, pluginId, onOff):
  397. self.midiActivityChanged(onOff)
  398. #------------------------------------------------------------------
  399. def idleFast(self):
  400. # Input peaks
  401. if self.fPeaksInputCount > 0:
  402. if self.fPeaksInputCount > 1:
  403. peak1 = self.host.get_input_peak_value(self.fPluginId, True)
  404. peak2 = self.host.get_input_peak_value(self.fPluginId, False)
  405. ledState = bool(peak1 != 0.0 or peak2 != 0.0)
  406. if self.peak_in is not None:
  407. self.peak_in.displayMeter(1, peak1)
  408. self.peak_in.displayMeter(2, peak2)
  409. else:
  410. peak = self.host.get_input_peak_value(self.fPluginId, True)
  411. ledState = bool(peak != 0.0)
  412. if self.peak_in is not None:
  413. self.peak_in.displayMeter(1, peak)
  414. if self.fLastGreenLedState != ledState and self.led_audio_in is not None:
  415. self.fLastGreenLedState = ledState
  416. self.led_audio_in.setChecked(ledState)
  417. # Output peaks
  418. if self.fPeaksOutputCount > 0:
  419. if self.fPeaksOutputCount > 1:
  420. peak1 = self.host.get_output_peak_value(self.fPluginId, True)
  421. peak2 = self.host.get_output_peak_value(self.fPluginId, False)
  422. ledState = bool(peak1 != 0.0 or peak2 != 0.0)
  423. if self.peak_out is not None:
  424. self.peak_out.displayMeter(1, peak1)
  425. self.peak_out.displayMeter(2, peak2)
  426. else:
  427. peak = self.host.get_output_peak_value(self.fPluginId, True)
  428. ledState = bool(peak != 0.0)
  429. if self.peak_out is not None:
  430. self.peak_out.displayMeter(1, peak)
  431. if self.fLastBlueLedState != ledState and self.led_audio_out is not None:
  432. self.fLastBlueLedState = ledState
  433. self.led_audio_out.setChecked(ledState)
  434. def idleSlow(self):
  435. if self.fParameterIconTimer == ICON_STATE_ON:
  436. self.parameterActivityChanged(True)
  437. self.fParameterIconTimer = ICON_STATE_WAIT
  438. elif self.fParameterIconTimer == ICON_STATE_WAIT:
  439. self.fParameterIconTimer = ICON_STATE_OFF
  440. elif self.fParameterIconTimer == ICON_STATE_OFF:
  441. self.parameterActivityChanged(False)
  442. self.fParameterIconTimer = ICON_STATE_NULL
  443. self.fEditDialog.idleSlow()
  444. #------------------------------------------------------------------
  445. def drawOutline(self):
  446. painter = QPainter(self)
  447. if self.fIsSelected:
  448. painter.setPen(QPen(Qt.cyan, 4))
  449. painter.setBrush(Qt.transparent)
  450. painter.drawRect(0, 0, self.width(), self.height())
  451. else:
  452. painter.setPen(QPen(Qt.black, 1))
  453. painter.setBrush(Qt.black)
  454. painter.drawLine(0, self.height()-1, self.width(), self.height()-1)
  455. def showDefaultCustomMenu(self, isEnabled, bEdit = None, bGui = None):
  456. menu = QMenu(self)
  457. actActive = menu.addAction(self.tr("Disable") if isEnabled else self.tr("Enable"))
  458. menu.addSeparator()
  459. actReset = menu.addAction(self.tr("Reset parameters"))
  460. actRandom = menu.addAction(self.tr("Randomize parameters"))
  461. menu.addSeparator()
  462. if bEdit is not None:
  463. actEdit = menu.addAction(self.tr("Edit"))
  464. actEdit.setCheckable(True)
  465. actEdit.setChecked(bEdit.isChecked())
  466. else:
  467. actEdit = None
  468. if bGui is not None:
  469. actGui = menu.addAction(self.tr("Show Custom UI"))
  470. actGui.setCheckable(True)
  471. actGui.setChecked(bGui.isChecked())
  472. actGui.setEnabled(bGui.isEnabled())
  473. else:
  474. actGui = None
  475. menu.addSeparator()
  476. actClone = menu.addAction(self.tr("Clone"))
  477. actReplace = menu.addAction(self.tr("Replace..."))
  478. actRename = menu.addAction(self.tr("Rename..."))
  479. actRemove = menu.addAction(self.tr("Remove"))
  480. if self.fIdleTimerId != 0:
  481. actRemove.setVisible(False)
  482. actSel = menu.exec_(QCursor.pos())
  483. if not actSel:
  484. return
  485. if actSel == actActive:
  486. self.setActive(not isEnabled, True, True)
  487. elif actSel == actReset:
  488. self.host.reset_parameters(self.fPluginId)
  489. elif actSel == actRandom:
  490. self.host.randomize_parameters(self.fPluginId)
  491. elif actSel == actGui:
  492. bGui.click()
  493. elif actSel == actEdit:
  494. bEdit.click()
  495. elif actSel == actClone:
  496. if not self.host.clone_plugin(self.fPluginId):
  497. CustomMessageBox(self, QMessageBox.Warning, self.tr("Error"), self.tr("Operation failed"),
  498. self.host.get_last_error(), QMessageBox.Ok, QMessageBox.Ok)
  499. elif actSel == actRename:
  500. oldName = self.fPluginInfo['name']
  501. newNameTry = QInputDialog.getText(self, self.tr("Rename Plugin"), self.tr("New plugin name:"), QLineEdit.Normal, oldName)
  502. if not (newNameTry[1] and newNameTry[0] and oldName != newNameTry[0]):
  503. return
  504. newName = newNameTry[0]
  505. if self.host.rename_plugin(self.fPluginId, newName):
  506. self.setName(newName)
  507. else:
  508. CustomMessageBox(self, QMessageBox.Warning, self.tr("Error"), self.tr("Operation failed"),
  509. self.host.get_last_error(), QMessageBox.Ok, QMessageBox.Ok)
  510. elif actSel == actReplace:
  511. gCarla.gui.slot_pluginAdd(self.fPluginId)
  512. elif actSel == actRemove:
  513. if not self.host.remove_plugin(self.fPluginId):
  514. CustomMessageBox(self, QMessageBox.Warning, self.tr("Error"), self.tr("Operation failed"),
  515. self.host.get_last_error(), QMessageBox.Ok, QMessageBox.Ok)
  516. def updateParameterValues(self):
  517. for paramIndex, paramWidget in self.fParameterList:
  518. if paramIndex < 0:
  519. continue
  520. paramWidget.blockSignals(True)
  521. paramWidget.setValue(self.host.get_current_parameter_value(self.fPluginId, paramIndex))
  522. paramWidget.blockSignals(False)
  523. #------------------------------------------------------------------
  524. @pyqtSlot(bool)
  525. def slot_enableClicked(self, yesNo):
  526. self.setActive(yesNo, False, True)
  527. @pyqtSlot()
  528. def slot_showDefaultCustomMenu(self):
  529. self.showDefaultCustomMenu(self.fIsActive, self.b_edit, self.b_gui)
  530. @pyqtSlot()
  531. def slot_knobCustomMenu(self):
  532. sender = self.sender()
  533. index = sender.fIndex
  534. minimum = sender.fMinimum
  535. maximum = sender.fMaximum
  536. current = sender.fRealValue
  537. label = sender.fLabel
  538. if index in (PARAMETER_DRYWET, PARAMETER_VOLUME):
  539. default = 1.0
  540. resetText = self.tr("Reset (%i%%)" % int(default*100.0))
  541. minimText = self.tr("Set to Minimum (%i%%)" % int(minimum*100.0))
  542. maximText = self.tr("Set to Maximum (%i%%)" % int(maximum*100.0))
  543. else:
  544. default = self.host.get_default_parameter_value(self.fPluginId, index)
  545. resetText = self.tr("Reset (%f)" % default)
  546. minimText = self.tr("Set to Minimum (%f)" % minimum)
  547. maximText = self.tr("Set to Maximum (%f)" % maximum)
  548. menu = QMenu(self)
  549. actReset = menu.addAction(resetText)
  550. menu.addSeparator()
  551. actMinimum = menu.addAction(minimText)
  552. actMaximum = menu.addAction(maximText)
  553. menu.addSeparator()
  554. actSet = menu.addAction(self.tr("Set value..."))
  555. actSelected = menu.exec_(QCursor.pos())
  556. if actSelected == actSet:
  557. valueTry = QInputDialog.getDouble(self, self.tr("Set value"), label, current, minimum, maximum, 3) # FIXME - 3 decimals
  558. if valueTry[1]:
  559. value = valueTry[0] * 10
  560. else:
  561. return
  562. elif actSelected == actMinimum:
  563. value = minimum
  564. elif actSelected == actMaximum:
  565. value = maximum
  566. elif actSelected == actReset:
  567. value = default
  568. else:
  569. return
  570. self.sender().setValue(value)
  571. #------------------------------------------------------------------
  572. @pyqtSlot(bool)
  573. def slot_showCustomUi(self, show):
  574. self.host.show_custom_ui(self.fPluginId, show)
  575. @pyqtSlot(bool)
  576. def slot_showEditDialog(self, show):
  577. self.fEditDialog.setVisible(show)
  578. @pyqtSlot()
  579. def slot_removePlugin(self):
  580. if not self.host.remove_plugin(self.fPluginId):
  581. CustomMessageBox(self, QMessageBox.Warning, self.tr("Error"), self.tr("Operation failed"),
  582. self.host.get_last_error(), QMessageBox.Ok, QMessageBox.Ok)
  583. #------------------------------------------------------------------
  584. @pyqtSlot(int)
  585. def slot_parameterValueChanged(self, value):
  586. index = self.sender().getIndex()
  587. if index < 0:
  588. self.setInternalParameter(index, value)
  589. else:
  590. self.host.set_parameter_value(self.fPluginId, index, value)
  591. self.setParameterValue(index, value, False)
  592. @pyqtSlot(int)
  593. def slot_programChanged(self, index):
  594. self.host.set_program(self.fPluginId, index)
  595. self.setProgram(index, False)
  596. @pyqtSlot(int)
  597. def slot_midiProgramChanged(self, index):
  598. self.host.set_midi_program(self.fPluginId, index)
  599. self.setMidiProgram(index, False)
  600. #------------------------------------------------------------------
  601. def testTimer(self):
  602. self.fIdleTimerId = self.startTimer(25)
  603. #------------------------------------------------------------------
  604. def closeEvent(self, event):
  605. if self.fIdleTimerId != 0:
  606. self.killTimer(self.fIdleTimerId)
  607. self.fIdleTimerId = 0
  608. self.host.engine_close()
  609. QFrame.closeEvent(self, event)
  610. def timerEvent(self, event):
  611. if event.timerId() == self.fIdleTimerId:
  612. self.host.engine_idle()
  613. self.idleFast()
  614. self.idleSlow()
  615. QFrame.timerEvent(self, event)
  616. def paintEvent(self, event):
  617. self.drawOutline()
  618. QFrame.paintEvent(self, event)
  619. # ------------------------------------------------------------------------------------------------------------
  620. class PluginSlot_Default(AbstractPluginSlot):
  621. def __init__(self, parent, host, pluginId):
  622. AbstractPluginSlot.__init__(self, parent, host, pluginId)
  623. self.ui = ui_carla_plugin_default.Ui_PluginWidget()
  624. self.ui.setupUi(self)
  625. # -------------------------------------------------------------
  626. # Internal stuff
  627. self.fColorTop = QColor(60, 60, 60)
  628. self.fColorBottom = QColor(47, 47, 47)
  629. self.fColorSeprtr = QColor(70, 70, 70)
  630. # -------------------------------------------------------------
  631. # Set-up GUI
  632. self.setStyleSheet("""
  633. QLabel#label_name {
  634. color: #BBB;
  635. }
  636. """)
  637. self.ui.b_enable.setPixmaps(":/bitmaps/button_off.png", ":/bitmaps/button_on.png", ":/bitmaps/button_off.png")
  638. self.ui.b_edit.setPixmaps(":/bitmaps/button_edit.png", ":/bitmaps/button_edit_down.png", ":/bitmaps/button_edit_hover.png")
  639. if self.fPluginInfo['iconName'] == "distrho":
  640. self.ui.b_gui.setPixmaps(":/bitmaps/button_distrho.png", ":/bitmaps/button_distrho_down.png", ":/bitmaps/button_distrho_hover.png")
  641. elif self.fPluginInfo['iconName'] == "file":
  642. self.ui.b_gui.setPixmaps(":/bitmaps/button_file.png", ":/bitmaps/button_file_down.png", ":/bitmaps/button_file_hover.png")
  643. else:
  644. self.ui.b_gui.setPixmaps(":/bitmaps/button_gui.png", ":/bitmaps/button_gui_down.png", ":/bitmaps/button_gui_hover.png")
  645. # -------------------------------------------------------------
  646. self.b_enable = self.ui.b_enable
  647. self.b_gui = self.ui.b_gui
  648. self.b_edit = self.ui.b_edit
  649. self.label_name = self.ui.label_name
  650. self.led_control = self.ui.led_control
  651. self.led_midi = self.ui.led_midi
  652. self.led_audio_in = self.ui.led_audio_in
  653. self.led_audio_out = self.ui.led_audio_out
  654. self.peak_in = self.ui.peak_in
  655. self.peak_out = self.ui.peak_out
  656. self.ready()
  657. self.customContextMenuRequested.connect(self.slot_showDefaultCustomMenu)
  658. #------------------------------------------------------------------
  659. def getFixedHeight(self):
  660. return 36
  661. #------------------------------------------------------------------
  662. def paintEvent(self, event):
  663. painter = QPainter(self)
  664. painter.save()
  665. areaX = self.ui.area_right.x()+7
  666. width = self.width()
  667. height = self.height()
  668. painter.setPen(QPen(QColor(17, 17, 17), 1))
  669. painter.setBrush(QColor(17, 17, 17))
  670. painter.drawRect(0, 0, width, height)
  671. painter.setPen(self.fColorSeprtr.lighter(110))
  672. painter.setBrush(self.fColorBottom)
  673. painter.setRenderHint(QPainter.Antialiasing, True)
  674. # name -> leds arc
  675. path = QPainterPath()
  676. path.moveTo(areaX-20, height-4)
  677. path.cubicTo(areaX, height-5, areaX-20, 4.75, areaX, 4.75)
  678. path.lineTo(areaX, height-5)
  679. painter.drawPath(path)
  680. painter.setPen(self.fColorSeprtr)
  681. painter.setRenderHint(QPainter.Antialiasing, False)
  682. # separator lines
  683. painter.drawLine(0, height-5, areaX-20, height-5)
  684. painter.drawLine(areaX, 4, width, 4)
  685. painter.setPen(self.fColorBottom)
  686. painter.setBrush(self.fColorBottom)
  687. # top, bottom and left lines
  688. painter.drawLine(0, 0, width, 0)
  689. painter.drawRect(0, height-4, areaX, 4)
  690. painter.drawRoundedRect(areaX-20, height-5, areaX, 5, 22, 22)
  691. painter.drawLine(0, 0, 0, height)
  692. # fill the rest
  693. painter.drawRect(areaX-1, 5, width, height)
  694. # bottom 1px line
  695. painter.setPen(self.fColorSeprtr)
  696. painter.drawLine(0, height-1, width, height-1)
  697. painter.restore()
  698. AbstractPluginSlot.paintEvent(self, event)
  699. # ------------------------------------------------------------------------------------------------------------
  700. class PluginSlot_BasicFX(AbstractPluginSlot):
  701. def __init__(self, parent, host, pluginId):
  702. AbstractPluginSlot.__init__(self, parent, host, pluginId)
  703. self.ui = ui_carla_plugin_basic_fx.Ui_PluginWidget()
  704. self.ui.setupUi(self)
  705. # -------------------------------------------------------------
  706. # Set-up GUI
  707. labelFont = self.ui.label_name.font()
  708. labelFont.setBold(True)
  709. labelFont.setPointSize(9)
  710. self.ui.label_name.setFont(labelFont)
  711. r = 40
  712. g = 40
  713. b = 40
  714. if self.fPluginInfo['category'] == PLUGIN_CATEGORY_MODULATOR:
  715. r += 10
  716. elif self.fPluginInfo['category'] == PLUGIN_CATEGORY_EQ:
  717. g += 10
  718. elif self.fPluginInfo['category'] == PLUGIN_CATEGORY_FILTER:
  719. b += 10
  720. elif self.fPluginInfo['category'] == PLUGIN_CATEGORY_DELAY:
  721. r += 15
  722. b -= 15
  723. elif self.fPluginInfo['category'] == PLUGIN_CATEGORY_DISTORTION:
  724. g += 10
  725. b += 10
  726. elif self.fPluginInfo['category'] == PLUGIN_CATEGORY_DYNAMICS:
  727. r += 10
  728. b += 10
  729. elif self.fPluginInfo['category'] == PLUGIN_CATEGORY_UTILITY:
  730. r += 10
  731. g += 10
  732. bg = "noise1"
  733. if self.fPluginInfo['maker'] in ("falkTX, Michael Gruhn", "DISTRHO") and "3bandeq" in self.fPluginInfo['label'].lower():
  734. bg = "3bandeq"
  735. self.setStyleSheet("""
  736. PluginSlot_BasicFX#PluginWidget {
  737. background-color: rgb(%i, %i, %i);
  738. background-image: url(:/bitmaps/background_%s.png);
  739. background-repeat: repeat-xy;
  740. }
  741. QLabel#label_name {
  742. color: #BBB;
  743. }
  744. """ % (r, g, b, bg))
  745. self.ui.b_enable.setPixmaps(":/bitmaps/button_off.png", ":/bitmaps/button_on.png", ":/bitmaps/button_off.png")
  746. self.ui.b_edit.setPixmaps(":/bitmaps/button_edit.png", ":/bitmaps/button_edit_down.png", ":/bitmaps/button_edit_hover.png")
  747. if self.fPluginInfo['iconName'] == "distrho":
  748. self.ui.b_gui.setPixmaps(":/bitmaps/button_distrho.png", ":/bitmaps/button_distrho_down.png", ":/bitmaps/button_distrho_hover.png")
  749. elif self.fPluginInfo['iconName'] == "file":
  750. self.ui.b_gui.setPixmaps(":/bitmaps/button_file.png", ":/bitmaps/button_file_down.png", ":/bitmaps/button_file_hover.png")
  751. else:
  752. self.ui.b_gui.setPixmaps(":/bitmaps/button_gui.png", ":/bitmaps/button_gui_down.png", ":/bitmaps/button_gui_hover.png")
  753. # -------------------------------------------------------------
  754. # Set-up parameters
  755. parameterCount = self.host.get_parameter_count(self.fPluginId)
  756. index = 0
  757. for i in range(parameterCount):
  758. if index >= 8:
  759. break
  760. paramInfo = self.host.get_parameter_info(self.fPluginId, i)
  761. paramData = self.host.get_parameter_data(self.fPluginId, i)
  762. paramRanges = self.host.get_parameter_ranges(self.fPluginId, i)
  763. if paramData['type'] != PARAMETER_INPUT:
  764. continue
  765. if paramData['hints'] & PARAMETER_IS_BOOLEAN:
  766. continue
  767. if (paramData['hints'] & PARAMETER_IS_ENABLED) == 0:
  768. continue
  769. paramName = getParameterShortName(paramInfo['name'])
  770. #if self.fPluginInfo['category'] == PLUGIN_CATEGORY_FILTER:
  771. #_r = 55 + float(i)/8*200
  772. #_g = 255 - float(i)/8*200
  773. #_b = 127 - r*2
  774. #elif self.fPluginInfo['category'] == PLUGIN_CATEGORY_DELAY:
  775. #_r = 127
  776. #_g = 55 + float(i)/8*200
  777. #_b = 255 - float(i)/8*200
  778. #elif r < b < g:
  779. #_r = 55 + float(i)/8*200
  780. #_g = 127
  781. #_b = 255 - float(i)/8*200
  782. #else:
  783. _r = 255 - float(index)/8*200
  784. _g = 55 + float(index)/8*200
  785. _b = (r-40)*4
  786. #if _r < 140: _r = 140
  787. #if _g < 140: _g = 140
  788. #if _b < 140: _b = 140
  789. widget = PixmapDial(self, i)
  790. widget.setPixmap(3)
  791. widget.setLabel(paramName)
  792. widget.setCustomPaintColor(QColor(_r, _g, _b))
  793. widget.setCustomPaintMode(PixmapDial.CUSTOM_PAINT_MODE_COLOR)
  794. widget.forceWhiteLabelGradientText()
  795. widget.setMinimum(paramRanges['min'])
  796. widget.setMaximum(paramRanges['max'])
  797. if (paramData['hints'] & PARAMETER_IS_ENABLED) == 0:
  798. widget.setEnabled(False)
  799. self.ui.w_knobs.layout().insertWidget(index, widget)
  800. index += 1
  801. self.fParameterList.append([i, widget])
  802. self.ui.dial_drywet.setIndex(PARAMETER_DRYWET)
  803. self.ui.dial_drywet.setPixmap(3)
  804. self.ui.dial_drywet.setLabel("Dry/Wet")
  805. self.ui.dial_drywet.setCustomPaintMode(PixmapDial.CUSTOM_PAINT_MODE_CARLA_WET)
  806. self.ui.dial_drywet.setMinimum(0.0)
  807. self.ui.dial_drywet.setMaximum(1.0)
  808. self.ui.dial_drywet.forceWhiteLabelGradientText()
  809. self.ui.dial_drywet.setVisible(self.fPluginInfo['hints'] & PLUGIN_CAN_DRYWET)
  810. self.ui.dial_vol.setIndex(PARAMETER_VOLUME)
  811. self.ui.dial_vol.setPixmap(3)
  812. self.ui.dial_vol.setLabel("Volume")
  813. self.ui.dial_vol.setCustomPaintMode(PixmapDial.CUSTOM_PAINT_MODE_CARLA_VOL)
  814. self.ui.dial_vol.setMinimum(0.0)
  815. self.ui.dial_vol.setMaximum(1.27)
  816. self.ui.dial_vol.forceWhiteLabelGradientText()
  817. self.ui.dial_vol.setVisible(self.fPluginInfo['hints'] & PLUGIN_CAN_VOLUME)
  818. self.fParameterList.append([PARAMETER_DRYWET, self.ui.dial_drywet])
  819. self.fParameterList.append([PARAMETER_VOLUME, self.ui.dial_vol])
  820. # -------------------------------------------------------------
  821. self.b_enable = self.ui.b_enable
  822. self.b_gui = self.ui.b_gui
  823. self.b_edit = self.ui.b_edit
  824. self.label_name = self.ui.label_name
  825. self.led_control = self.ui.led_control
  826. self.led_midi = self.ui.led_midi
  827. self.led_audio_in = self.ui.led_audio_in
  828. self.led_audio_out = self.ui.led_audio_out
  829. self.peak_in = self.ui.peak_in
  830. self.peak_out = self.ui.peak_out
  831. self.ready()
  832. self.customContextMenuRequested.connect(self.slot_showDefaultCustomMenu)
  833. #------------------------------------------------------------------
  834. def getFixedHeight(self):
  835. return 79
  836. #------------------------------------------------------------------
  837. def paintEvent(self, event):
  838. painter = QPainter(self)
  839. painter.setBrush(Qt.transparent)
  840. painter.setPen(QPen(QColor(42, 42, 42), 1))
  841. painter.drawRect(0, 1, self.width()-1, 79-3)
  842. painter.setPen(QPen(QColor(60, 60, 60), 1))
  843. painter.drawLine(0, 0, self.width(), 0)
  844. AbstractPluginSlot.paintEvent(self, event)
  845. # ------------------------------------------------------------------------------------------------------------
  846. class PluginSlot_Calf(AbstractPluginSlot):
  847. def __init__(self, parent, host, pluginId):
  848. AbstractPluginSlot.__init__(self, parent, host, pluginId)
  849. self.ui = ui_carla_plugin_calf.Ui_PluginWidget()
  850. self.ui.setupUi(self)
  851. audioCount = self.host.get_audio_port_count_info(self.fPluginId)
  852. midiCount = self.host.get_midi_port_count_info(self.fPluginId)
  853. # -------------------------------------------------------------
  854. # Internal stuff
  855. self.fButtonFont = self.ui.b_gui.font()
  856. self.fButtonFont.setBold(False)
  857. self.fButtonFont.setPointSize(8)
  858. # Use black for mono plugins
  859. self.fBackgroundBlack = audioCount['ins'] == 1
  860. self.fButtonColorOn = QColor( 18, 41, 87)
  861. self.fButtonColorOff = QColor(150, 150, 150)
  862. # -------------------------------------------------------------
  863. # Set-up GUI
  864. self.setStyleSheet("""
  865. QLabel#label_name, QLabel#label_audio_in, QLabel#label_audio_out, QLabel#label_midi {
  866. color: #BBB;
  867. }
  868. PluginSlot_Calf#PluginWidget {
  869. background-image: url(:/bitmaps/background_calf_%s.png);
  870. background-repeat: repeat-xy;
  871. border: 2px;
  872. }
  873. """ % ("black" if self.fBackgroundBlack else "blue"))
  874. self.ui.b_gui.setPixmaps(":/bitmaps/button_calf2.png", ":/bitmaps/button_calf2_down.png", ":/bitmaps/button_calf2_hover.png")
  875. self.ui.b_edit.setPixmaps(":/bitmaps/button_calf2.png", ":/bitmaps/button_calf2_down.png", ":/bitmaps/button_calf2_hover.png")
  876. self.ui.b_remove.setPixmaps(":/bitmaps/button_calf1.png", ":/bitmaps/button_calf1_down.png", ":/bitmaps/button_calf1_hover.png")
  877. self.ui.b_edit.setTopText(self.tr("Edit"), self.fButtonColorOn, self.fButtonFont)
  878. self.ui.b_remove.setTopText(self.tr("Remove"), self.fButtonColorOn, self.fButtonFont)
  879. if self.fPluginInfo['hints'] & PLUGIN_HAS_CUSTOM_UI:
  880. self.ui.b_gui.setTopText(self.tr("GUI"), self.fButtonColorOn, self.fButtonFont)
  881. else:
  882. self.ui.b_gui.setTopText(self.tr("GUI"), self.fButtonColorOff, self.fButtonFont)
  883. labelFont = self.ui.label_name.font()
  884. labelFont.setBold(True)
  885. labelFont.setPointSize(10)
  886. self.ui.label_name.setFont(labelFont)
  887. if audioCount['ins'] == 0:
  888. self.ui.label_audio_in.hide()
  889. self.ui.peak_in.hide()
  890. if audioCount['outs'] > 0:
  891. self.ui.peak_out.setMinimumWidth(200)
  892. if audioCount['outs'] == 0:
  893. self.ui.label_audio_out.hide()
  894. self.ui.peak_out.hide()
  895. if midiCount['ins'] == 0:
  896. self.ui.label_midi.hide()
  897. self.ui.led_midi.hide()
  898. if self.fIdleTimerId != 0:
  899. self.ui.b_remove.setEnabled(False)
  900. self.ui.b_remove.setVisible(False)
  901. # -------------------------------------------------------------
  902. # Set-up parameters
  903. parameterCount = self.host.get_parameter_count(self.fPluginId)
  904. index = 0
  905. limit = 7 if midiCount['ins'] == 0 else 6
  906. for i in range(parameterCount):
  907. if index >= limit:
  908. break
  909. paramInfo = self.host.get_parameter_info(self.fPluginId, i)
  910. paramData = self.host.get_parameter_data(self.fPluginId, i)
  911. paramRanges = self.host.get_parameter_ranges(self.fPluginId, i)
  912. if paramData['type'] != PARAMETER_INPUT:
  913. continue
  914. if paramData['hints'] & PARAMETER_IS_BOOLEAN:
  915. continue
  916. if (paramData['hints'] & PARAMETER_IS_ENABLED) == 0:
  917. continue
  918. paramName = getParameterShortName(paramInfo['name'])
  919. widget = PixmapDial(self, i)
  920. widget.setPixmap(7)
  921. widget.setLabel(paramName)
  922. widget.setCustomPaintMode(PixmapDial.CUSTOM_PAINT_MODE_NO_GRADIENT)
  923. widget.setMinimum(paramRanges['min'])
  924. widget.setMaximum(paramRanges['max'])
  925. if (paramData['hints'] & PARAMETER_IS_ENABLED) == 0:
  926. widget.setEnabled(False)
  927. self.ui.w_knobs.layout().insertWidget(index, widget)
  928. index += 1
  929. self.fParameterList.append([i, widget])
  930. # -------------------------------------------------------------
  931. self.b_gui = self.ui.b_gui
  932. self.b_edit = self.ui.b_edit
  933. self.b_remove = self.ui.b_remove
  934. self.label_name = self.ui.label_name
  935. self.led_midi = self.ui.led_midi
  936. self.peak_in = self.ui.peak_in
  937. self.peak_out = self.ui.peak_out
  938. self.ready()
  939. self.ui.led_midi.setColor(self.ui.led_midi.CALF)
  940. self.customContextMenuRequested.connect(self.slot_showDefaultCustomMenu)
  941. #------------------------------------------------------------------
  942. def getFixedHeight(self):
  943. return 88
  944. #------------------------------------------------------------------
  945. def editDialogPluginHintsChanged(self, pluginId, hints):
  946. if hints & PLUGIN_HAS_CUSTOM_UI:
  947. self.ui.b_gui.setTopText(self.tr("GUI"), self.fButtonColorOn, self.fButtonFont)
  948. else:
  949. self.ui.b_gui.setTopText(self.tr("GUI"), self.fButtonColorOff, self.fButtonFont)
  950. AbstractPluginSlot.editDialogPluginHintsChanged(self, pluginId, hints)
  951. #------------------------------------------------------------------
  952. def paintEvent(self, event):
  953. painter = QPainter(self)
  954. painter.setBrush(Qt.transparent)
  955. painter.setPen(QPen(QColor(20, 20, 20) if self.fBackgroundBlack else QColor(75, 86, 99), 1))
  956. painter.drawRect(0, 1, self.width()-1, 88-3)
  957. painter.setPen(QPen(QColor(45, 45, 45) if self.fBackgroundBlack else QColor(86, 99, 114), 1))
  958. painter.drawLine(0, 0, self.width(), 0)
  959. AbstractPluginSlot.paintEvent(self, event)
  960. # ------------------------------------------------------------------------------------------------------------
  961. class PluginSlot_OpenAV(AbstractPluginSlot):
  962. def __init__(self, parent, host, pluginId):
  963. AbstractPluginSlot.__init__(self, parent, host, pluginId)
  964. self.ui = ui_carla_plugin_basic_fx.Ui_PluginWidget()
  965. self.ui.setupUi(self)
  966. # -------------------------------------------------------------
  967. # Set-up GUI
  968. QFontDatabase.addApplicationFont(":/fonts/uranium.ttf")
  969. labelFont = QFont()
  970. labelFont.setFamily("Uranium")
  971. labelFont.setPointSize(13)
  972. labelFont.setCapitalization(QFont.AllUppercase)
  973. self.ui.label_name.setFont(labelFont)
  974. self.setStyleSheet("""
  975. PluginSlot_OpenAV#PluginWidget {
  976. background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1,
  977. stop: 0 #303030, stop: 0.35 #111111, stop: 1.0 #111111);
  978. }
  979. """)
  980. self.ui.label_name.setStyleSheet("* { color: #FF5100; }")
  981. #self.ui.line.setStyleSheet("* { background-color: #FF5100; color: #FF5100; }")
  982. self.ui.peak_in.setMeterStyle(DigitalPeakMeter.STYLE_OPENAV)
  983. self.ui.peak_out.setMeterStyle(DigitalPeakMeter.STYLE_OPENAV)
  984. self.ui.b_enable.setPixmaps(":/bitmaps/button_off.png", ":/bitmaps/button_on.png", ":/bitmaps/button_off.png")
  985. self.ui.b_edit.setPixmaps(":/bitmaps/button_edit.png", ":/bitmaps/button_edit_down.png", ":/bitmaps/button_edit_hover.png")
  986. self.ui.b_gui.setPixmaps(":/bitmaps/button_gui.png", ":/bitmaps/button_gui_down.png", ":/bitmaps/button_gui_hover.png")
  987. # -------------------------------------------------------------
  988. # Set-up parameters
  989. parameterCount = self.host.get_parameter_count(self.fPluginId)
  990. index = 0
  991. for i in range(parameterCount):
  992. if index >= 8:
  993. break
  994. paramInfo = self.host.get_parameter_info(self.fPluginId, i)
  995. paramData = self.host.get_parameter_data(self.fPluginId, i)
  996. paramRanges = self.host.get_parameter_ranges(self.fPluginId, i)
  997. if paramData['type'] != PARAMETER_INPUT:
  998. continue
  999. if paramData['hints'] & PARAMETER_IS_BOOLEAN:
  1000. continue
  1001. if (paramData['hints'] & PARAMETER_IS_ENABLED) == 0:
  1002. continue
  1003. paramName = getParameterShortName(paramInfo['name'])
  1004. widget = PixmapDial(self, i)
  1005. widget.setPixmap(11)
  1006. widget.setLabel(paramName)
  1007. widget.setCustomPaintMode(PixmapDial.CUSTOM_PAINT_MODE_NO_GRADIENT)
  1008. widget.setMinimum(paramRanges['min'])
  1009. widget.setMaximum(paramRanges['max'])
  1010. if (paramData['hints'] & PARAMETER_IS_ENABLED) == 0:
  1011. widget.setEnabled(False)
  1012. self.ui.w_knobs.layout().insertWidget(index, widget)
  1013. index += 1
  1014. self.fParameterList.append([i, widget])
  1015. self.ui.dial_drywet.setIndex(PARAMETER_DRYWET)
  1016. self.ui.dial_drywet.setPixmap(13)
  1017. self.ui.dial_drywet.setLabel("Dry/Wet")
  1018. self.ui.dial_drywet.setCustomPaintMode(PixmapDial.CUSTOM_PAINT_MODE_NO_GRADIENT)
  1019. self.ui.dial_drywet.setMinimum(0.0)
  1020. self.ui.dial_drywet.setMaximum(1.0)
  1021. self.ui.dial_drywet.setVisible(self.fPluginInfo['hints'] & PLUGIN_CAN_DRYWET)
  1022. self.ui.dial_vol.setIndex(PARAMETER_VOLUME)
  1023. self.ui.dial_vol.setPixmap(12)
  1024. self.ui.dial_vol.setLabel("Volume")
  1025. self.ui.dial_vol.setCustomPaintMode(PixmapDial.CUSTOM_PAINT_MODE_NO_GRADIENT)
  1026. self.ui.dial_vol.setMinimum(0.0)
  1027. self.ui.dial_vol.setMaximum(1.27)
  1028. self.ui.dial_vol.setVisible(self.fPluginInfo['hints'] & PLUGIN_CAN_VOLUME)
  1029. self.fParameterList.append([PARAMETER_DRYWET, self.ui.dial_drywet])
  1030. self.fParameterList.append([PARAMETER_VOLUME, self.ui.dial_vol])
  1031. # -------------------------------------------------------------
  1032. self.b_enable = self.ui.b_enable
  1033. self.b_gui = self.ui.b_gui
  1034. self.b_edit = self.ui.b_edit
  1035. self.label_name = self.ui.label_name
  1036. self.led_control = self.ui.led_control
  1037. self.led_midi = self.ui.led_midi
  1038. self.led_audio_in = self.ui.led_audio_in
  1039. self.led_audio_out = self.ui.led_audio_out
  1040. self.peak_in = self.ui.peak_in
  1041. self.peak_out = self.ui.peak_out
  1042. self.ready()
  1043. self.customContextMenuRequested.connect(self.slot_showDefaultCustomMenu)
  1044. #------------------------------------------------------------------
  1045. def getFixedHeight(self):
  1046. return 79
  1047. #------------------------------------------------------------------
  1048. def paintEvent(self, event):
  1049. painter = QPainter(self)
  1050. painter.setBrush(Qt.transparent)
  1051. painter.setPen(QPen(QColor(42, 42, 42), 1))
  1052. painter.drawRect(0, 1, self.width()-1, 79-3)
  1053. painter.setPen(QPen(QColor(60, 60, 60), 1))
  1054. painter.drawLine(0, 0, self.width(), 0)
  1055. AbstractPluginSlot.paintEvent(self, event)
  1056. # ------------------------------------------------------------------------------------------------------------
  1057. class PluginSlot_Nekobi(AbstractPluginSlot):
  1058. def __init__(self, parent, host, pluginId):
  1059. AbstractPluginSlot.__init__(self, parent, host, pluginId)
  1060. #self.ui = ui_carla_plugin_basic_fx.Ui_PluginWidget()
  1061. #self.ui.setupUi(self)
  1062. # -------------------------------------------------------------
  1063. # Set-up GUI
  1064. self.fPixmapCenter = QPixmap(":/bitmaps/background_nekobi.png")
  1065. self.fPixmapLeft = QPixmap(":/bitmaps/background_nekobi_left.png")
  1066. self.fPixmapLeftRect = QRectF(0, 0, self.fPixmapLeft.width(), self.fPixmapLeft.height())
  1067. self.fPixmapRight = QPixmap(":/bitmaps/background_nekobi_right.png")
  1068. self.fPixmapRightRect = QRectF(0, 0, self.fPixmapRight.width(), self.fPixmapRight.height())
  1069. #self.setStyleSheet("""
  1070. #PluginSlot_Nekobi#PluginWidget {
  1071. #background-image: url(:/bitmaps/background_nekobi.png);
  1072. #background-repeat: repeat-xy;
  1073. #}
  1074. #QLabel#label_name {
  1075. #color: #BBB;
  1076. #}
  1077. #""")
  1078. #------------------------------------------------------------------
  1079. def getFixedHeight(self):
  1080. return 108
  1081. #------------------------------------------------------------------
  1082. def paintEvent(self, event):
  1083. painter = QPainter(self)
  1084. # main bg (center)
  1085. painter.drawTiledPixmap(0, 0, self.width(), self.height(), self.fPixmapCenter)
  1086. # left side
  1087. painter.drawPixmap(self.fPixmapLeftRect, self.fPixmapLeft, self.fPixmapLeftRect)
  1088. # right side
  1089. rightTarget = QRectF(self.fPixmapRightRect)
  1090. rightTarget.moveLeft(self.width()-rightTarget.width())
  1091. painter.drawPixmap(rightTarget, self.fPixmapRight, self.fPixmapRightRect)
  1092. AbstractPluginSlot.paintEvent(self, event)
  1093. # ------------------------------------------------------------------------------------------------------------
  1094. class PluginSlot_SF2(AbstractPluginSlot):
  1095. def __init__(self, parent, host, pluginId):
  1096. AbstractPluginSlot.__init__(self, parent, host, pluginId)
  1097. self.ui = ui_carla_plugin_sf2.Ui_PluginWidget()
  1098. self.ui.setupUi(self)
  1099. # -------------------------------------------------------------
  1100. # Set-up GUI
  1101. #labelFont = self.ui.label_name.font()
  1102. #labelFont.setBold(True)
  1103. #labelFont.setPointSize(9)
  1104. #self.ui.label_name.setFont(labelFont)
  1105. self.setStyleSheet("""
  1106. PluginSlot_SF2#PluginWidget {
  1107. background-image: url(:/bitmaps/background_3bandeq.png);
  1108. background-repeat: repeat-xy;
  1109. }
  1110. QLabel#label_name {
  1111. color: #BBB;
  1112. }
  1113. """)
  1114. self.ui.b_enable.setPixmaps(":/bitmaps/button_off.png", ":/bitmaps/button_on.png", ":/bitmaps/button_off.png")
  1115. self.ui.b_edit.setPixmaps(":/bitmaps/button_edit.png", ":/bitmaps/button_edit_down.png", ":/bitmaps/button_edit_hover.png")
  1116. # -------------------------------------------------------------
  1117. # Set-up parameters
  1118. parameterCount = self.host.get_parameter_count(self.fPluginId)
  1119. index = 0
  1120. for i in range(parameterCount):
  1121. if index >= 8:
  1122. break
  1123. paramInfo = self.host.get_parameter_info(self.fPluginId, i)
  1124. paramData = self.host.get_parameter_data(self.fPluginId, i)
  1125. paramRanges = self.host.get_parameter_ranges(self.fPluginId, i)
  1126. if paramData['type'] != PARAMETER_INPUT:
  1127. continue
  1128. if paramData['hints'] & PARAMETER_IS_BOOLEAN:
  1129. continue
  1130. if (paramData['hints'] & PARAMETER_IS_ENABLED) == 0:
  1131. continue
  1132. paramName = getParameterShortName(paramInfo['name'])
  1133. widget = PixmapDial(self, i)
  1134. widget.setPixmap(3)
  1135. widget.setLabel(paramName)
  1136. widget.setMinimum(paramRanges['min'])
  1137. widget.setMaximum(paramRanges['max'])
  1138. if (paramData['hints'] & PARAMETER_IS_ENABLED) == 0:
  1139. widget.setEnabled(False)
  1140. self.ui.w_knobs.layout().insertWidget(index, widget)
  1141. index += 1
  1142. self.fParameterList.append([i, widget])
  1143. self.ui.dial_vol.setIndex(PARAMETER_VOLUME)
  1144. self.ui.dial_vol.setPixmap(3)
  1145. self.ui.dial_vol.setLabel("Volume")
  1146. self.ui.dial_vol.setCustomPaintMode(PixmapDial.CUSTOM_PAINT_MODE_CARLA_VOL)
  1147. self.ui.dial_vol.setMinimum(0.0)
  1148. self.ui.dial_vol.setMaximum(1.27)
  1149. self.ui.dial_vol.forceWhiteLabelGradientText()
  1150. self.ui.dial_vol.setVisible(self.fPluginInfo['hints'] & PLUGIN_CAN_VOLUME)
  1151. self.fParameterList.append([PARAMETER_VOLUME, self.ui.dial_vol])
  1152. # -------------------------------------------------------------
  1153. self.b_enable = self.ui.b_enable
  1154. self.b_edit = self.ui.b_edit
  1155. self.label_name = self.ui.label_name
  1156. self.led_control = self.ui.led_control
  1157. self.led_midi = self.ui.led_midi
  1158. self.led_audio_out = self.ui.led_audio_out
  1159. self.peak_out = self.ui.peak_out
  1160. self.ready()
  1161. self.customContextMenuRequested.connect(self.slot_showDefaultCustomMenu)
  1162. #------------------------------------------------------------------
  1163. def getFixedHeight(self):
  1164. return 79
  1165. #------------------------------------------------------------------
  1166. def paintEvent(self, event):
  1167. painter = QPainter(self)
  1168. painter.setBrush(Qt.transparent)
  1169. painter.setPen(QPen(QColor(42, 42, 42), 1))
  1170. painter.drawRect(0, 1, self.width()-1, 79-3)
  1171. painter.setPen(QPen(QColor(60, 60, 60), 1))
  1172. painter.drawLine(0, 0, self.width(), 0)
  1173. AbstractPluginSlot.paintEvent(self, event)
  1174. # ------------------------------------------------------------------------------------------------------------
  1175. class PluginSlot_ZynFX(AbstractPluginSlot):
  1176. def __init__(self, parent, host, pluginId):
  1177. AbstractPluginSlot.__init__(self, parent, host, pluginId)
  1178. self.ui = ui_carla_plugin_zynfx.Ui_PluginWidget()
  1179. self.ui.setupUi(self)
  1180. # -------------------------------------------------------------
  1181. # Set-up GUI
  1182. self.setStyleSheet("""
  1183. PluginSlot_ZynFX#PluginWidget {
  1184. background-image: url(:/bitmaps/background_zynfx.png);
  1185. background-repeat: repeat-xy;
  1186. border: 2px;
  1187. }
  1188. QLabel#label_name, QLabel#label_presets {
  1189. color: #BBB;
  1190. }
  1191. """)
  1192. self.ui.b_enable.setPixmaps(":/bitmaps/button_off.png", ":/bitmaps/button_on.png", ":/bitmaps/button_off.png")
  1193. self.ui.b_edit.setPixmaps(":/bitmaps/button_edit.png", ":/bitmaps/button_edit_down.png", ":/bitmaps/button_edit_hover.png")
  1194. labelFont = self.ui.label_name.font()
  1195. labelFont.setBold(True)
  1196. labelFont.setPointSize(9)
  1197. self.ui.label_name.setFont(labelFont)
  1198. presetFont = self.ui.label_presets.font()
  1199. presetFont.setBold(True)
  1200. presetFont.setPointSize(8)
  1201. self.ui.label_presets.setFont(presetFont)
  1202. self.ui.peak_in.setMeterStyle(DigitalPeakMeter.STYLE_OPENAV)
  1203. self.ui.peak_out.setMeterStyle(DigitalPeakMeter.STYLE_OPENAV)
  1204. # -------------------------------------------------------------
  1205. # Set-up parameters
  1206. parameterCount = self.host.get_parameter_count(self.fPluginId)
  1207. index = 0
  1208. for i in range(parameterCount):
  1209. paramInfo = self.host.get_parameter_info(self.fPluginId, i)
  1210. paramData = self.host.get_parameter_data(self.fPluginId, i)
  1211. paramRanges = self.host.get_parameter_ranges(self.fPluginId, i)
  1212. if paramData['type'] != PARAMETER_INPUT:
  1213. continue
  1214. if paramData['hints'] & PARAMETER_IS_BOOLEAN:
  1215. continue
  1216. if (paramData['hints'] & PARAMETER_IS_ENABLED) == 0:
  1217. continue
  1218. paramName = paramInfo['name']
  1219. # real zyn fx plugins
  1220. if self.fPluginInfo['label'] == "zynalienwah":
  1221. if i == 0: paramName = "Freq"
  1222. elif i == 1: paramName = "Rnd"
  1223. elif i == 2: paramName = "L type" # combobox
  1224. elif i == 3: paramName = "St.df"
  1225. elif i == 5: paramName = "Fb"
  1226. elif i == 7: paramName = "L/R"
  1227. elif self.fPluginInfo['label'] == "zynchorus":
  1228. if i == 0: paramName = "Freq"
  1229. elif i == 1: paramName = "Rnd"
  1230. elif i == 2: paramName = "L type" # combobox
  1231. elif i == 3: paramName = "St.df"
  1232. elif i == 6: paramName = "Fb"
  1233. elif i == 7: paramName = "L/R"
  1234. elif i == 8: paramName = "Flngr" # button
  1235. elif i == 9: paramName = "Subst" # button
  1236. elif self.fPluginInfo['label'] == "zyndistortion":
  1237. if i == 0: paramName = "LRc."
  1238. elif i == 4: paramName = "Neg." # button
  1239. elif i == 5: paramName = "LPF"
  1240. elif i == 6: paramName = "HPF"
  1241. elif i == 7: paramName = "St." # button
  1242. elif i == 8: paramName = "PF" # button
  1243. elif self.fPluginInfo['label'] == "zyndynamicfilter":
  1244. if i == 0: paramName = "Freq"
  1245. elif i == 1: paramName = "Rnd"
  1246. elif i == 2: paramName = "L type" # combobox
  1247. elif i == 3: paramName = "St.df"
  1248. elif i == 4: paramName = "LfoD"
  1249. elif i == 5: paramName = "A.S."
  1250. elif i == 6: paramName = "A.Inv." # button
  1251. elif i == 7: paramName = "A.M."
  1252. elif self.fPluginInfo['label'] == "zynecho":
  1253. if i == 1: paramName = "LRdl."
  1254. elif i == 2: paramName = "LRc."
  1255. elif i == 3: paramName = "Fb."
  1256. elif i == 4: paramName = "Damp"
  1257. elif self.fPluginInfo['label'] == "zynphaser":
  1258. if i == 0: paramName = "Freq"
  1259. elif i == 1: paramName = "Rnd"
  1260. elif i == 2: paramName = "L type" # combobox
  1261. elif i == 3: paramName = "St.df"
  1262. elif i == 5: paramName = "Fb"
  1263. elif i == 7: paramName = "L/R"
  1264. elif i == 8: paramName = "Subst" # button
  1265. elif i == 9: paramName = "Phase"
  1266. elif i == 11: paramName = "Dist"
  1267. elif self.fPluginInfo['label'] == "zynreverb":
  1268. if i == 2: paramName = "I.delfb"
  1269. elif i == 5: paramName = "LPF"
  1270. elif i == 6: paramName = "HPF"
  1271. elif i == 9: paramName = "R.S."
  1272. elif i == 10: paramName = "I.del"
  1273. else:
  1274. paramName = getParameterShortName(paramInfo['name'])
  1275. widget = PixmapDial(self, i)
  1276. widget.setPixmap(5)
  1277. widget.setLabel(paramName)
  1278. widget.setCustomPaintMode(PixmapDial.CUSTOM_PAINT_MODE_NO_GRADIENT)
  1279. widget.setMinimum(paramRanges['min'])
  1280. widget.setMaximum(paramRanges['max'])
  1281. if (paramData['hints'] & PARAMETER_IS_ENABLED) == 0:
  1282. widget.setEnabled(False)
  1283. self.ui.w_knobs.layout().insertWidget(index, widget)
  1284. index += 1
  1285. self.fParameterList.append([i, widget])
  1286. self.ui.dial_drywet.setIndex(PARAMETER_DRYWET)
  1287. self.ui.dial_drywet.setPixmap(5)
  1288. self.ui.dial_drywet.setLabel("Wet")
  1289. self.ui.dial_drywet.setCustomPaintMode(PixmapDial.CUSTOM_PAINT_MODE_NO_GRADIENT)
  1290. self.ui.dial_drywet.setMinimum(0.0)
  1291. self.ui.dial_drywet.setMaximum(1.0)
  1292. self.ui.dial_drywet.setVisible(self.fPluginInfo['hints'] & PLUGIN_CAN_DRYWET)
  1293. self.ui.dial_vol.setIndex(PARAMETER_VOLUME)
  1294. self.ui.dial_vol.setPixmap(5)
  1295. self.ui.dial_vol.setLabel("Vol")
  1296. self.ui.dial_vol.setCustomPaintMode(PixmapDial.CUSTOM_PAINT_MODE_NO_GRADIENT)
  1297. self.ui.dial_vol.setMinimum(0.0)
  1298. self.ui.dial_vol.setMaximum(1.27)
  1299. self.ui.dial_vol.setVisible(self.fPluginInfo['hints'] & PLUGIN_CAN_VOLUME)
  1300. self.fParameterList.append([PARAMETER_DRYWET, self.ui.dial_drywet])
  1301. self.fParameterList.append([PARAMETER_VOLUME, self.ui.dial_vol])
  1302. # -------------------------------------------------------------
  1303. # Set-up MIDI programs
  1304. midiProgramCount = self.host.get_midi_program_count(self.fPluginId)
  1305. if midiProgramCount > 0:
  1306. self.ui.cb_presets.setEnabled(True)
  1307. self.ui.label_presets.setEnabled(True)
  1308. for i in range(midiProgramCount):
  1309. mpData = self.host.get_midi_program_data(self.fPluginId, i)
  1310. mpName = mpData['name']
  1311. self.ui.cb_presets.addItem(mpName)
  1312. self.fCurrentMidiProgram = self.host.get_current_midi_program_index(self.fPluginId)
  1313. self.ui.cb_presets.setCurrentIndex(self.fCurrentMidiProgram)
  1314. else:
  1315. self.fCurrentMidiProgram = -1
  1316. self.ui.cb_presets.setEnabled(False)
  1317. self.ui.cb_presets.setVisible(False)
  1318. self.ui.label_presets.setEnabled(False)
  1319. self.ui.label_presets.setVisible(False)
  1320. # -------------------------------------------------------------
  1321. self.b_enable = self.ui.b_enable
  1322. self.b_edit = self.ui.b_edit
  1323. self.cb_presets = self.ui.cb_presets
  1324. self.label_name = self.ui.label_name
  1325. self.led_control = self.ui.led_control
  1326. self.led_midi = self.ui.led_midi
  1327. self.led_audio_in = self.ui.led_audio_in
  1328. self.led_audio_out = self.ui.led_audio_out
  1329. self.peak_in = self.ui.peak_in
  1330. self.peak_out = self.ui.peak_out
  1331. self.ready()
  1332. self.customContextMenuRequested.connect(self.slot_showDefaultCustomMenu)
  1333. self.ui.cb_presets.currentIndexChanged.connect(self.slot_midiProgramChanged)
  1334. #------------------------------------------------------------------
  1335. def getFixedHeight(self):
  1336. return 77
  1337. #------------------------------------------------------------------
  1338. def paintEvent(self, event):
  1339. painter = QPainter(self)
  1340. painter.setBrush(Qt.transparent)
  1341. painter.setPen(QPen(QColor(60, 60, 60), 1))
  1342. painter.drawRect(0, 1, self.width()-1, self.height()-3)
  1343. painter.setPen(QPen(QColor(94, 94, 94), 1))
  1344. painter.drawLine(0, 0, self.width(), 0)
  1345. AbstractPluginSlot.paintEvent(self, event)
  1346. # ------------------------------------------------------------------------------------------------------------
  1347. def createPluginSlot(parent, host, pluginId, useSkins):
  1348. if not useSkins:
  1349. return PluginSlot_Default(parent, host, pluginId)
  1350. pluginInfo = host.get_plugin_info(pluginId)
  1351. pluginName = host.get_real_plugin_name(pluginId)
  1352. pluginLabel = pluginInfo['label']
  1353. pluginMaker = pluginInfo['maker']
  1354. uniqueId = pluginInfo['uniqueId']
  1355. #pluginIcon = pluginInfo['iconName']
  1356. if pluginInfo['type'] == PLUGIN_SF2:
  1357. return PluginSlot_SF2(parent, host, pluginId)
  1358. if pluginMaker == "OpenAV Productions":
  1359. return PluginSlot_OpenAV(parent, host, pluginId)
  1360. if pluginInfo['type'] == PLUGIN_INTERNAL:
  1361. if pluginLabel.startswith("zyn") and pluginInfo['category'] != PLUGIN_CATEGORY_SYNTH:
  1362. return PluginSlot_ZynFX(parent, host, pluginId)
  1363. elif pluginInfo['type'] == PLUGIN_LADSPA:
  1364. if pluginLabel.startswith("Zyn") and pluginMaker.startswith("Josep Andreu"):
  1365. return PluginSlot_ZynFX(parent, host, pluginId)
  1366. if pluginName.split(" ", 1)[0].lower() == "calf":
  1367. return PluginSlot_Calf(parent, host, pluginId)
  1368. #if pluginName.lower() == "nekobi":
  1369. #return PluginSlot_Nekobi(parent, pluginId)
  1370. return PluginSlot_BasicFX(parent, host, pluginId)
  1371. # ------------------------------------------------------------------------------------------------------------
  1372. # Main Testing
  1373. if __name__ == '__main__':
  1374. from carla_app import CarlaApplication
  1375. from carla_host import initHost, loadHostSettings
  1376. import resources_rc
  1377. app = CarlaApplication("Carla-Skins")
  1378. host = initHost("Skins", None, False, False, False)
  1379. loadHostSettings(host)
  1380. host.engine_init("JACK", "Carla-Widgets")
  1381. host.add_plugin(BINARY_NATIVE, PLUGIN_INTERNAL, "", "", "zynreverb", 0, None)
  1382. #host.add_plugin(BINARY_NATIVE, PLUGIN_DSSI, "/usr/lib/dssi/karplong.so", "karplong", "karplong", 0, None)
  1383. #host.add_plugin(BINARY_NATIVE, PLUGIN_LV2, "", "", "http://www.openavproductions.com/sorcer", 0, None)
  1384. #host.add_plugin(BINARY_NATIVE, PLUGIN_LV2, "", "", "http://calf.sourceforge.net/plugins/Compressor", 0, None)
  1385. host.set_active(0, True)
  1386. gui = createPluginSlot(None, host, 0, True)
  1387. gui.testTimer()
  1388. gui.show()
  1389. app.exec_()