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.

3140 lines
124KB

  1. #!/usr/bin/env python3
  2. # -*- coding: utf-8 -*-
  3. # Common Carla code
  4. # Copyright (C) 2011-2013 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 GPL.txt file
  17. # ------------------------------------------------------------------------------------------------------------
  18. # Imports (Global)
  19. import os
  20. import json
  21. import sys
  22. from copy import deepcopy
  23. from subprocess import Popen, PIPE
  24. from PyQt4.QtCore import pyqtSlot, qWarning, Qt, QByteArray, QSettings, QThread, QTimer, SIGNAL, SLOT
  25. from PyQt4.QtGui import QColor, QCursor, QDialog, QIcon, QInputDialog, QFileDialog, QFontMetrics, QFrame, QMenu
  26. from PyQt4.QtGui import QMessageBox, QPainter, QPainterPath, QTableWidgetItem, QVBoxLayout, QWidget
  27. # ------------------------------------------------------------------------------------------------------------
  28. # Imports (Custom)
  29. import ui_carla_about
  30. import ui_carla_database
  31. import ui_carla_edit
  32. import ui_carla_parameter
  33. import ui_carla_plugin
  34. import ui_carla_refresh
  35. from carla_backend import *
  36. # ------------------------------------------------------------------------------------------------------------
  37. # Try Import LADSPA-RDF
  38. try:
  39. import ladspa_rdf
  40. haveLRDF = True
  41. except:
  42. print("LRDF Support not available (LADSPA-RDF will be disabled)")
  43. haveLRDF = False
  44. # ------------------------------------------------------------------------------------------------------------
  45. # Try Import Signal
  46. try:
  47. from signal import signal, SIGINT, SIGTERM, SIGUSR1
  48. haveSignal = True
  49. except:
  50. haveSignal = False
  51. # ------------------------------------------------------------------------------------------------------------
  52. # Platform specific stuff
  53. if MACOS:
  54. from PyQt4.QtGui import qt_mac_set_menubar_icons
  55. qt_mac_set_menubar_icons(False)
  56. elif WINDOWS:
  57. WINDIR = os.getenv("WINDIR")
  58. # ------------------------------------------------------------------------------------------------------------
  59. # Set Version
  60. VERSION = "0.5.0"
  61. # ------------------------------------------------------------------------------------------------------------
  62. # Set TMP
  63. TMP = os.getenv("TMP")
  64. if TMP is None:
  65. if WINDOWS:
  66. qWarning("TMP variable not set")
  67. TMP = os.path.join(WINDIR, "temp")
  68. else:
  69. TMP = "/tmp"
  70. # ------------------------------------------------------------------------------------------------------------
  71. # Set HOME
  72. HOME = os.getenv("HOME")
  73. if HOME is None:
  74. HOME = os.path.expanduser("~")
  75. if LINUX or MACOS:
  76. qWarning("HOME variable not set")
  77. if not os.path.exists(HOME):
  78. qWarning("HOME does not exist")
  79. HOME = TMP
  80. # ------------------------------------------------------------------------------------------------------------
  81. # Set PATH
  82. PATH = os.getenv("PATH")
  83. if PATH is None:
  84. qWarning("PATH variable not set")
  85. if MACOS:
  86. PATH = ("/opt/local/bin", "/usr/local/bin", "/usr/bin", "/bin")
  87. elif WINDOWS:
  88. PATH = (os.path.join(WINDIR, "system32"), WINDIR)
  89. else:
  90. PATH = ("/usr/local/bin", "/usr/bin", "/bin")
  91. else:
  92. PATH = PATH.split(os.pathsep)
  93. # ------------------------------------------------------------------------------------------------------------
  94. # Carla object
  95. class CarlaObject(object):
  96. __slots__ = [
  97. 'host',
  98. 'gui',
  99. 'isControl',
  100. 'isLocal',
  101. 'processMode',
  102. 'maxParameters',
  103. 'LADSPA_PATH',
  104. 'DSSI_PATH',
  105. 'LV2_PATH',
  106. 'VST_PATH',
  107. 'GIG_PATH',
  108. 'SF2_PATH',
  109. 'SFZ_PATH'
  110. ]
  111. Carla = CarlaObject()
  112. Carla.host = None
  113. Carla.gui = None
  114. Carla.isControl = False
  115. Carla.isLocal = True
  116. Carla.processMode = PROCESS_MODE_CONTINUOUS_RACK
  117. Carla.maxParameters = MAX_RACK_PLUGINS
  118. # ------------------------------------------------------------------------------------------------------------
  119. # Carla GUI defines
  120. ICON_STATE_NULL = 0
  121. ICON_STATE_WAIT = 1
  122. ICON_STATE_OFF = 2
  123. ICON_STATE_ON = 3
  124. PALETTE_COLOR_NONE = 0
  125. PALETTE_COLOR_WHITE = 1
  126. PALETTE_COLOR_RED = 2
  127. PALETTE_COLOR_GREEN = 3
  128. PALETTE_COLOR_BLUE = 4
  129. PALETTE_COLOR_YELLOW = 5
  130. PALETTE_COLOR_ORANGE = 6
  131. PALETTE_COLOR_BROWN = 7
  132. PALETTE_COLOR_PINK = 8
  133. # ------------------------------------------------------------------------------------------------------------
  134. # Static MIDI CC list
  135. MIDI_CC_LIST = (
  136. #"0x00 Bank Select",
  137. "0x01 Modulation",
  138. "0x02 Breath",
  139. "0x03 (Undefined)",
  140. "0x04 Foot",
  141. "0x05 Portamento",
  142. #"0x06 (Data Entry MSB)",
  143. "0x07 Volume",
  144. "0x08 Balance",
  145. "0x09 (Undefined)",
  146. "0x0A Pan",
  147. "0x0B Expression",
  148. "0x0C FX Control 1",
  149. "0x0D FX Control 2",
  150. "0x0E (Undefined)",
  151. "0x0F (Undefined)",
  152. "0x10 General Purpose 1",
  153. "0x11 General Purpose 2",
  154. "0x12 General Purpose 3",
  155. "0x13 General Purpose 4",
  156. "0x14 (Undefined)",
  157. "0x15 (Undefined)",
  158. "0x16 (Undefined)",
  159. "0x17 (Undefined)",
  160. "0x18 (Undefined)",
  161. "0x19 (Undefined)",
  162. "0x1A (Undefined)",
  163. "0x1B (Undefined)",
  164. "0x1C (Undefined)",
  165. "0x1D (Undefined)",
  166. "0x1E (Undefined)",
  167. "0x1F (Undefined)",
  168. #"0x20 *Bank Select",
  169. #"0x21 *Modulation",
  170. #"0x22 *Breath",
  171. #"0x23 *(Undefined)",
  172. #"0x24 *Foot",
  173. #"0x25 *Portamento",
  174. #"0x26 *(Data Entry MSB)",
  175. #"0x27 *Volume",
  176. #"0x28 *Balance",
  177. #"0x29 *(Undefined)",
  178. #"0x2A *Pan",
  179. #"0x2B *Expression",
  180. #"0x2C *FX *Control 1",
  181. #"0x2D *FX *Control 2",
  182. #"0x2E *(Undefined)",
  183. #"0x2F *(Undefined)",
  184. #"0x30 *General Purpose 1",
  185. #"0x31 *General Purpose 2",
  186. #"0x32 *General Purpose 3",
  187. #"0x33 *General Purpose 4",
  188. #"0x34 *(Undefined)",
  189. #"0x35 *(Undefined)",
  190. #"0x36 *(Undefined)",
  191. #"0x37 *(Undefined)",
  192. #"0x38 *(Undefined)",
  193. #"0x39 *(Undefined)",
  194. #"0x3A *(Undefined)",
  195. #"0x3B *(Undefined)",
  196. #"0x3C *(Undefined)",
  197. #"0x3D *(Undefined)",
  198. #"0x3E *(Undefined)",
  199. #"0x3F *(Undefined)",
  200. #"0x40 Damper On/Off", # <63 off, >64 on
  201. #"0x41 Portamento On/Off", # <63 off, >64 on
  202. #"0x42 Sostenuto On/Off", # <63 off, >64 on
  203. #"0x43 Soft Pedal On/Off", # <63 off, >64 on
  204. #"0x44 Legato Footswitch", # <63 Normal, >64 Legato
  205. #"0x45 Hold 2", # <63 off, >64 on
  206. "0x46 Control 1 [Variation]",
  207. "0x47 Control 2 [Timbre]",
  208. "0x48 Control 3 [Release]",
  209. "0x49 Control 4 [Attack]",
  210. "0x4A Control 5 [Brightness]",
  211. "0x4B Control 6 [Decay]",
  212. "0x4C Control 7 [Vib Rate]",
  213. "0x4D Control 8 [Vib Depth]",
  214. "0x4E Control 9 [Vib Delay]",
  215. "0x4F Control 10 [Undefined]",
  216. "0x50 General Purpose 5",
  217. "0x51 General Purpose 6",
  218. "0x52 General Purpose 7",
  219. "0x53 General Purpose 8",
  220. "0x54 Portamento Control",
  221. "0x5B FX 1 Depth [Reverb]",
  222. "0x5C FX 2 Depth [Tremolo]",
  223. "0x5D FX 3 Depth [Chorus]",
  224. "0x5E FX 4 Depth [Detune]",
  225. "0x5F FX 5 Depth [Phaser]"
  226. )
  227. # ------------------------------------------------------------------------------------------------------------
  228. # Default Plugin Folders
  229. if WINDOWS:
  230. splitter = ";"
  231. APPDATA = os.getenv("APPDATA")
  232. PROGRAMFILES = os.getenv("PROGRAMFILES")
  233. PROGRAMFILESx86 = os.getenv("PROGRAMFILES(x86)")
  234. COMMONPROGRAMFILES = os.getenv("COMMONPROGRAMFILES")
  235. # Small integrity tests
  236. if not APPDATA:
  237. print("APPDATA variable not set, cannot continue")
  238. sys.exit(1)
  239. if not PROGRAMFILES:
  240. print("PROGRAMFILES variable not set, cannot continue")
  241. sys.exit(1)
  242. if not COMMONPROGRAMFILES:
  243. print("COMMONPROGRAMFILES variable not set, cannot continue")
  244. sys.exit(1)
  245. DEFAULT_LADSPA_PATH = ";".join((os.path.join(APPDATA, "LADSPA"),
  246. os.path.join(PROGRAMFILES, "LADSPA")))
  247. DEFAULT_DSSI_PATH = ";".join((os.path.join(APPDATA, "DSSI"),
  248. os.path.join(PROGRAMFILES, "DSSI")))
  249. DEFAULT_LV2_PATH = ";".join((os.path.join(APPDATA, "LV2"),
  250. os.path.join(COMMONPROGRAMFILES, "LV2")))
  251. DEFAULT_VST_PATH = ";".join((os.path.join(PROGRAMFILES, "VstPlugins"),
  252. os.path.join(PROGRAMFILES, "Steinberg", "VstPlugins")))
  253. DEFAULT_GIG_PATH = ";".join((os.path.join(APPDATA, "GIG"),))
  254. DEFAULT_SF2_PATH = ";".join((os.path.join(APPDATA, "SF2"),))
  255. DEFAULT_SFZ_PATH = ";".join((os.path.join(APPDATA, "SFZ"),))
  256. if PROGRAMFILESx86:
  257. DEFAULT_LADSPA_PATH += ";"+os.path.join(PROGRAMFILESx86, "LADSPA")
  258. DEFAULT_DSSI_PATH += ";"+os.path.join(PROGRAMFILESx86, "DSSI")
  259. DEFAULT_VST_PATH += ";"+os.path.join(PROGRAMFILESx86, "VstPlugins")
  260. DEFAULT_VST_PATH += ";"+os.path.join(PROGRAMFILESx86, "Steinberg", "VstPlugins")
  261. elif HAIKU:
  262. splitter = ":"
  263. DEFAULT_LADSPA_PATH = ":".join((os.path.join(HOME, ".ladspa"),
  264. os.path.join("/", "boot", "common", "add-ons", "ladspa")))
  265. DEFAULT_DSSI_PATH = ":".join((os.path.join(HOME, ".dssi"),
  266. os.path.join("/", "boot", "common", "add-ons", "dssi")))
  267. DEFAULT_LV2_PATH = ":".join((os.path.join(HOME, ".lv2"),
  268. os.path.join("/", "boot", "common", "add-ons", "lv2")))
  269. DEFAULT_VST_PATH = ":".join((os.path.join(HOME, ".vst"),
  270. os.path.join("/", "boot", "common", "add-ons", "vst")))
  271. # TODO
  272. DEFAULT_GIG_PATH = ""
  273. DEFAULT_SF2_PATH = ""
  274. DEFAULT_SFZ_PATH = ""
  275. elif MACOS:
  276. splitter = ":"
  277. DEFAULT_LADSPA_PATH = ":".join((os.path.join(HOME, "Library", "Audio", "Plug-Ins", "LADSPA"),
  278. os.path.join("/", "Library", "Audio", "Plug-Ins", "LADSPA")))
  279. DEFAULT_DSSI_PATH = ":".join((os.path.join(HOME, "Library", "Audio", "Plug-Ins", "DSSI"),
  280. os.path.join("/", "Library", "Audio", "Plug-Ins", "DSSI")))
  281. DEFAULT_LV2_PATH = ":".join((os.path.join(HOME, "Library", "Audio", "Plug-Ins", "LV2"),
  282. os.path.join("/", "Library", "Audio", "Plug-Ins", "LV2")))
  283. DEFAULT_VST_PATH = ":".join((os.path.join(HOME, "Library", "Audio", "Plug-Ins", "VST"),
  284. os.path.join("/", "Library", "Audio", "Plug-Ins", "VST")))
  285. # TODO
  286. DEFAULT_GIG_PATH = ""
  287. DEFAULT_SF2_PATH = ""
  288. DEFAULT_SFZ_PATH = ""
  289. else:
  290. splitter = ":"
  291. DEFAULT_LADSPA_PATH = ":".join((os.path.join(HOME, ".ladspa"),
  292. os.path.join("/", "usr", "lib", "ladspa"),
  293. os.path.join("/", "usr", "local", "lib", "ladspa")))
  294. DEFAULT_DSSI_PATH = ":".join((os.path.join(HOME, ".dssi"),
  295. os.path.join("/", "usr", "lib", "dssi"),
  296. os.path.join("/", "usr", "local", "lib", "dssi")))
  297. DEFAULT_LV2_PATH = ":".join((os.path.join(HOME, ".lv2"),
  298. os.path.join("/", "usr", "lib", "lv2"),
  299. os.path.join("/", "usr", "local", "lib", "lv2")))
  300. DEFAULT_VST_PATH = ":".join((os.path.join(HOME, ".vst"),
  301. os.path.join("/", "usr", "lib", "vst"),
  302. os.path.join("/", "usr", "local", "lib", "vst")))
  303. DEFAULT_GIG_PATH = ":".join((os.path.join(HOME, ".sounds"),
  304. os.path.join("/", "usr", "share", "sounds", "gig")))
  305. DEFAULT_SF2_PATH = ":".join((os.path.join(HOME, ".sounds"),
  306. os.path.join("/", "usr", "share", "sounds", "sf2")))
  307. DEFAULT_SFZ_PATH = ":".join((os.path.join(HOME, ".sounds"),
  308. os.path.join("/", "usr", "share", "sounds", "sfz")))
  309. # ------------------------------------------------------------------------------------------------------------
  310. # Default Plugin Folders (set)
  311. readEnvVars = True
  312. if WINDOWS:
  313. # Check if running Wine. If yes, ignore env vars
  314. from winreg import ConnectRegistry, OpenKey, CloseKey, HKEY_CURRENT_USER
  315. reg = ConnectRegistry(None, HKEY_CURRENT_USER)
  316. try:
  317. key = OpenKey(reg, r"SOFTWARE\Wine")
  318. CloseKey(key)
  319. readEnvVars = False
  320. except:
  321. pass
  322. CloseKey(reg)
  323. del reg
  324. if readEnvVars:
  325. Carla.LADSPA_PATH = os.getenv("LADSPA_PATH", DEFAULT_LADSPA_PATH).split(splitter)
  326. Carla.DSSI_PATH = os.getenv("DSSI_PATH", DEFAULT_DSSI_PATH).split(splitter)
  327. Carla.LV2_PATH = os.getenv("LV2_PATH", DEFAULT_LV2_PATH).split(splitter)
  328. Carla.VST_PATH = os.getenv("VST_PATH", DEFAULT_VST_PATH).split(splitter)
  329. Carla.GIG_PATH = os.getenv("GIG_PATH", DEFAULT_GIG_PATH).split(splitter)
  330. Carla.SF2_PATH = os.getenv("SF2_PATH", DEFAULT_SF2_PATH).split(splitter)
  331. Carla.SFZ_PATH = os.getenv("SFZ_PATH", DEFAULT_SFZ_PATH).split(splitter)
  332. if haveLRDF:
  333. LADSPA_RDF_PATH_env = os.getenv("LADSPA_RDF_PATH")
  334. if LADSPA_RDF_PATH_env:
  335. ladspa_rdf.set_rdf_path(LADSPA_RDF_PATH_env.split(splitter))
  336. del LADSPA_RDF_PATH_env
  337. else:
  338. Carla.LADSPA_PATH = DEFAULT_LADSPA_PATH.split(splitter)
  339. Carla.DSSI_PATH = DEFAULT_DSSI_PATH.split(splitter)
  340. Carla.LV2_PATH = DEFAULT_LV2_PATH.split(splitter)
  341. Carla.VST_PATH = DEFAULT_VST_PATH.split(splitter)
  342. Carla.GIG_PATH = DEFAULT_GIG_PATH.split(splitter)
  343. Carla.SF2_PATH = DEFAULT_SF2_PATH.split(splitter)
  344. Carla.SFZ_PATH = DEFAULT_SFZ_PATH.split(splitter)
  345. # ------------------------------------------------------------------------------------------------------------
  346. # Search for Carla library and tools
  347. global carla_library_path
  348. carla_library_path = ""
  349. carla_discovery_native = ""
  350. carla_discovery_posix32 = ""
  351. carla_discovery_posix64 = ""
  352. carla_discovery_win32 = ""
  353. carla_discovery_win64 = ""
  354. carla_bridge_native = ""
  355. carla_bridge_posix32 = ""
  356. carla_bridge_posix64 = ""
  357. carla_bridge_win32 = ""
  358. carla_bridge_win64 = ""
  359. carla_bridge_lv2_gtk2 = ""
  360. carla_bridge_lv2_gtk3 = ""
  361. carla_bridge_lv2_qt4 = ""
  362. carla_bridge_lv2_qt5 = ""
  363. carla_bridge_lv2_cocoa = ""
  364. carla_bridge_lv2_windows = ""
  365. carla_bridge_lv2_x11 = ""
  366. carla_bridge_vst_cocoa = ""
  367. carla_bridge_vst_hwnd = ""
  368. carla_bridge_vst_x11 = ""
  369. if WINDOWS:
  370. carla_libname = "libcarla_standalone.dll"
  371. elif MACOS:
  372. carla_libname = "libcarla_standalone.dylib"
  373. else:
  374. carla_libname = "libcarla_standalone.so"
  375. CWD = sys.path[0]
  376. # make it work with cxfreeze
  377. if CWD.endswith("%scarla" % os.sep):
  378. CWD = CWD.rsplit("%scarla" % os.sep, 1)[0]
  379. elif CWD.endswith("carla.exe"):
  380. CWD = CWD.rsplit("carla.exe", 1)[0]
  381. # find carla_library_path
  382. if os.path.exists(os.path.join(CWD, "backend", carla_libname)):
  383. carla_library_path = os.path.join(CWD, "backend", carla_libname)
  384. else:
  385. if WINDOWS:
  386. CARLA_PATH = (os.path.join(PROGRAMFILES, "Carla"),)
  387. elif MACOS:
  388. CARLA_PATH = ("/opt/local/lib", "/usr/local/lib/", "/usr/lib")
  389. else:
  390. CARLA_PATH = ("/usr/local/lib/", "/usr/lib")
  391. for path in CARLA_PATH:
  392. if os.path.exists(os.path.join(path, "carla", carla_libname)):
  393. carla_library_path = os.path.join(path, "carla", carla_libname)
  394. break
  395. # find tool
  396. def findTool(tdir, tname):
  397. if os.path.exists(os.path.join(CWD, tdir, tname)):
  398. return os.path.join(CWD, tdir, tname)
  399. for p in PATH:
  400. if os.path.exists(os.path.join(p, tname)):
  401. return os.path.join(p, tname)
  402. return ""
  403. # find windows tools
  404. carla_discovery_win32 = findTool("discovery", "carla-discovery-win32.exe")
  405. carla_discovery_win64 = findTool("discovery", "carla-discovery-win64.exe")
  406. carla_bridge_win32 = findTool("bridges", "carla-bridge-win32.exe")
  407. carla_bridge_win64 = findTool("bridges", "carla-bridge-win64.exe")
  408. # find native and posix tools
  409. if not WINDOWS:
  410. carla_discovery_native = findTool("discovery", "carla-discovery-native")
  411. carla_discovery_posix32 = findTool("discovery", "carla-discovery-posix32")
  412. carla_discovery_posix64 = findTool("discovery", "carla-discovery-posix64")
  413. carla_bridge_native = findTool("bridges", "carla-bridge-native")
  414. carla_bridge_posix32 = findTool("bridges", "carla-bridge-posix32")
  415. carla_bridge_posix64 = findTool("bridges", "carla-bridge-posix64")
  416. # find windows only tools
  417. if WINDOWS:
  418. carla_bridge_lv2_windows = findTool("bridges", "carla-bridge-lv2-windows.exe")
  419. carla_bridge_vst_hwnd = findTool("bridges", "carla-bridge-vst-hwnd.exe")
  420. # find mac os only tools
  421. elif MACOS:
  422. carla_bridge_lv2_cocoa = findTool("bridges", "carla-bridge-lv2-cocoa")
  423. carla_bridge_vst_cocoa = findTool("bridges", "carla-bridge-vst-cocoa")
  424. # find generic tools
  425. else:
  426. carla_bridge_lv2_gtk2 = findTool("bridges", "carla-bridge-lv2-gtk2")
  427. carla_bridge_lv2_gtk3 = findTool("bridges", "carla-bridge-lv2-gtk3")
  428. carla_bridge_lv2_qt4 = findTool("bridges", "carla-bridge-lv2-qt4")
  429. carla_bridge_lv2_qt5 = findTool("bridges", "carla-bridge-lv2-qt5")
  430. # find linux only tools
  431. if LINUX:
  432. carla_bridge_lv2_x11 = os.path.join("bridges", "carla-bridge-lv2-x11")
  433. carla_bridge_vst_x11 = os.path.join("bridges", "carla-bridge-vst-x11")
  434. # ------------------------------------------------------------------------------------------------------------
  435. # Convert a ctypes c_char_p into a python string
  436. def cString(value):
  437. if not value:
  438. return ""
  439. if isinstance(value, str):
  440. return value
  441. return value.decode("utf-8", errors="ignore")
  442. # ------------------------------------------------------------------------------------------------------------
  443. # Check if a value is a number (float support)
  444. def isNumber(value):
  445. try:
  446. float(value)
  447. return True
  448. except:
  449. return False
  450. # ------------------------------------------------------------------------------------------------------------
  451. # Convert a value to a list
  452. def toList(value):
  453. if value is None:
  454. return []
  455. elif not isinstance(value, list):
  456. return [value]
  457. else:
  458. return value
  459. # ------------------------------------------------------------------------------------------------------------
  460. # Get Icon from user theme, using our own as backup (Oxygen)
  461. def getIcon(icon, size=16):
  462. return QIcon.fromTheme(icon, QIcon(":/%ix%i/%s.png" % (size, size, icon)))
  463. # ------------------------------------------------------------------------------------------------------------
  464. # Signal handler
  465. def signalHandler(sig, frame):
  466. if Carla.gui is None:
  467. return
  468. if sig in (SIGINT, SIGTERM):
  469. Carla.gui.emit(SIGNAL("SIGTERM()"))
  470. elif sig == SIGUSR1:
  471. Carla.gui.emit(SIGNAL("SIGUSR1()"))
  472. def setUpSignals():
  473. if not haveSignal:
  474. return
  475. signal(SIGINT, signalHandler)
  476. signal(SIGTERM, signalHandler)
  477. signal(SIGUSR1, signalHandler)
  478. # ------------------------------------------------------------------------------------------------------------
  479. # QLineEdit and QPushButton combo
  480. def getAndSetPath(self_, currentPath, lineEdit):
  481. newPath = QFileDialog.getExistingDirectory(self_, self_.tr("Set Path"), currentPath, QFileDialog.ShowDirsOnly)
  482. if newPath:
  483. lineEdit.setText(newPath)
  484. return newPath
  485. # ------------------------------------------------------------------------------------------------------------
  486. # Custom MessageBox
  487. def CustomMessageBox(self_, icon, title, text, extraText="", buttons=QMessageBox.Yes|QMessageBox.No, defButton=QMessageBox.No):
  488. msgBox = QMessageBox(self_)
  489. msgBox.setIcon(icon)
  490. msgBox.setWindowTitle(title)
  491. msgBox.setText(text)
  492. msgBox.setInformativeText(extraText)
  493. msgBox.setStandardButtons(buttons)
  494. msgBox.setDefaultButton(defButton)
  495. return msgBox.exec_()
  496. # ------------------------------------------------------------------------------------------------------------
  497. # Plugin Query (helper functions)
  498. def findBinaries(bPATH, OS):
  499. binaries = []
  500. if OS == "WINDOWS":
  501. extensions = (".dll",)
  502. elif OS == "MACOS":
  503. extensions = (".dylib", ".so")
  504. else:
  505. extensions = (".so", ".sO", ".SO", ".So")
  506. for root, dirs, files in os.walk(bPATH):
  507. for name in [name for name in files if name.endswith(extensions)]:
  508. binaries.append(os.path.join(root, name))
  509. return binaries
  510. def findLV2Bundles(bPATH):
  511. bundles = []
  512. for root, dirs, files in os.walk(bPATH):
  513. if os.path.exists(os.path.join(root, "manifest.ttl")):
  514. bundles.append(root)
  515. return bundles
  516. def findSoundKits(bPATH, stype):
  517. soundfonts = []
  518. if stype == "gig":
  519. extensions = (".gig", ".giG", ".gIG", ".GIG", ".GIg", ".Gig") if not WINDOWS else (".gig",)
  520. elif stype == "sf2":
  521. extensions = (".sf2", ".sF2", ".SF2", ".Sf2") if not WINDOWS else (".sf2",)
  522. elif stype == "sfz":
  523. extensions = (".sfz", ".sfZ", ".sFZ", ".SFZ", ".SFz", ".Sfz") if not WINDOWS else (".sfz",)
  524. else:
  525. return []
  526. for root, dirs, files in os.walk(bPATH):
  527. for name in [name for name in files if name.endswith(extensions)]:
  528. soundfonts.append(os.path.join(root, name))
  529. return soundfonts
  530. def findDSSIGUI(filename, name, label):
  531. pluginDir = filename.rsplit(".", 1)[0]
  532. shortName = os.path.basename(pluginDir)
  533. guiFilename = ""
  534. checkName = name.replace(" ", "_")
  535. checkLabel = label
  536. checkSName = shortName
  537. if checkName[-1] != "_": checkName += "_"
  538. if checkLabel[-1] != "_": checkLabel += "_"
  539. if checkSName[-1] != "_": checkSName += "_"
  540. for root, dirs, files in os.walk(pluginDir):
  541. guiFiles = files
  542. break
  543. else:
  544. guiFiles = []
  545. for guiFile in guiFiles:
  546. if guiFile.startswith(checkName) or guiFile.startswith(checkLabel) or guiFile.startswith(checkSName):
  547. guiFilename = os.path.join(pluginDir, guiFile)
  548. break
  549. return guiFilename
  550. # ------------------------------------------------------------------------------------------------------------
  551. # Plugin Query
  552. PLUGIN_QUERY_API_VERSION = 1
  553. PyPluginInfo = {
  554. 'API': PLUGIN_QUERY_API_VERSION,
  555. 'build': BINARY_NONE,
  556. 'type': PLUGIN_NONE,
  557. 'hints': 0x0,
  558. 'binary': "",
  559. 'name': "",
  560. 'label': "",
  561. 'maker': "",
  562. 'copyright': "",
  563. 'uniqueId': 0,
  564. 'audio.ins': 0,
  565. 'audio.outs': 0,
  566. 'audio.total': 0,
  567. 'midi.ins': 0,
  568. 'midi.outs': 0,
  569. 'midi.total': 0,
  570. 'parameters.ins': 0,
  571. 'parameters.outs': 0,
  572. 'parameters.total': 0,
  573. 'programs.total': 0
  574. }
  575. def runCarlaDiscovery(itype, stype, filename, tool, isWine=False):
  576. fakeLabel = os.path.basename(filename).rsplit(".", 1)[0]
  577. plugins = []
  578. command = []
  579. if LINUX or MACOS:
  580. command.append("env")
  581. command.append("LANG=C")
  582. if isWine:
  583. command.append("WINEDEBUG=-all")
  584. command.append(tool)
  585. command.append(stype)
  586. command.append(filename)
  587. Ps = Popen(command, stdout=PIPE)
  588. Ps.wait()
  589. output = Ps.stdout.read().decode("utf-8", errors="ignore").split("\n")
  590. pinfo = None
  591. for line in output:
  592. line = line.strip()
  593. if line == "carla-discovery::init::-----------":
  594. pinfo = deepcopy(PyPluginInfo)
  595. pinfo['type'] = itype
  596. pinfo['binary'] = filename
  597. elif line == "carla-discovery::end::------------":
  598. if pinfo != None:
  599. plugins.append(pinfo)
  600. pinfo = None
  601. elif line == "Segmentation fault":
  602. print("carla-discovery::crash::%s crashed during discovery" % filename)
  603. elif line.startswith("err:module:import_dll Library"):
  604. print(line)
  605. elif line.startswith("carla-discovery::error::"):
  606. print("%s - %s" % (line, filename))
  607. elif line.startswith("carla-discovery::"):
  608. if pinfo == None:
  609. continue
  610. prop, value = line.replace("carla-discovery::", "").split("::", 1)
  611. if prop == "name":
  612. pinfo['name'] = value if value else fakeLabel
  613. elif prop in ("label", "uri"):
  614. pinfo['label'] = value if value else fakeLabel
  615. elif prop == "maker":
  616. pinfo['maker'] = value
  617. elif prop == "copyright":
  618. pinfo['copyright'] = value
  619. elif prop == "uniqueId":
  620. if value.isdigit(): pinfo['uniqueId'] = int(value)
  621. elif prop == "hints":
  622. if value.isdigit(): pinfo['hints'] = int(value)
  623. elif prop == "audio.ins":
  624. if value.isdigit(): pinfo['audio.ins'] = int(value)
  625. elif prop == "audio.outs":
  626. if value.isdigit(): pinfo['audio.outs'] = int(value)
  627. elif prop == "audio.total":
  628. if value.isdigit(): pinfo['audio.total'] = int(value)
  629. elif prop == "midi.ins":
  630. if value.isdigit(): pinfo['midi.ins'] = int(value)
  631. elif prop == "midi.outs":
  632. if value.isdigit(): pinfo['midi.outs'] = int(value)
  633. elif prop == "midi.total":
  634. if value.isdigit(): pinfo['midi.total'] = int(value)
  635. elif prop == "parameters.ins":
  636. if value.isdigit(): pinfo['parameters.ins'] = int(value)
  637. elif prop == "parameters.outs":
  638. if value.isdigit(): pinfo['parameters.outs'] = int(value)
  639. elif prop == "parameters.total":
  640. if value.isdigit(): pinfo['parameters.total'] = int(value)
  641. elif prop == "programs.total":
  642. if value.isdigit(): pinfo['programs.total'] = int(value)
  643. elif prop == "build":
  644. if value.isdigit(): pinfo['build'] = int(value)
  645. # Additional checks
  646. for pinfo in plugins:
  647. if itype == PLUGIN_DSSI:
  648. if findDSSIGUI(pinfo['binary'], pinfo['name'], pinfo['label']):
  649. pinfo['hints'] |= PLUGIN_HAS_GUI
  650. return plugins
  651. def checkPluginInternal(desc):
  652. plugins = []
  653. pinfo = deepcopy(PyPluginInfo)
  654. pinfo['build'] = BINARY_NATIVE
  655. pinfo['type'] = PLUGIN_INTERNAL
  656. pinfo['hints'] = int(desc['hints'])
  657. pinfo['name'] = cString(desc['name'])
  658. pinfo['label'] = cString(desc['label'])
  659. pinfo['maker'] = cString(desc['maker'])
  660. pinfo['copyright'] = cString(desc['copyright'])
  661. pinfo['audio.ins'] = int(desc['audioIns'])
  662. pinfo['audio.outs'] = int(desc['audioOuts'])
  663. pinfo['audio.total'] = pinfo['audio.ins'] + pinfo['audio.outs']
  664. pinfo['midi.ins'] = int(desc['midiIns'])
  665. pinfo['midi.outs'] = int(desc['midiOuts'])
  666. pinfo['midi.total'] = pinfo['midi.ins'] + pinfo['midi.outs']
  667. pinfo['parameters.ins'] = int(desc['parameterIns'])
  668. pinfo['parameters.outs'] = int(desc['parameterOuts'])
  669. pinfo['parameters.total'] = pinfo['parameters.ins'] + pinfo['parameters.outs']
  670. plugins.append(pinfo)
  671. return plugins
  672. def checkPluginLADSPA(filename, tool, isWine=False):
  673. return runCarlaDiscovery(PLUGIN_LADSPA, "LADSPA", filename, tool, isWine)
  674. def checkPluginDSSI(filename, tool, isWine=False):
  675. return runCarlaDiscovery(PLUGIN_DSSI, "DSSI", filename, tool, isWine)
  676. def checkPluginLV2(filename, tool, isWine=False):
  677. return runCarlaDiscovery(PLUGIN_LV2, "LV2", filename, tool, isWine)
  678. def checkPluginVST(filename, tool, isWine=False):
  679. return runCarlaDiscovery(PLUGIN_VST, "VST", filename, tool, isWine)
  680. def checkPluginGIG(filename, tool):
  681. return runCarlaDiscovery(PLUGIN_GIG, "GIG", filename, tool)
  682. def checkPluginSF2(filename, tool):
  683. return runCarlaDiscovery(PLUGIN_SF2, "SF2", filename, tool)
  684. def checkPluginSFZ(filename, tool):
  685. return runCarlaDiscovery(PLUGIN_SFZ, "SFZ", filename, tool)
  686. # ------------------------------------------------------------------------------------------------------------
  687. # Carla About dialog
  688. class CarlaAboutW(QDialog):
  689. def __init__(self, parent):
  690. QDialog.__init__(self, parent)
  691. self.ui = ui_carla_about.Ui_CarlaAboutW()
  692. self.ui.setupUi(self)
  693. if Carla.isControl:
  694. extraInfo = " - <b>%s</b>" % self.tr("OSC Bridge Version")
  695. else:
  696. extraInfo = ""
  697. self.ui.l_about.setText(self.tr(""
  698. "<br>Version %s"
  699. "<br>Carla is a Multi-Plugin Host for JACK%s.<br>"
  700. "<br>Copyright (C) 2011-2013 falkTX<br>"
  701. "" % (VERSION, extraInfo)))
  702. if Carla.isControl:
  703. self.ui.l_extended.hide()
  704. self.ui.tabWidget.removeTab(1)
  705. self.ui.tabWidget.removeTab(1)
  706. else:
  707. self.ui.l_extended.setText(cString(Carla.host.get_extended_license_text()))
  708. self.ui.le_osc_url.setText(cString(Carla.host.get_host_osc_url()) if Carla.host.is_engine_running() else self.tr("(Engine not running)"))
  709. self.ui.l_osc_cmds.setText(""
  710. " /set_active <i-value>\n"
  711. " /set_drywet <f-value>\n"
  712. " /set_volume <f-value>\n"
  713. " /set_balance_left <f-value>\n"
  714. " /set_balance_right <f-value>\n"
  715. " /set_panning <f-value>\n"
  716. " /set_parameter_value <i-index> <f-value>\n"
  717. " /set_parameter_midi_cc <i-index> <i-cc>\n"
  718. " /set_parameter_midi_channel <i-index> <i-channel>\n"
  719. " /set_program <i-index>\n"
  720. " /set_midi_program <i-index>\n"
  721. " /note_on <i-note> <i-velo>\n"
  722. " /note_off <i-note>\n"
  723. )
  724. self.ui.l_example.setText("/Carla/2/set_parameter_value 5 1.0")
  725. self.ui.l_example_help.setText("<i>(as in this example, \"2\" is the plugin number and \"5\" the parameter)</i>")
  726. self.ui.l_ladspa.setText(self.tr("Everything! (Including LRDF)"))
  727. self.ui.l_dssi.setText(self.tr("Everything! (Including CustomData/Chunks)"))
  728. self.ui.l_lv2.setText(self.tr("About 95&#37; complete (using custom extensions).<br/>"
  729. "Implemented Feature/Extensions:"
  730. "<ul>"
  731. "<li>http://lv2plug.in/ns/ext/atom</li>"
  732. "<li>http://lv2plug.in/ns/ext/buf-size</li>"
  733. "<li>http://lv2plug.in/ns/ext/data-access</li>"
  734. #"<li>http://lv2plug.in/ns/ext/dynmanifest</li>"
  735. "<li>http://lv2plug.in/ns/ext/event</li>"
  736. "<li>http://lv2plug.in/ns/ext/instance-access</li>"
  737. "<li>http://lv2plug.in/ns/ext/log</li>"
  738. "<li>http://lv2plug.in/ns/ext/midi</li>"
  739. "<li>http://lv2plug.in/ns/ext/options</li>"
  740. #"<li>http://lv2plug.in/ns/ext/parameters</li>"
  741. "<li>http://lv2plug.in/ns/ext/patch</li>"
  742. #"<li>http://lv2plug.in/ns/ext/port-groups</li>"
  743. "<li>http://lv2plug.in/ns/ext/port-props</li>"
  744. #"<li>http://lv2plug.in/ns/ext/presets</li>"
  745. "<li>http://lv2plug.in/ns/ext/state</li>"
  746. "<li>http://lv2plug.in/ns/ext/time</li>"
  747. "<li>http://lv2plug.in/ns/ext/uri-map</li>"
  748. "<li>http://lv2plug.in/ns/ext/urid</li>"
  749. "<li>http://lv2plug.in/ns/ext/worker</li>"
  750. "<li>http://lv2plug.in/ns/extensions/ui</li>"
  751. "<li>http://lv2plug.in/ns/extensions/units</li>"
  752. "<li>http://kxstudio.sf.net/ns/lv2ext/external-ui</li>"
  753. "<li>http://kxstudio.sf.net/ns/lv2ext/programs</li>"
  754. "<li>http://kxstudio.sf.net/ns/lv2ext/rtmempool</li>"
  755. "<li>http://ll-plugins.nongnu.org/lv2/ext/midimap</li>"
  756. "<li>http://ll-plugins.nongnu.org/lv2/ext/miditype</li>"
  757. "</ul>"))
  758. self.ui.l_vst.setText(self.tr("<p>About 85&#37; complete (missing vst bank/presets and some minor stuff)</p>"))
  759. #TODO
  760. self.ui.l_lv2.setText(self.tr("Not enabled for now"))
  761. def done(self, r):
  762. QDialog.done(self, r)
  763. self.close()
  764. # ------------------------------------------------------------------------------------------------------------
  765. # Plugin Parameter
  766. class PluginParameter(QWidget):
  767. def __init__(self, parent, pInfo, pluginId, tabIndex):
  768. QWidget.__init__(self, parent)
  769. self.ui = ui_carla_parameter.Ui_PluginParameter()
  770. self.ui.setupUi(self)
  771. pType = pInfo['type']
  772. pHints = pInfo['hints']
  773. self.fMidiControl = -1
  774. self.fMidiChannel = 1
  775. self.fParameterId = pInfo['index']
  776. self.fPluginId = pluginId
  777. self.fTabIndex = tabIndex
  778. self.ui.label.setText(pInfo['name'])
  779. self.ui.widget.setName(pInfo['name'])
  780. if pType == PARAMETER_INPUT:
  781. self.ui.widget.setMinimum(pInfo['minimum'])
  782. self.ui.widget.setMaximum(pInfo['maximum'])
  783. self.ui.widget.setDefault(pInfo['default'])
  784. self.ui.widget.setValue(pInfo['current'], False)
  785. self.ui.widget.setLabel(pInfo['unit'])
  786. self.ui.widget.setStep(pInfo['step'])
  787. self.ui.widget.setStepSmall(pInfo['stepSmall'])
  788. self.ui.widget.setStepLarge(pInfo['stepLarge'])
  789. self.ui.widget.setScalePoints(pInfo['scalePoints'], bool(pHints & PARAMETER_USES_SCALEPOINTS))
  790. if not pHints & PARAMETER_IS_ENABLED:
  791. self.ui.widget.setReadOnly(True)
  792. self.ui.sb_control.setEnabled(False)
  793. self.ui.sb_channel.setEnabled(False)
  794. elif not pHints & PARAMETER_IS_AUTOMABLE:
  795. self.ui.sb_control.setEnabled(False)
  796. self.ui.sb_channel.setEnabled(False)
  797. elif pType == PARAMETER_OUTPUT:
  798. self.ui.widget.setMinimum(pInfo['minimum'])
  799. self.ui.widget.setMaximum(pInfo['maximum'])
  800. self.ui.widget.setValue(pInfo['current'], False)
  801. self.ui.widget.setLabel(pInfo['unit'])
  802. self.ui.widget.setReadOnly(True)
  803. if not pHints & PARAMETER_IS_AUTOMABLE:
  804. self.ui.sb_control.setEnabled(False)
  805. self.ui.sb_channel.setEnabled(False)
  806. else:
  807. self.ui.widget.setVisible(False)
  808. self.ui.sb_control.setVisible(False)
  809. self.ui.sb_channel.setVisible(False)
  810. if pHints & PARAMETER_USES_CUSTOM_TEXT:
  811. self.ui.widget.setTextCallback(self._textCallBack)
  812. self.setMidiControl(pInfo['midiCC'])
  813. self.setMidiChannel(pInfo['midiChannel'])
  814. self.connect(self.ui.sb_control, SIGNAL("customContextMenuRequested(QPoint)"), SLOT("slot_controlSpinboxCustomMenu()"))
  815. self.connect(self.ui.sb_control, SIGNAL("valueChanged(int)"), SLOT("slot_controlSpinboxChanged(int)"))
  816. self.connect(self.ui.sb_channel, SIGNAL("valueChanged(int)"), SLOT("slot_channelSpinboxChanged(int)"))
  817. self.connect(self.ui.widget, SIGNAL("valueChanged(double)"), SLOT("slot_widgetValueChanged(double)"))
  818. self.ui.widget.updateAll()
  819. def setDefault(self, value):
  820. self.ui.widget.setDefault(value)
  821. def setValue(self, value, send=True):
  822. self.ui.widget.setValue(value, send)
  823. def setMidiControl(self, control):
  824. self.fMidiControl = control
  825. self.ui.sb_control.blockSignals(True)
  826. self.ui.sb_control.setValue(control)
  827. self.ui.sb_control.blockSignals(False)
  828. def setMidiChannel(self, channel):
  829. self.fMidiChannel = channel
  830. self.ui.sb_channel.blockSignals(True)
  831. self.ui.sb_channel.setValue(channel)
  832. self.ui.sb_channel.blockSignals(False)
  833. def setLabelWidth(self, width):
  834. self.ui.label.setMinimumWidth(width)
  835. self.ui.label.setMaximumWidth(width)
  836. def tabIndex(self):
  837. return self.fTabIndex
  838. @pyqtSlot()
  839. def slot_controlSpinboxCustomMenu(self):
  840. menu = QMenu(self)
  841. for cc in MIDI_CC_LIST:
  842. action = menu.addAction(cc)
  843. if int(cc.split(" ")[0], 16) == self.fMidiControl:
  844. action.setCheckable(True)
  845. action.setChecked(True)
  846. actSel = menu.exec_(QCursor.pos())
  847. if actSel:
  848. selControlStr = actSel.text()
  849. selControl = int(selControlStr.split(" ")[0], 16)
  850. self.ui.sb_control.setValue(selControl)
  851. @pyqtSlot(int)
  852. def slot_controlSpinboxChanged(self, control):
  853. if self.fMidiControl != control:
  854. self.emit(SIGNAL("midiControlChanged(int, int)"), self.fParameterId, control)
  855. self.fMidiControl = control
  856. @pyqtSlot(int)
  857. def slot_channelSpinboxChanged(self, channel):
  858. if self.fMidiChannel != channel:
  859. self.emit(SIGNAL("midiChannelChanged(int, int)"), self.fParameterId, channel)
  860. self.fMidiChannel = channel
  861. @pyqtSlot(float)
  862. def slot_widgetValueChanged(self, value):
  863. self.emit(SIGNAL("valueChanged(int, double)"), self.fParameterId, value)
  864. def _textCallBack(self):
  865. return cString(Carla.host.get_parameter_text(self.fPluginId, self.fParameterId))
  866. # ------------------------------------------------------------------------------------------------------------
  867. # Plugin Editor (Built-in)
  868. class PluginEdit(QDialog):
  869. def __init__(self, parent, pluginId):
  870. QDialog.__init__(self, Carla.gui)
  871. self.ui = ui_carla_edit.Ui_PluginEdit()
  872. self.ui.setupUi(self)
  873. self.fGeometry = QByteArray()
  874. self.fPluginId = pluginId
  875. self.fPuginInfo = None
  876. self.fRealParent = parent
  877. self.fCurrentProgram = -1
  878. self.fCurrentMidiProgram = -1
  879. self.fCurrentStateFilename = None
  880. self.fControlChannel = 0
  881. self.fParameterCount = 0
  882. self.fParameterList = [] # (type, id, widget)
  883. self.fParametersToUpdate = [] # (id, value)
  884. self.fTabIconOff = QIcon(":/bitmaps/led_off.png")
  885. self.fTabIconOn = QIcon(":/bitmaps/led_yellow.png")
  886. self.fTabIconCount = 0
  887. self.fTabIconTimers = []
  888. self.fScrollAreaSetup = False
  889. self.ui.dial_drywet.setPixmap(3)
  890. self.ui.dial_drywet.setLabel("Dry/Wet")
  891. self.ui.dial_vol.setPixmap(3)
  892. self.ui.dial_vol.setLabel("Volume")
  893. self.ui.dial_b_left.setPixmap(4)
  894. self.ui.dial_b_left.setLabel("L")
  895. self.ui.dial_b_right.setPixmap(4)
  896. self.ui.dial_b_right.setLabel("R")
  897. self.ui.dial_drywet.setCustomPaint(self.ui.dial_drywet.CUSTOM_PAINT_CARLA_WET)
  898. self.ui.dial_vol.setCustomPaint(self.ui.dial_vol.CUSTOM_PAINT_CARLA_VOL)
  899. self.ui.dial_b_left.setCustomPaint(self.ui.dial_b_left.CUSTOM_PAINT_CARLA_L)
  900. self.ui.dial_b_right.setCustomPaint(self.ui.dial_b_right.CUSTOM_PAINT_CARLA_R)
  901. self.ui.keyboard.setMode(self.ui.keyboard.HORIZONTAL)
  902. self.ui.keyboard.setOctaves(6)
  903. self.ui.sb_ctrl_channel.setValue(self.fControlChannel+1)
  904. self.ui.scrollArea.ensureVisible(self.ui.keyboard.width() / 5, 0)
  905. self.ui.scrollArea.setEnabled(False)
  906. self.ui.scrollArea.setVisible(False)
  907. if Carla.isLocal:
  908. self.connect(self.ui.b_save_state, SIGNAL("clicked()"), SLOT("slot_saveState()"))
  909. self.connect(self.ui.b_load_state, SIGNAL("clicked()"), SLOT("slot_loadState()"))
  910. else:
  911. self.ui.b_load_state.setEnabled(False)
  912. self.ui.b_save_state.setEnabled(False)
  913. self.connect(self.ui.ch_fixed_buffer, SIGNAL("clicked(bool)"), SLOT("slot_optionChanged(bool)"))
  914. self.connect(self.ui.ch_force_stereo, SIGNAL("clicked(bool)"), SLOT("slot_optionChanged(bool)"))
  915. self.connect(self.ui.ch_map_program_changes, SIGNAL("clicked(bool)"), SLOT("slot_optionChanged(bool)"))
  916. self.connect(self.ui.ch_use_chunks, SIGNAL("clicked(bool)"), SLOT("slot_optionChanged(bool)"))
  917. self.connect(self.ui.ch_send_control_changes, SIGNAL("clicked(bool)"), SLOT("slot_optionChanged(bool)"))
  918. self.connect(self.ui.ch_send_channel_pressure, SIGNAL("clicked(bool)"), SLOT("slot_optionChanged(bool)"))
  919. self.connect(self.ui.ch_send_note_aftertouch, SIGNAL("clicked(bool)"), SLOT("slot_optionChanged(bool)"))
  920. self.connect(self.ui.ch_send_pitchbend, SIGNAL("clicked(bool)"), SLOT("slot_optionChanged(bool)"))
  921. self.connect(self.ui.ch_send_all_sound_off, SIGNAL("clicked(bool)"), SLOT("slot_optionChanged(bool)"))
  922. self.connect(self.ui.dial_drywet, SIGNAL("valueChanged(int)"), SLOT("slot_dryWetChanged(int)"))
  923. self.connect(self.ui.dial_vol, SIGNAL("valueChanged(int)"), SLOT("slot_volumeChanged(int)"))
  924. self.connect(self.ui.dial_b_left, SIGNAL("valueChanged(int)"), SLOT("slot_balanceLeftChanged(int)"))
  925. self.connect(self.ui.dial_b_right, SIGNAL("valueChanged(int)"), SLOT("slot_balanceRightChanged(int)"))
  926. self.connect(self.ui.sb_ctrl_channel, SIGNAL("valueChanged(int)"), SLOT("slot_ctrlChannelChanged(int)"))
  927. self.connect(self.ui.dial_drywet, SIGNAL("customContextMenuRequested(QPoint)"), SLOT("slot_showCustomDialMenu()"))
  928. self.connect(self.ui.dial_vol, SIGNAL("customContextMenuRequested(QPoint)"), SLOT("slot_showCustomDialMenu()"))
  929. self.connect(self.ui.dial_b_left, SIGNAL("customContextMenuRequested(QPoint)"), SLOT("slot_showCustomDialMenu()"))
  930. self.connect(self.ui.dial_b_right, SIGNAL("customContextMenuRequested(QPoint)"), SLOT("slot_showCustomDialMenu()"))
  931. self.connect(self.ui.keyboard, SIGNAL("noteOn(int)"), SLOT("slot_noteOn(int)"))
  932. self.connect(self.ui.keyboard, SIGNAL("noteOff(int)"), SLOT("slot_noteOff(int)"))
  933. self.connect(self.ui.keyboard, SIGNAL("notesOn()"), SLOT("slot_notesOn()"))
  934. self.connect(self.ui.keyboard, SIGNAL("notesOff()"), SLOT("slot_notesOff()"))
  935. self.connect(self.ui.cb_programs, SIGNAL("currentIndexChanged(int)"), SLOT("slot_programIndexChanged(int)"))
  936. self.connect(self.ui.cb_midi_programs, SIGNAL("currentIndexChanged(int)"), SLOT("slot_midiProgramIndexChanged(int)"))
  937. self.connect(self, SIGNAL("finished(int)"), SLOT("slot_finished()"))
  938. self.reloadAll()
  939. def reloadAll(self):
  940. self.fPluginInfo = Carla.host.get_plugin_info(self.fPluginId)
  941. self.fPluginInfo["binary"] = cString(self.fPluginInfo["binary"])
  942. self.fPluginInfo["name"] = cString(self.fPluginInfo["name"])
  943. self.fPluginInfo["label"] = cString(self.fPluginInfo["label"])
  944. self.fPluginInfo["maker"] = cString(self.fPluginInfo["maker"])
  945. self.fPluginInfo["copyright"] = cString(self.fPluginInfo["copyright"])
  946. self.reloadInfo()
  947. self.reloadParameters()
  948. self.reloadPrograms()
  949. if not self.ui.scrollArea.isEnabled():
  950. self.resize(self.width(), self.height()-self.ui.scrollArea.height())
  951. def reloadInfo(self):
  952. pluginName = cString(Carla.host.get_real_plugin_name(self.fPluginId))
  953. pluginType = self.fPluginInfo['type']
  954. pluginHints = self.fPluginInfo['hints']
  955. audioCountInfo = Carla.host.get_audio_port_count_info(self.fPluginId)
  956. midiCountInfo = Carla.host.get_midi_port_count_info(self.fPluginId)
  957. paramCountInfo = Carla.host.get_parameter_count_info(self.fPluginId)
  958. if pluginType == PLUGIN_INTERNAL:
  959. self.ui.le_type.setText(self.tr("Internal"))
  960. elif pluginType == PLUGIN_LADSPA:
  961. self.ui.le_type.setText("LADSPA")
  962. elif pluginType == PLUGIN_DSSI:
  963. self.ui.le_type.setText("DSSI")
  964. elif pluginType == PLUGIN_LV2:
  965. self.ui.le_type.setText("LV2")
  966. elif pluginType == PLUGIN_VST:
  967. self.ui.le_type.setText("VST")
  968. elif pluginType == PLUGIN_VST3:
  969. self.ui.le_type.setText("VST3")
  970. elif pluginType == PLUGIN_GIG:
  971. self.ui.le_type.setText("GIG")
  972. elif pluginType == PLUGIN_SF2:
  973. self.ui.le_type.setText("SF2")
  974. elif pluginType == PLUGIN_SFZ:
  975. self.ui.le_type.setText("SFZ")
  976. else:
  977. self.ui.le_type.setText(self.tr("Unknown"))
  978. self.ui.le_name.setText(pluginName)
  979. self.ui.le_name.setToolTip(pluginName)
  980. self.ui.le_label.setText(self.fPluginInfo['label'])
  981. self.ui.le_label.setToolTip(self.fPluginInfo['label'])
  982. self.ui.le_maker.setText(self.fPluginInfo['maker'])
  983. self.ui.le_maker.setToolTip(self.fPluginInfo['maker'])
  984. self.ui.le_copyright.setText(self.fPluginInfo['copyright'])
  985. self.ui.le_copyright.setToolTip(self.fPluginInfo['copyright'])
  986. self.ui.le_unique_id.setText(str(self.fPluginInfo['uniqueId']))
  987. self.ui.le_unique_id.setToolTip(str(self.fPluginInfo['uniqueId']))
  988. self.ui.le_ains.setText(str(audioCountInfo['ins']))
  989. self.ui.le_aouts.setText(str(audioCountInfo['outs']))
  990. self.ui.le_params.setText(str(paramCountInfo['ins']))
  991. self.ui.label_plugin.setText("\n%s\n" % self.fPluginInfo['name'])
  992. self.setWindowTitle(self.fPluginInfo['name'])
  993. if self.fPluginInfo['latency'] > 0:
  994. self.ui.le_latency.setText("%i samples" % self.fPluginInfo['latency'])
  995. else:
  996. self.ui.le_latency.setText(self.tr("None"))
  997. self.ui.dial_drywet.setEnabled(pluginHints & PLUGIN_CAN_DRYWET)
  998. self.ui.dial_vol.setEnabled(pluginHints & PLUGIN_CAN_VOLUME)
  999. self.ui.dial_b_left.setEnabled(pluginHints & PLUGIN_CAN_BALANCE)
  1000. self.ui.dial_b_right.setEnabled(pluginHints & PLUGIN_CAN_BALANCE)
  1001. self.ui.ch_fixed_buffer.setEnabled(self.fPluginInfo['optionsAvailable'] & PLUGIN_OPTION_FIXED_BUFFER)
  1002. self.ui.ch_fixed_buffer.setChecked(self.fPluginInfo['optionsEnabled'] & PLUGIN_OPTION_FIXED_BUFFER)
  1003. self.ui.ch_force_stereo.setEnabled(self.fPluginInfo['optionsAvailable'] & PLUGIN_OPTION_FORCE_STEREO)
  1004. self.ui.ch_force_stereo.setChecked(self.fPluginInfo['optionsEnabled'] & PLUGIN_OPTION_FORCE_STEREO)
  1005. self.ui.ch_map_program_changes.setEnabled(self.fPluginInfo['optionsAvailable'] & PLUGIN_OPTION_MAP_PROGRAM_CHANGES)
  1006. self.ui.ch_map_program_changes.setChecked(self.fPluginInfo['optionsEnabled'] & PLUGIN_OPTION_MAP_PROGRAM_CHANGES)
  1007. self.ui.ch_use_chunks.setEnabled(self.fPluginInfo['optionsAvailable'] & PLUGIN_OPTION_USE_CHUNKS)
  1008. self.ui.ch_use_chunks.setChecked(self.fPluginInfo['optionsEnabled'] & PLUGIN_OPTION_USE_CHUNKS)
  1009. self.ui.ch_send_control_changes.setEnabled(self.fPluginInfo['optionsAvailable'] & PLUGIN_OPTION_SEND_CONTROL_CHANGES)
  1010. self.ui.ch_send_control_changes.setChecked(self.fPluginInfo['optionsEnabled'] & PLUGIN_OPTION_SEND_CONTROL_CHANGES)
  1011. self.ui.ch_send_channel_pressure.setEnabled(self.fPluginInfo['optionsAvailable'] & PLUGIN_OPTION_SEND_CHANNEL_PRESSURE)
  1012. self.ui.ch_send_channel_pressure.setChecked(self.fPluginInfo['optionsEnabled'] & PLUGIN_OPTION_SEND_CHANNEL_PRESSURE)
  1013. self.ui.ch_send_note_aftertouch.setEnabled(self.fPluginInfo['optionsAvailable'] & PLUGIN_OPTION_SEND_NOTE_AFTERTOUCH)
  1014. self.ui.ch_send_note_aftertouch.setChecked(self.fPluginInfo['optionsEnabled'] & PLUGIN_OPTION_SEND_NOTE_AFTERTOUCH)
  1015. self.ui.ch_send_pitchbend.setEnabled(self.fPluginInfo['optionsAvailable'] & PLUGIN_OPTION_SEND_PITCHBEND)
  1016. self.ui.ch_send_pitchbend.setChecked(self.fPluginInfo['optionsEnabled'] & PLUGIN_OPTION_SEND_PITCHBEND)
  1017. self.ui.ch_send_all_sound_off.setEnabled(self.fPluginInfo['optionsAvailable'] & PLUGIN_OPTION_SEND_ALL_SOUND_OFF)
  1018. self.ui.ch_send_all_sound_off.setChecked(self.fPluginInfo['optionsEnabled'] & PLUGIN_OPTION_SEND_ALL_SOUND_OFF)
  1019. # Show/hide keyboard
  1020. showKeyboard = (pluginHints & PLUGIN_IS_SYNTH) != 0 or (midiCountInfo['ins'] > 0 < midiCountInfo['outs'])
  1021. self.ui.scrollArea.setEnabled(showKeyboard)
  1022. self.ui.scrollArea.setVisible(showKeyboard)
  1023. # Force-Update parent for new hints
  1024. if self.fRealParent:
  1025. self.fRealParent.recheckPluginHints(pluginHints)
  1026. def reloadParameters(self):
  1027. parameterCount = Carla.host.get_parameter_count(self.fPluginId)
  1028. # Reset
  1029. self.fParameterCount = 0
  1030. self.fParameterList = []
  1031. self.fParametersToUpdate = []
  1032. self.fTabIconCount = 0
  1033. self.fTabIconTimers = []
  1034. # Remove all previous parameters
  1035. for i in range(self.ui.tabWidget.count()-1):
  1036. self.ui.tabWidget.widget(1).deleteLater()
  1037. self.ui.tabWidget.removeTab(1)
  1038. if parameterCount <= 0:
  1039. pass
  1040. elif parameterCount <= Carla.maxParameters:
  1041. paramInputListFull = []
  1042. paramOutputListFull = []
  1043. paramInputList = [] # ([params], width)
  1044. paramInputWidth = 0
  1045. paramOutputList = [] # ([params], width)
  1046. paramOutputWidth = 0
  1047. for i in range(parameterCount):
  1048. paramInfo = Carla.host.get_parameter_info(self.fPluginId, i)
  1049. paramData = Carla.host.get_parameter_data(self.fPluginId, i)
  1050. paramRanges = Carla.host.get_parameter_ranges(self.fPluginId, i)
  1051. if paramData['type'] not in (PARAMETER_INPUT, PARAMETER_OUTPUT):
  1052. continue
  1053. parameter = {
  1054. 'type': paramData['type'],
  1055. 'hints': paramData['hints'],
  1056. 'name': cString(paramInfo['name']),
  1057. 'unit': cString(paramInfo['unit']),
  1058. 'scalePoints': [],
  1059. 'index': paramData['index'],
  1060. 'default': paramRanges['def'],
  1061. 'minimum': paramRanges['min'],
  1062. 'maximum': paramRanges['max'],
  1063. 'step': paramRanges['step'],
  1064. 'stepSmall': paramRanges['stepSmall'],
  1065. 'stepLarge': paramRanges['stepLarge'],
  1066. 'midiCC': paramData['midiCC'],
  1067. 'midiChannel': paramData['midiChannel'],
  1068. 'current': Carla.host.get_current_parameter_value(self.fPluginId, i)
  1069. }
  1070. for j in range(paramInfo['scalePointCount']):
  1071. scalePointInfo = Carla.host.get_parameter_scalepoint_info(self.fPluginId, i, j)
  1072. scalePointLabel = cString(scalePointInfo['label'])
  1073. scalePointLabel = scalePointLabel[:50] + (scalePointLabel[50:] and "...")
  1074. parameter['scalePoints'].append({
  1075. 'value': scalePointInfo['value'],
  1076. 'label': cString(scalePointInfo['label'])
  1077. })
  1078. parameter['name'] = parameter['name'][:30] + (parameter['name'][30:] and "...")
  1079. # -----------------------------------------------------------------
  1080. # Get width values, in packs of 10
  1081. if parameter['type'] == PARAMETER_INPUT:
  1082. paramInputWidthTMP = QFontMetrics(self.font()).width(parameter['name'])
  1083. if paramInputWidthTMP > paramInputWidth:
  1084. paramInputWidth = paramInputWidthTMP
  1085. paramInputList.append(parameter)
  1086. if len(paramInputList) == 10:
  1087. paramInputListFull.append((paramInputList, paramInputWidth))
  1088. paramInputList = []
  1089. paramInputWidth = 0
  1090. else:
  1091. paramOutputWidthTMP = QFontMetrics(self.font()).width(parameter['name'])
  1092. if paramOutputWidthTMP > paramOutputWidth:
  1093. paramOutputWidth = paramOutputWidthTMP
  1094. paramOutputList.append(parameter)
  1095. if len(paramOutputList) == 10:
  1096. paramOutputListFull.append((paramOutputList, paramOutputWidth))
  1097. paramOutputList = []
  1098. paramOutputWidth = 0
  1099. # for i in range(parameterCount)
  1100. else:
  1101. # Final page width values
  1102. if 0 < len(paramInputList) < 10:
  1103. paramInputListFull.append((paramInputList, paramInputWidth))
  1104. if 0 < len(paramOutputList) < 10:
  1105. paramOutputListFull.append((paramOutputList, paramOutputWidth))
  1106. # -----------------------------------------------------------------
  1107. # Create parameter widgets
  1108. self._createParameterWidgets(PARAMETER_INPUT, paramInputListFull, self.tr("Parameters"))
  1109. self._createParameterWidgets(PARAMETER_OUTPUT, paramOutputListFull, self.tr("Outputs"))
  1110. else: # > Carla.maxParameters
  1111. fakeName = self.tr("This plugin has too many parameters to display here!")
  1112. paramFakeListFull = []
  1113. paramFakeList = []
  1114. paramFakeWidth = QFontMetrics(self.font()).width(fakeName)
  1115. parameter = {
  1116. 'type': PARAMETER_UNKNOWN,
  1117. 'hints': 0,
  1118. 'name': fakeName,
  1119. 'unit': "",
  1120. 'scalePoints': [],
  1121. 'index': 0,
  1122. 'default': 0,
  1123. 'minimum': 0,
  1124. 'maximum': 0,
  1125. 'step': 0,
  1126. 'stepSmall': 0,
  1127. 'stepLarge': 0,
  1128. 'midiCC': -1,
  1129. 'midiChannel': 0,
  1130. 'current': 0.0
  1131. }
  1132. paramFakeList.append(parameter)
  1133. paramFakeListFull.append((paramFakeList, paramFakeWidth))
  1134. self._createParameterWidgets(PARAMETER_UNKNOWN, paramFakeListFull, self.tr("Information"))
  1135. def reloadPrograms(self):
  1136. # Programs
  1137. self.ui.cb_programs.blockSignals(True)
  1138. self.ui.cb_programs.clear()
  1139. programCount = Carla.host.get_program_count(self.fPluginId)
  1140. if programCount > 0:
  1141. self.ui.cb_programs.setEnabled(True)
  1142. self.ui.label_programs.setEnabled(True)
  1143. for i in range(programCount):
  1144. pName = cString(Carla.host.get_program_name(self.fPluginId, i))
  1145. pName = pName[:40] + (pName[40:] and "...")
  1146. self.ui.cb_programs.addItem(pName)
  1147. self.fCurrentProgram = Carla.host.get_current_program_index(self.fPluginId)
  1148. self.ui.cb_programs.setCurrentIndex(self.fCurrentProgram)
  1149. else:
  1150. self.fCurrentProgram = -1
  1151. self.ui.cb_programs.setEnabled(False)
  1152. self.ui.label_programs.setEnabled(False)
  1153. self.ui.cb_programs.blockSignals(False)
  1154. # MIDI Programs
  1155. self.ui.cb_midi_programs.blockSignals(True)
  1156. self.ui.cb_midi_programs.clear()
  1157. midiProgramCount = Carla.host.get_midi_program_count(self.fPluginId)
  1158. if midiProgramCount > 0:
  1159. self.ui.cb_midi_programs.setEnabled(True)
  1160. self.ui.label_midi_programs.setEnabled(True)
  1161. for i in range(midiProgramCount):
  1162. mpData = Carla.host.get_midi_program_data(self.fPluginId, i)
  1163. mpBank = int(mpData['bank'])
  1164. mpProg = int(mpData['program'])
  1165. mpName = cString(mpData['name'])
  1166. mpName = mpName[:40] + (mpName[40:] and "...")
  1167. self.ui.cb_midi_programs.addItem("%03i:%03i - %s" % (mpBank+1, mpProg+1, mpName))
  1168. self.fCurrentMidiProgram = Carla.host.get_current_midi_program_index(self.fPluginId)
  1169. self.ui.cb_midi_programs.setCurrentIndex(self.fCurrentMidiProgram)
  1170. else:
  1171. self.fCurrentMidiProgram = -1
  1172. self.ui.cb_midi_programs.setEnabled(False)
  1173. self.ui.label_midi_programs.setEnabled(False)
  1174. self.ui.cb_midi_programs.blockSignals(False)
  1175. # Automatically change to Midi Programs tab
  1176. if midiProgramCount > 0 and programCount == 0:
  1177. self.ui.tab_programs.setCurrentIndex(1)
  1178. def updateInfo(self):
  1179. # Update current program text
  1180. if self.ui.cb_programs.count() > 0:
  1181. pIndex = self.ui.cb_programs.currentIndex()
  1182. pName = cString(Carla.host.get_program_name(self.fPluginId, pIndex))
  1183. pName = pName[:40] + (pName[40:] and "...")
  1184. self.ui.cb_programs.setItemText(pIndex, pName)
  1185. # Update current midi program text
  1186. if self.ui.cb_midi_programs.count() > 0:
  1187. mpIndex = self.ui.cb_midi_programs.currentIndex()
  1188. mpData = Carla.host.get_midi_program_data(self.fPluginId, mpIndex)
  1189. mpBank = int(mpData['bank'])
  1190. mpProg = int(mpData['program'])
  1191. mpName = cString(mpData['name'])
  1192. mpName = mpName[:40] + (mpName[40:] and "...")
  1193. self.ui.cb_midi_programs.setItemText(mpIndex, "%03i:%03i - %s" % (mpBank+1, mpProg+1, mpName))
  1194. # Update all parameter values
  1195. for paramType, paramId, paramWidget in self.fParameterList:
  1196. paramWidget.setValue(Carla.host.get_current_parameter_value(self.fPluginId, paramId), False)
  1197. paramWidget.update()
  1198. def setParameterValue(self, parameterId, value):
  1199. for paramItem in self.fParametersToUpdate:
  1200. if paramItem[0] == parameterId:
  1201. paramItem[1] = value
  1202. break
  1203. else:
  1204. self.fParametersToUpdate.append([parameterId, value])
  1205. def setParameterDefault(self, parameterId, value):
  1206. for paramType, paramId, paramWidget in self.fParameterList:
  1207. if paramId == parameterId:
  1208. paramWidget.setDefault(value)
  1209. break
  1210. def setParameterMidiControl(self, parameterId, control):
  1211. for paramType, paramId, paramWidget in self.fParameterList:
  1212. if paramId == parameterId:
  1213. paramWidget.setMidiControl(control)
  1214. break
  1215. def setParameterMidiChannel(self, parameterId, channel):
  1216. for paramType, paramId, paramWidget in self.fParameterList:
  1217. if paramId == parameterId:
  1218. paramWidget.setMidiChannel(channel)
  1219. break
  1220. def setProgram(self, index):
  1221. self.ui.cb_programs.blockSignals(True)
  1222. self.ui.cb_programs.setCurrentIndex(index)
  1223. self.ui.cb_programs.blockSignals(False)
  1224. def setMidiProgram(self, index):
  1225. self.ui.cb_midi_programs.blockSignals(True)
  1226. self.ui.cb_midi_programs.setCurrentIndex(index)
  1227. self.ui.cb_midi_programs.blockSignals(False)
  1228. def sendNoteOn(self, channel, note):
  1229. if self.fControlChannel == channel:
  1230. self.ui.keyboard.sendNoteOn(note, False)
  1231. def sendNoteOff(self, channel, note):
  1232. if self.fControlChannel == channel:
  1233. self.ui.keyboard.sendNoteOff(note, False)
  1234. def setVisible(self, yesNo):
  1235. if yesNo:
  1236. if not self.fGeometry.isNull():
  1237. self.restoreGeometry(self.fGeometry)
  1238. else:
  1239. self.fGeometry = self.saveGeometry()
  1240. QDialog.setVisible(self, yesNo)
  1241. def idleSlow(self):
  1242. # Check Tab icons
  1243. for i in range(len(self.fTabIconTimers)):
  1244. if self.fTabIconTimers[i] == ICON_STATE_ON:
  1245. self.fTabIconTimers[i] = ICON_STATE_WAIT
  1246. elif self.fTabIconTimers[i] == ICON_STATE_WAIT:
  1247. self.fTabIconTimers[i] = ICON_STATE_OFF
  1248. elif self.fTabIconTimers[i] == ICON_STATE_OFF:
  1249. self.fTabIconTimers[i] = ICON_STATE_NULL
  1250. self.ui.tabWidget.setTabIcon(i+1, self.fTabIconOff)
  1251. # Check parameters needing update
  1252. for index, value in self.fParametersToUpdate:
  1253. if index == PARAMETER_DRYWET:
  1254. self.ui.dial_drywet.blockSignals(True)
  1255. self.ui.dial_drywet.setValue(value * 1000)
  1256. self.ui.dial_drywet.blockSignals(False)
  1257. elif index == PARAMETER_VOLUME:
  1258. self.ui.dial_vol.blockSignals(True)
  1259. self.ui.dial_vol.setValue(value * 1000)
  1260. self.ui.dial_vol.blockSignals(False)
  1261. elif index == PARAMETER_BALANCE_LEFT:
  1262. self.ui.dial_b_left.blockSignals(True)
  1263. self.ui.dial_b_left.setValue(value * 1000)
  1264. self.ui.dial_b_left.blockSignals(False)
  1265. elif index == PARAMETER_BALANCE_RIGHT:
  1266. self.ui.dial_b_right.blockSignals(True)
  1267. self.ui.dial_b_right.setValue(value * 1000)
  1268. self.ui.dial_b_right.blockSignals(False)
  1269. elif index == PARAMETER_PANNING:
  1270. pass
  1271. #self.ui.dial_pan.blockSignals(True)
  1272. #self.ui.dial_pan.setValue(value * 1000, True, False)
  1273. #self.ui.dial_pan.blockSignals(False)
  1274. elif index == PARAMETER_CTRL_CHANNEL:
  1275. self.fControlChannel = int(value)
  1276. self.ui.sb_ctrl_channel.blockSignals(True)
  1277. self.ui.sb_ctrl_channel.setValue(self.fControlChannel+1)
  1278. self.ui.sb_ctrl_channel.blockSignals(False)
  1279. self.ui.keyboard.allNotesOff()
  1280. elif index >= 0:
  1281. for paramType, paramId, paramWidget in self.fParameterList:
  1282. if paramId == index:
  1283. paramWidget.setValue(value, False)
  1284. if paramType == PARAMETER_INPUT:
  1285. tabIndex = paramWidget.tabIndex()
  1286. if self.fTabIconTimers[tabIndex-1] == ICON_STATE_NULL:
  1287. self.ui.tabWidget.setTabIcon(tabIndex, self.fTabIconOn)
  1288. self.fTabIconTimers[tabIndex-1] = ICON_STATE_ON
  1289. break
  1290. # Clear all parameters
  1291. self.fParametersToUpdate = []
  1292. # Update parameter outputs
  1293. for paramType, paramId, paramWidget in self.fParameterList:
  1294. if paramType == PARAMETER_OUTPUT:
  1295. value = Carla.host.get_current_parameter_value(self.fPluginId, paramId)
  1296. paramWidget.setValue(value, False)
  1297. @pyqtSlot()
  1298. def slot_saveState(self):
  1299. if self.fCurrentStateFilename:
  1300. askTry = QMessageBox.question(self, self.tr("Overwrite?"), self.tr("Overwrite previously created file?"), QMessageBox.Ok|QMessageBox.Cancel)
  1301. if askTry == QMessageBox.Ok:
  1302. Carla.host.save_plugin_state(self.fPluginId, self.fCurrentStateFilename)
  1303. self.fCurrentStateFilename = None
  1304. fileFilter = self.tr("Carla State File (*.carxs)")
  1305. filenameTry = QFileDialog.getSaveFileName(self, self.tr("Save Plugin State File"), filter=fileFilter)
  1306. if filenameTry:
  1307. if not filenameTry.endswith(".carxs"):
  1308. filenameTry += ".carxs"
  1309. self.fCurrentStateFilename = filenameTry
  1310. Carla.host.save_plugin_state(self.fPluginId, self.fCurrentStateFilename)
  1311. @pyqtSlot()
  1312. def slot_loadState(self):
  1313. fileFilter = self.tr("Carla State File (*.carxs)")
  1314. filenameTry = QFileDialog.getOpenFileName(self, self.tr("Open Plugin State File"), filter=fileFilter)
  1315. if filenameTry:
  1316. self.fCurrentStateFilename = filenameTry
  1317. Carla.host.load_plugin_state(self.fPluginId, self.fCurrentStateFilename)
  1318. @pyqtSlot(bool)
  1319. def slot_optionChanged(self, clicked):
  1320. sender = self.sender()
  1321. if sender == self.ui.ch_fixed_buffer:
  1322. option = PLUGIN_OPTION_FIXED_BUFFER
  1323. elif sender == self.ui.ch_force_stereo:
  1324. option = PLUGIN_OPTION_FORCE_STEREO
  1325. elif sender == self.ui.ch_map_program_changes:
  1326. option = PLUGIN_OPTION_MAP_PROGRAM_CHANGES
  1327. elif sender == self.ui.ch_use_chunks:
  1328. option = PLUGIN_OPTION_USE_CHUNKS
  1329. elif sender == self.ui.ch_send_control_changes:
  1330. option = PLUGIN_OPTION_SEND_CONTROL_CHANGES
  1331. elif sender == self.ui.ch_send_channel_pressure:
  1332. option = PLUGIN_OPTION_SEND_CHANNEL_PRESSURE
  1333. elif sender == self.ui.ch_send_note_aftertouch:
  1334. option = PLUGIN_OPTION_SEND_NOTE_AFTERTOUCH
  1335. elif sender == self.ui.ch_send_pitchbend:
  1336. option = PLUGIN_OPTION_SEND_PITCHBEND
  1337. elif sender == self.ui.ch_send_all_sound_off:
  1338. option = PLUGIN_OPTION_SEND_ALL_SOUND_OFF
  1339. else:
  1340. return
  1341. Carla.host.set_option(self.fPluginId, option, clicked)
  1342. @pyqtSlot(int)
  1343. def slot_dryWetChanged(self, value):
  1344. Carla.host.set_drywet(self.fPluginId, float(value)/1000)
  1345. @pyqtSlot(int)
  1346. def slot_volumeChanged(self, value):
  1347. Carla.host.set_volume(self.fPluginId, float(value)/1000)
  1348. @pyqtSlot(int)
  1349. def slot_balanceLeftChanged(self, value):
  1350. Carla.host.set_balance_left(self.fPluginId, float(value)/1000)
  1351. @pyqtSlot(int)
  1352. def slot_balanceRightChanged(self, value):
  1353. Carla.host.set_balance_right(self.fPluginId, float(value)/1000)
  1354. @pyqtSlot(int)
  1355. def slot_panningChanged(self, value):
  1356. Carla.host.set_panning(self.fPluginId, float(value)/1000)
  1357. @pyqtSlot(int)
  1358. def slot_ctrlChannelChanged(self, value):
  1359. self.fControlChannel = value-1
  1360. Carla.host.set_ctrl_channel(self.fPluginId, self.fControlChannel)
  1361. self.ui.keyboard.allNotesOff()
  1362. @pyqtSlot(int, float)
  1363. def slot_parameterValueChanged(self, parameterId, value):
  1364. Carla.host.set_parameter_value(self.fPluginId, parameterId, value)
  1365. @pyqtSlot(int, int)
  1366. def slot_parameterMidiControlChanged(self, parameterId, control):
  1367. Carla.host.set_parameter_midi_cc(self.fPluginId, parameterId, control)
  1368. @pyqtSlot(int, int)
  1369. def slot_parameterMidiChannelChanged(self, parameterId, channel):
  1370. Carla.host.set_parameter_midi_channel(self.fPluginId, parameterId, channel-1)
  1371. @pyqtSlot(int)
  1372. def slot_programIndexChanged(self, index):
  1373. if self.fCurrentProgram != index:
  1374. self.fCurrentProgram = index
  1375. Carla.host.set_program(self.fPluginId, index)
  1376. @pyqtSlot(int)
  1377. def slot_midiProgramIndexChanged(self, index):
  1378. if self.fCurrentMidiProgram != index:
  1379. self.fCurrentMidiProgram = index
  1380. Carla.host.set_midi_program(self.fPluginId, index)
  1381. @pyqtSlot(int)
  1382. def slot_noteOn(self, note):
  1383. if self.fControlChannel >= 0:
  1384. Carla.host.send_midi_note(self.fPluginId, self.fControlChannel, note, 100)
  1385. @pyqtSlot(int)
  1386. def slot_noteOff(self, note):
  1387. if self.fControlChannel >= 0:
  1388. Carla.host.send_midi_note(self.fPluginId, self.fControlChannel, note, 0)
  1389. @pyqtSlot()
  1390. def slot_notesOn(self):
  1391. if self.fRealParent:
  1392. self.fRealParent.ui.led_midi.setChecked(True)
  1393. @pyqtSlot()
  1394. def slot_notesOff(self):
  1395. if self.fRealParent:
  1396. self.fRealParent.ui.led_midi.setChecked(False)
  1397. @pyqtSlot()
  1398. def slot_finished(self):
  1399. if self.fRealParent:
  1400. self.fRealParent.editClosed()
  1401. @pyqtSlot()
  1402. def slot_showCustomDialMenu(self):
  1403. dialName = self.sender().objectName()
  1404. if dialName == "dial_drywet":
  1405. minimum = 0
  1406. maximum = 100
  1407. default = 100
  1408. label = "Dry/Wet"
  1409. elif dialName == "dial_vol":
  1410. minimum = 0
  1411. maximum = 127
  1412. default = 100
  1413. label = "Volume"
  1414. elif dialName == "dial_b_left":
  1415. minimum = -100
  1416. maximum = 100
  1417. default = -100
  1418. label = "Balance-Left"
  1419. elif dialName == "dial_b_right":
  1420. minimum = -100
  1421. maximum = 100
  1422. default = 100
  1423. label = "Balance-Right"
  1424. elif dialName == "dial_panning":
  1425. minimum = -100
  1426. maximum = 100
  1427. default = 0
  1428. label = "Panning"
  1429. else:
  1430. minimum = 0
  1431. maximum = 100
  1432. default = 100
  1433. label = "Unknown"
  1434. current = self.sender().value() / 10
  1435. menu = QMenu(self)
  1436. actReset = menu.addAction(self.tr("Reset (%i%%)" % default))
  1437. menu.addSeparator()
  1438. actMinimum = menu.addAction(self.tr("Set to Minimum (%i%%)" % minimum))
  1439. actCenter = menu.addAction(self.tr("Set to Center"))
  1440. actMaximum = menu.addAction(self.tr("Set to Maximum (%i%%)" % maximum))
  1441. menu.addSeparator()
  1442. actSet = menu.addAction(self.tr("Set value..."))
  1443. if label not in ("Balance-Left", "Balance-Right"):
  1444. menu.removeAction(actCenter)
  1445. actSelected = menu.exec_(QCursor.pos())
  1446. if actSelected == actSet:
  1447. valueTry = QInputDialog.getInteger(self, self.tr("Set value"), label, current, minimum, maximum, 1)
  1448. if valueTry[1]:
  1449. value = valueTry[0] * 10
  1450. else:
  1451. return
  1452. elif actSelected == actMinimum:
  1453. value = minimum * 10
  1454. elif actSelected == actMaximum:
  1455. value = maximum * 10
  1456. elif actSelected == actReset:
  1457. value = default * 10
  1458. elif actSelected == actCenter:
  1459. value = 0
  1460. else:
  1461. return
  1462. if label == "Dry/Wet":
  1463. self.ui.dial_drywet.setValue(value)
  1464. elif label == "Volume":
  1465. self.ui.dial_vol.setValue(value)
  1466. elif label == "Balance-Left":
  1467. self.ui.dial_b_left.setValue(value)
  1468. elif label == "Balance-Right":
  1469. self.ui.dial_b_right.setValue(value)
  1470. elif label == "Panning":
  1471. pass
  1472. #self.ui.dial_panning.setValue(value)
  1473. def _createParameterWidgets(self, paramType, paramListFull, tabPageName):
  1474. i = 1
  1475. for paramList, width in paramListFull:
  1476. if len(paramList) == 0:
  1477. break
  1478. tabIndex = self.ui.tabWidget.count()
  1479. tabPageContainer = QWidget(self.ui.tabWidget)
  1480. tabPageLayout = QVBoxLayout(tabPageContainer)
  1481. tabPageContainer.setLayout(tabPageLayout)
  1482. for paramInfo in paramList:
  1483. paramWidget = PluginParameter(tabPageContainer, paramInfo, self.fPluginId, tabIndex)
  1484. paramWidget.setLabelWidth(width)
  1485. tabPageLayout.addWidget(paramWidget)
  1486. self.fParameterList.append((paramType, paramInfo['index'], paramWidget))
  1487. if paramType == PARAMETER_INPUT:
  1488. self.connect(paramWidget, SIGNAL("valueChanged(int, double)"), SLOT("slot_parameterValueChanged(int, double)"))
  1489. self.connect(paramWidget, SIGNAL("midiControlChanged(int, int)"), SLOT("slot_parameterMidiControlChanged(int, int)"))
  1490. self.connect(paramWidget, SIGNAL("midiChannelChanged(int, int)"), SLOT("slot_parameterMidiChannelChanged(int, int)"))
  1491. tabPageLayout.addStretch()
  1492. self.ui.tabWidget.addTab(tabPageContainer, "%s (%i)" % (tabPageName, i))
  1493. i += 1
  1494. if paramType == PARAMETER_INPUT:
  1495. self.ui.tabWidget.setTabIcon(tabIndex, self.fTabIconOff)
  1496. self.fTabIconTimers.append(ICON_STATE_NULL)
  1497. def showEvent(self, event):
  1498. if not self.fScrollAreaSetup:
  1499. self.fScrollAreaSetup = True
  1500. minHeight = self.ui.scrollArea.height()+2
  1501. self.ui.scrollArea.setMinimumHeight(minHeight)
  1502. self.ui.scrollArea.setMaximumHeight(minHeight)
  1503. QDialog.showEvent(self, event)
  1504. def done(self, r):
  1505. QDialog.done(self, r)
  1506. self.close()
  1507. # ------------------------------------------------------------------------------------------------------------
  1508. # Plugin Widget
  1509. class PluginWidget(QFrame):
  1510. def __init__(self, parent, pluginId):
  1511. QFrame.__init__(self, parent)
  1512. self.ui = ui_carla_plugin.Ui_PluginWidget()
  1513. self.ui.setupUi(self)
  1514. self.fLastGreenLedState = False
  1515. self.fLastBlueLedState = False
  1516. self.fParameterIconTimer = ICON_STATE_NULL
  1517. self.fPluginId = pluginId
  1518. self.fPluginInfo = Carla.host.get_plugin_info(self.fPluginId)
  1519. self.fPluginInfo["binary"] = cString(self.fPluginInfo["binary"])
  1520. self.fPluginInfo["name"] = cString(self.fPluginInfo["name"])
  1521. self.fPluginInfo["label"] = cString(self.fPluginInfo["label"])
  1522. self.fPluginInfo["maker"] = cString(self.fPluginInfo["maker"])
  1523. self.fPluginInfo["copyright"] = cString(self.fPluginInfo["copyright"])
  1524. if Carla.processMode == PROCESS_MODE_CONTINUOUS_RACK:
  1525. self.fPeaksInputCount = 2
  1526. self.fPeaksOutputCount = 2
  1527. else:
  1528. audioCountInfo = Carla.host.get_audio_port_count_info(self.fPluginId)
  1529. self.fPeaksInputCount = int(audioCountInfo['ins'])
  1530. self.fPeaksOutputCount = int(audioCountInfo['outs'])
  1531. if self.fPeaksInputCount > 2:
  1532. self.fPeaksInputCount = 2
  1533. if self.fPeaksOutputCount > 2:
  1534. self.fPeaksOutputCount = 2
  1535. # Background
  1536. self.fColorTop = QColor(60, 60, 60)
  1537. self.fColorBottom = QColor(47, 47, 47)
  1538. self.setStyleSheet("""
  1539. QLabel#label_name {
  1540. color: white;
  1541. }""")
  1542. # Colorify
  1543. #if self.m_pluginInfo['category'] == PLUGIN_CATEGORY_SYNTH:
  1544. #self.setWidgetColor(PALETTE_COLOR_WHITE)
  1545. #elif self.m_pluginInfo['category'] == PLUGIN_CATEGORY_DELAY:
  1546. #self.setWidgetColor(PALETTE_COLOR_ORANGE)
  1547. #elif self.m_pluginInfo['category'] == PLUGIN_CATEGORY_EQ:
  1548. #self.setWidgetColor(PALETTE_COLOR_GREEN)
  1549. #elif self.m_pluginInfo['category'] == PLUGIN_CATEGORY_FILTER:
  1550. #self.setWidgetColor(PALETTE_COLOR_BLUE)
  1551. #elif self.m_pluginInfo['category'] == PLUGIN_CATEGORY_DYNAMICS:
  1552. #self.setWidgetColor(PALETTE_COLOR_PINK)
  1553. #elif self.m_pluginInfo['category'] == PLUGIN_CATEGORY_MODULATOR:
  1554. #self.setWidgetColor(PALETTE_COLOR_RED)
  1555. #elif self.m_pluginInfo['category'] == PLUGIN_CATEGORY_UTILITY:
  1556. #self.setWidgetColor(PALETTE_COLOR_YELLOW)
  1557. #elif self.m_pluginInfo['category'] == PLUGIN_CATEGORY_OTHER:
  1558. #self.setWidgetColor(PALETTE_COLOR_BROWN)
  1559. #else:
  1560. #self.setWidgetColor(PALETTE_COLOR_NONE)
  1561. self.ui.b_enable.setPixmaps(":/bitmaps/led_red.png", ":/bitmaps/led_green.png", ":/bitmaps/led_red.png")
  1562. self.ui.b_gui.setPixmaps(":/bitmaps/button_gui.png", ":/bitmaps/button_gui_down.png", ":/bitmaps/button_gui_hover.png")
  1563. self.ui.b_edit.setPixmaps(":/bitmaps/button_edit.png", ":/bitmaps/button_edit_down.png", ":/bitmaps/button_edit_hover.png")
  1564. self.ui.b_up.setPixmaps(":/bitmaps/button_up.png", ":/bitmaps/button_up.png", ":/bitmaps/button_up_hover.png")
  1565. self.ui.b_down.setPixmaps(":/bitmaps/button_down.png", ":/bitmaps/button_down.png", ":/bitmaps/button_down_hover.png")
  1566. self.ui.b_restore.setPixmaps(":/bitmaps/button_restore.png", ":/bitmaps/button_restore.png", ":/bitmaps/button_restore_hover.png")
  1567. self.ui.b_close.setPixmaps(":/bitmaps/button_close.png", ":/bitmaps/button_close_down.png", ":/bitmaps/button_close_hover.png")
  1568. # TODO
  1569. self.ui.b_up.setEnabled(False)
  1570. self.ui.b_down.setEnabled(False)
  1571. self.ui.b_restore.setEnabled(False)
  1572. self.ui.led_control.setColor(self.ui.led_control.YELLOW)
  1573. self.ui.led_control.setEnabled(False)
  1574. self.ui.led_midi.setColor(self.ui.led_midi.RED)
  1575. self.ui.led_midi.setEnabled(False)
  1576. self.ui.led_audio_in.setColor(self.ui.led_audio_in.GREEN)
  1577. self.ui.led_audio_in.setEnabled(False)
  1578. self.ui.led_audio_out.setColor(self.ui.led_audio_out.BLUE)
  1579. self.ui.led_audio_out.setEnabled(False)
  1580. self.ui.peak_in.setColor(self.ui.peak_in.GREEN)
  1581. self.ui.peak_in.setOrientation(self.ui.peak_in.HORIZONTAL)
  1582. self.ui.peak_out.setColor(self.ui.peak_in.BLUE)
  1583. self.ui.peak_out.setOrientation(self.ui.peak_out.HORIZONTAL)
  1584. self.ui.peak_in.setChannels(self.fPeaksInputCount)
  1585. self.ui.peak_out.setChannels(self.fPeaksOutputCount)
  1586. self.ui.label_name.setText(self.fPluginInfo['name'])
  1587. self.ui.edit_dialog = PluginEdit(self, self.fPluginId)
  1588. self.ui.edit_dialog.hide()
  1589. self.connect(self.ui.b_enable, SIGNAL("clicked(bool)"), SLOT("slot_setActive(bool)"))
  1590. self.connect(self.ui.b_gui, SIGNAL("clicked(bool)"), SLOT("slot_guiClicked(bool)"))
  1591. self.connect(self.ui.b_edit, SIGNAL("clicked(bool)"), SLOT("slot_editClicked(bool)"))
  1592. self.connect(self.ui.b_up, SIGNAL("clicked()"), SLOT("slot_upClicked()"))
  1593. self.connect(self.ui.b_down, SIGNAL("clicked()"), SLOT("slot_downClicked()"))
  1594. self.connect(self.ui.b_restore, SIGNAL("clicked()"), SLOT("slot_restoreClicked()"))
  1595. self.connect(self.ui.b_close, SIGNAL("clicked()"), SLOT("slot_closeClicked()"))
  1596. # FIXME
  1597. #self.setMaximumHeight(32)
  1598. def idleFast(self):
  1599. # Input peaks
  1600. if self.fPeaksInputCount > 0:
  1601. if self.fPeaksInputCount > 1:
  1602. peak1 = Carla.host.get_input_peak_value(self.fPluginId, 1)
  1603. peak2 = Carla.host.get_input_peak_value(self.fPluginId, 2)
  1604. ledState = bool(peak1 != 0.0 or peak2 != 0.0)
  1605. self.ui.peak_in.displayMeter(1, peak1)
  1606. self.ui.peak_in.displayMeter(2, peak2)
  1607. else:
  1608. peak = Carla.host.get_input_peak_value(self.fPluginId, 1)
  1609. ledState = bool(peak != 0.0)
  1610. self.ui.peak_in.displayMeter(1, peak)
  1611. if self.fLastGreenLedState != ledState:
  1612. self.fLastGreenLedState = ledState
  1613. self.ui.led_audio_in.setChecked(ledState)
  1614. # Output peaks
  1615. if self.fPeaksOutputCount > 0:
  1616. if self.fPeaksOutputCount > 1:
  1617. peak1 = Carla.host.get_output_peak_value(self.fPluginId, 1)
  1618. peak2 = Carla.host.get_output_peak_value(self.fPluginId, 2)
  1619. ledState = bool(peak1 != 0.0 or peak2 != 0.0)
  1620. self.ui.peak_out.displayMeter(1, peak1)
  1621. self.ui.peak_out.displayMeter(2, peak2)
  1622. else:
  1623. peak = Carla.host.get_output_peak_value(self.fPluginId, 1)
  1624. ledState = bool(peak != 0.0)
  1625. self.ui.peak_out.displayMeter(1, peak)
  1626. if self.fLastBlueLedState != ledState:
  1627. self.fLastBlueLedState = ledState
  1628. self.ui.led_audio_out.setChecked(ledState)
  1629. def idleSlow(self):
  1630. # Parameter Activity LED
  1631. if self.fParameterIconTimer == ICON_STATE_ON:
  1632. self.fParameterIconTimer = ICON_STATE_WAIT
  1633. self.ui.led_control.setChecked(True)
  1634. elif self.fParameterIconTimer == ICON_STATE_WAIT:
  1635. self.fParameterIconTimer = ICON_STATE_OFF
  1636. elif self.fParameterIconTimer == ICON_STATE_OFF:
  1637. self.fParameterIconTimer = ICON_STATE_NULL
  1638. self.ui.led_control.setChecked(False)
  1639. # Update edit dialog
  1640. self.ui.edit_dialog.idleSlow()
  1641. def editClosed(self):
  1642. self.ui.b_edit.setChecked(False)
  1643. def recheckPluginHints(self, hints):
  1644. self.fPluginInfo['hints'] = hints
  1645. self.ui.b_gui.setEnabled(hints & PLUGIN_HAS_GUI)
  1646. def setActive(self, active, sendGui=False, sendCallback=True):
  1647. if sendGui: self.ui.b_enable.setChecked(active)
  1648. if sendCallback: Carla.host.set_active(self.fPluginId, active)
  1649. if active:
  1650. self.ui.edit_dialog.ui.keyboard.allNotesOff()
  1651. def setParameterDefault(self, parameterId, value):
  1652. self.ui.edit_dialog.setParameterDefault(parameterId, value)
  1653. def setParameterValue(self, parameterId, value):
  1654. self.fParameterIconTimer = ICON_STATE_ON
  1655. if parameterId == PARAMETER_ACTIVE:
  1656. return self.setActive(bool(value), True, False)
  1657. self.ui.edit_dialog.setParameterValue(parameterId, value)
  1658. def setParameterMidiControl(self, parameterId, control):
  1659. self.ui.edit_dialog.setParameterMidiControl(parameterId, control)
  1660. def setParameterMidiChannel(self, parameterId, channel):
  1661. self.ui.edit_dialog.setParameterMidiChannel(parameterId, channel)
  1662. def setProgram(self, index):
  1663. self.fParameterIconTimer = ICON_STATE_ON
  1664. self.ui.edit_dialog.setProgram(index)
  1665. def setMidiProgram(self, index):
  1666. self.fParameterIconTimer = ICON_STATE_ON
  1667. self.ui.edit_dialog.setMidiProgram(index)
  1668. def sendNoteOn(self, channel, note):
  1669. self.ui.edit_dialog.sendNoteOn(channel, note)
  1670. def sendNoteOff(self, channel, note):
  1671. self.ui.edit_dialog.sendNoteOff(channel, note)
  1672. def setId(self, idx):
  1673. self.fPluginId = idx
  1674. self.ui.edit_dialog.fPluginId = idx
  1675. def setRefreshRate(self, rate):
  1676. self.ui.peak_in.setRefreshRate(rate)
  1677. self.ui.peak_out.setRefreshRate(rate)
  1678. def paintEvent(self, event):
  1679. painter = QPainter(self)
  1680. areaX = self.ui.led_control.x()
  1681. # bottom line
  1682. painter.setPen(self.fColorBottom)
  1683. painter.setBrush(self.fColorBottom)
  1684. painter.drawRect(0, self.height()-5, areaX, 5)
  1685. # top line
  1686. painter.drawLine(0, 0, areaX+40, 0)
  1687. # name -> leds arc
  1688. path = QPainterPath()
  1689. path.moveTo(areaX-80, self.height())
  1690. path.cubicTo(areaX+40, self.height()-5, areaX-40, 30, areaX+20, 0)
  1691. path.lineTo(areaX+20, self.height())
  1692. painter.drawPath(path)
  1693. # fill the rest
  1694. painter.drawRect(areaX+20, 0, self.width(), self.height())
  1695. #painter.drawLine(0, 3, self.width(), 3)
  1696. #painter.drawLine(0, self.height() - 4, self.width(), self.height() - 4)
  1697. #painter.setPen(self.m_color2)
  1698. #painter.drawLine(0, 2, self.width(), 2)
  1699. #painter.drawLine(0, self.height() - 3, self.width(), self.height() - 3)
  1700. #painter.setPen(self.m_color3)
  1701. #painter.drawLine(0, 1, self.width(), 1)
  1702. #painter.drawLine(0, self.height() - 2, self.width(), self.height() - 2)
  1703. #painter.setPen(self.m_color4)
  1704. #painter.drawLine(0, 0, self.width(), 0)
  1705. #painter.drawLine(0, self.height() - 1, self.width(), self.height() - 1)
  1706. QFrame.paintEvent(self, event)
  1707. @pyqtSlot(bool)
  1708. def slot_setActive(self, yesNo):
  1709. self.setActive(yesNo, False, True)
  1710. @pyqtSlot(bool)
  1711. def slot_guiClicked(self, show):
  1712. Carla.host.show_gui(self.fPluginId, show)
  1713. @pyqtSlot(bool)
  1714. def slot_editClicked(self, show):
  1715. self.ui.edit_dialog.setVisible(show)
  1716. @pyqtSlot()
  1717. def slot_upClicked(self):
  1718. pass
  1719. @pyqtSlot()
  1720. def slot_downClicked(self):
  1721. pass
  1722. @pyqtSlot()
  1723. def slot_restoreClicked(self):
  1724. pass
  1725. @pyqtSlot()
  1726. def slot_closeClicked(self):
  1727. Carla.host.remove_plugin(self.fPluginId)
  1728. # ------------------------------------------------------------------------------------------------------------
  1729. # Separate Thread for Plugin Search
  1730. class SearchPluginsThread(QThread):
  1731. def __init__(self, parent):
  1732. QThread.__init__(self, parent)
  1733. self.fCheckNative = False
  1734. self.fCheckPosix32 = False
  1735. self.fCheckPosix64 = False
  1736. self.fCheckWin32 = False
  1737. self.fCheckWin64 = False
  1738. self.fCheckLADSPA = False
  1739. self.fCheckDSSI = False
  1740. self.fCheckLV2 = False
  1741. self.fCheckVST = False
  1742. self.fCheckGIG = False
  1743. self.fCheckSF2 = False
  1744. self.fCheckSFZ = False
  1745. self.fToolNative = carla_discovery_native
  1746. self.fCurCount = 0
  1747. self.fCurPercentValue = 0
  1748. self.fLastCheckValue = 0
  1749. self.fSomethingChanged = False
  1750. def somethingChanged(self):
  1751. return self.fSomethingChanged
  1752. def skipPlugin(self):
  1753. # TODO - windows and mac support
  1754. apps = " carla-discovery"
  1755. apps += " carla-discovery-native"
  1756. apps += " carla-discovery-posix32"
  1757. apps += " carla-discovery-posix64"
  1758. apps += " carla-discovery-win32.exe"
  1759. apps += " carla-discovery-win64.exe"
  1760. if LINUX:
  1761. os.system("killall -KILL %s" % apps)
  1762. def setSearchBinaryTypes(self, native, posix32, posix64, win32, win64):
  1763. self.fCheckNative = native
  1764. self.fCheckPosix32 = posix32
  1765. self.fCheckPosix64 = posix64
  1766. self.fCheckWin32 = win32
  1767. self.fCheckWin64 = win64
  1768. def setSearchPluginTypes(self, ladspa, dssi, lv2, vst, gig, sf2, sfz):
  1769. self.fCheckLADSPA = ladspa
  1770. self.fCheckDSSI = dssi
  1771. self.fCheckLV2 = lv2
  1772. self.fCheckVST = vst
  1773. self.fCheckGIG = gig
  1774. self.fCheckSF2 = sf2
  1775. self.fCheckSFZ = sfz
  1776. def setSearchToolNative(self, tool):
  1777. self.fToolNative = tool
  1778. def run(self):
  1779. self.fCurCount = 0
  1780. pluginCount = 0
  1781. settingsDB = QSettings("falkTX", "CarlaPlugins")
  1782. if self.fCheckLADSPA: pluginCount += 1
  1783. if self.fCheckDSSI: pluginCount += 1
  1784. if self.fCheckLV2: pluginCount += 1
  1785. if self.fCheckVST: pluginCount += 1
  1786. if self.fCheckNative:
  1787. self.fCurCount += pluginCount
  1788. if self.fCheckPosix32:
  1789. self.fCurCount += pluginCount
  1790. if self.fCheckPosix64:
  1791. self.fCurCount += pluginCount
  1792. if self.fCheckWin32:
  1793. self.fCurCount += pluginCount
  1794. if self.fCheckWin64:
  1795. self.fCurCount += pluginCount
  1796. if self.fToolNative:
  1797. if self.fCheckGIG: self.fCurCount += 1
  1798. if self.fCheckSF2: self.fCurCount += 1
  1799. if self.fCheckSFZ: self.fCurCount += 1
  1800. else:
  1801. self.fCheckGIG = False
  1802. self.fCheckSF2 = False
  1803. self.fCheckSFZ = False
  1804. if self.fCurCount == 0:
  1805. return
  1806. self.fCurPercentValue = 100 / self.fCurCount
  1807. self.fLastCheckValue = 0
  1808. if HAIKU:
  1809. OS = "HAIKU"
  1810. elif LINUX:
  1811. OS = "LINUX"
  1812. elif MACOS:
  1813. OS = "MACOS"
  1814. elif WINDOWS:
  1815. OS = "WINDOWS"
  1816. else:
  1817. OS = "UNKNOWN"
  1818. if self.fCheckLADSPA:
  1819. checkValue = 0
  1820. if haveLRDF:
  1821. if self.fCheckNative: checkValue += 0.1
  1822. if self.fCheckPosix32: checkValue += 0.1
  1823. if self.fCheckPosix64: checkValue += 0.1
  1824. if self.fCheckWin32: checkValue += 0.1
  1825. if self.fCheckWin64: checkValue += 0.1
  1826. rdfPadValue = self.fCurPercentValue * checkValue
  1827. if self.fCheckNative:
  1828. self._checkLADSPA(OS, self.fToolNative)
  1829. settingsDB.setValue("Plugins/LADSPA_native", self.fLadspaPlugins)
  1830. settingsDB.sync()
  1831. if self.fCheckPosix32:
  1832. self._checkLADSPA(OS, carla_discovery_posix32)
  1833. settingsDB.setValue("Plugins/LADSPA_posix32", self.fLadspaPlugins)
  1834. settingsDB.sync()
  1835. if self.fCheckPosix64:
  1836. self._checkLADSPA(OS, carla_discovery_posix64)
  1837. settingsDB.setValue("Plugins/LADSPA_posix64", self.fLadspaPlugins)
  1838. settingsDB.sync()
  1839. if self.fCheckWin32:
  1840. self._checkLADSPA("WINDOWS", carla_discovery_win32, not WINDOWS)
  1841. settingsDB.setValue("Plugins/LADSPA_win32", self.fLadspaPlugins)
  1842. settingsDB.sync()
  1843. if self.fCheckWin64:
  1844. self._checkLADSPA("WINDOWS", carla_discovery_win64, not WINDOWS)
  1845. settingsDB.setValue("Plugins/LADSPA_win64", self.fLadspaPlugins)
  1846. settingsDB.sync()
  1847. if haveLRDF and checkValue > 0:
  1848. startValue = self.fLastCheckValue - rdfPadValue
  1849. self._pluginLook(startValue, "LADSPA RDFs...")
  1850. ladspaRdfInfo = ladspa_rdf.recheck_all_plugins(self, startValue, self.fCurPercentValue, checkValue)
  1851. SettingsDir = os.path.join(HOME, ".config", "falkTX")
  1852. fLadspa = open(os.path.join(SettingsDir, "ladspa_rdf.db"), 'w')
  1853. json.dump(ladspaRdfInfo, fLadspa)
  1854. fLadspa.close()
  1855. if self.fCheckDSSI:
  1856. if self.fCheckNative:
  1857. self._checkDSSI(OS, self.fToolNative)
  1858. settingsDB.setValue("Plugins/DSSI_native", self.fDssiPlugins)
  1859. settingsDB.sync()
  1860. if self.fCheckPosix32:
  1861. self._checkDSSI(OS, carla_discovery_posix32)
  1862. settingsDB.setValue("Plugins/DSSI_posix32", self.fDssiPlugins)
  1863. settingsDB.sync()
  1864. if self.fCheckPosix64:
  1865. self._checkDSSI(OS, carla_discovery_posix64)
  1866. settingsDB.setValue("Plugins/DSSI_posix64", self.fDssiPlugins)
  1867. settingsDB.sync()
  1868. if self.fCheckWin32:
  1869. self._checkDSSI("WINDOWS", carla_discovery_win32, not WINDOWS)
  1870. settingsDB.setValue("Plugins/DSSI_win32", self.fDssiPlugins)
  1871. settingsDB.sync()
  1872. if self.fCheckWin64:
  1873. self._checkDSSI("WINDOWS", carla_discovery_win64, not WINDOWS)
  1874. settingsDB.setValue("Plugins/DSSI_win64", self.fDssiPlugins)
  1875. settingsDB.sync()
  1876. if self.fCheckLV2:
  1877. if self.fCheckNative:
  1878. self._checkLV2(self.fToolNative)
  1879. settingsDB.setValue("Plugins/LV2_native", self.fLv2Plugins)
  1880. settingsDB.sync()
  1881. if self.fCheckPosix32:
  1882. self._checkLV2(carla_discovery_posix32)
  1883. settingsDB.setValue("Plugins/LV2_posix32", self.fLv2Plugins)
  1884. settingsDB.sync()
  1885. if self.fCheckPosix64:
  1886. self._checkLV2(carla_discovery_posix64)
  1887. settingsDB.setValue("Plugins/LV2_posix64", self.fLv2Plugins)
  1888. settingsDB.sync()
  1889. if self.fCheckWin32:
  1890. self._checkLV2(carla_discovery_win32, not WINDOWS)
  1891. settingsDB.setValue("Plugins/LV2_win32", self.fLv2Plugins)
  1892. settingsDB.sync()
  1893. if self.fCheckWin64:
  1894. self._checkLV2(carla_discovery_win64, not WINDOWS)
  1895. settingsDB.setValue("Plugins/LV2_win64", self.fLv2Plugins)
  1896. settingsDB.sync()
  1897. if self.fCheckVST:
  1898. if self.fCheckNative:
  1899. self._checkVST(OS, self.fToolNative)
  1900. settingsDB.setValue("Plugins/VST_native", self.fVstPlugins)
  1901. settingsDB.sync()
  1902. if self.fCheckPosix32:
  1903. self._checkVST(OS, carla_discovery_posix32)
  1904. settingsDB.setValue("Plugins/VST_posix32", self.fVstPlugins)
  1905. settingsDB.sync()
  1906. if self.fCheckPosix64:
  1907. self._checkVST(OS, carla_discovery_posix64)
  1908. settingsDB.setValue("Plugins/VST_posix64", self.fVstPlugins)
  1909. settingsDB.sync()
  1910. if self.fCheckWin32:
  1911. self._checkVST("WINDOWS", carla_discovery_win32, not WINDOWS)
  1912. settingsDB.setValue("Plugins/VST_win32", self.fVstPlugins)
  1913. settingsDB.sync()
  1914. if self.fCheckWin64:
  1915. self._checkVST("WINDOWS", carla_discovery_win64, not WINDOWS)
  1916. settingsDB.setValue("Plugins/VST_win64", self.fVstPlugins)
  1917. settingsDB.sync()
  1918. if self.fCheckGIG:
  1919. self._checkKIT(Carla.GIG_PATH, "gig")
  1920. settingsDB.setValue("Plugins/GIG", self.fKitPlugins)
  1921. settingsDB.sync()
  1922. if self.fCheckSF2:
  1923. self._checkKIT(Carla.SF2_PATH, "sf2")
  1924. settingsDB.setValue("Plugins/SF2", self.fKitPlugins)
  1925. settingsDB.sync()
  1926. if self.fCheckSFZ:
  1927. self._checkKIT(Carla.SFZ_PATH, "sfz")
  1928. settingsDB.setValue("Plugins/SFZ", self.fKitPlugins)
  1929. settingsDB.sync()
  1930. def _checkLADSPA(self, OS, tool, isWine=False):
  1931. ladspaBinaries = []
  1932. self.fLadspaPlugins = []
  1933. for iPATH in Carla.LADSPA_PATH:
  1934. binaries = findBinaries(iPATH, OS)
  1935. for binary in binaries:
  1936. if binary not in ladspaBinaries:
  1937. ladspaBinaries.append(binary)
  1938. ladspaBinaries.sort()
  1939. for i in range(len(ladspaBinaries)):
  1940. ladspa = ladspaBinaries[i]
  1941. percent = ( float(i) / len(ladspaBinaries) ) * self.fCurPercentValue
  1942. self._pluginLook((self.fLastCheckValue + percent) * 0.9, ladspa)
  1943. plugins = checkPluginLADSPA(ladspa, tool, isWine)
  1944. if plugins:
  1945. self.fLadspaPlugins.append(plugins)
  1946. self.fSomethingChanged = True
  1947. self.fLastCheckValue += self.fCurPercentValue
  1948. def _checkDSSI(self, OS, tool, isWine=False):
  1949. dssiBinaries = []
  1950. self.fDssiPlugins = []
  1951. for iPATH in Carla.DSSI_PATH:
  1952. binaries = findBinaries(iPATH, OS)
  1953. for binary in binaries:
  1954. if binary not in dssiBinaries:
  1955. dssiBinaries.append(binary)
  1956. dssiBinaries.sort()
  1957. for i in range(len(dssiBinaries)):
  1958. dssi = dssiBinaries[i]
  1959. percent = ( float(i) / len(dssiBinaries) ) * self.fCurPercentValue
  1960. self._pluginLook(self.fLastCheckValue + percent, dssi)
  1961. plugins = checkPluginDSSI(dssi, tool, isWine)
  1962. if plugins:
  1963. self.fDssiPlugins.append(plugins)
  1964. self.fSomethingChanged = True
  1965. self.fLastCheckValue += self.fCurPercentValue
  1966. def _checkLV2(self, tool, isWine=False):
  1967. lv2Bundles = []
  1968. self.fLv2Plugins = []
  1969. self._pluginLook(self.fLastCheckValue, "LV2 bundles...")
  1970. for iPATH in Carla.LV2_PATH:
  1971. bundles = findLV2Bundles(iPATH)
  1972. for bundle in bundles:
  1973. if bundle not in lv2Bundles:
  1974. lv2Bundles.append(bundle)
  1975. lv2Bundles.sort()
  1976. for i in range(len(lv2Bundles)):
  1977. lv2 = lv2Bundles[i]
  1978. percent = ( float(i) / len(lv2Bundles) ) * self.fCurPercentValue
  1979. self._pluginLook(self.fLastCheckValue + percent, lv2)
  1980. plugins = checkPluginLV2(lv2, tool, isWine)
  1981. if plugins:
  1982. self.fLv2Plugins.append(plugins)
  1983. self.fSomethingChanged = True
  1984. self.fLastCheckValue += self.fCurPercentValue
  1985. def _checkVST(self, OS, tool, isWine=False):
  1986. vstBinaries = []
  1987. self.fVstPlugins = []
  1988. for iPATH in Carla.VST_PATH:
  1989. binaries = findBinaries(iPATH, OS)
  1990. for binary in binaries:
  1991. if binary not in vstBinaries:
  1992. vstBinaries.append(binary)
  1993. vstBinaries.sort()
  1994. for i in range(len(vstBinaries)):
  1995. vst = vstBinaries[i]
  1996. percent = ( float(i) / len(vstBinaries) ) * self.fCurPercentValue
  1997. self._pluginLook(self.fLastCheckValue + percent, vst)
  1998. plugins = checkPluginVST(vst, tool, isWine)
  1999. if plugins:
  2000. self.fVstPlugins.append(plugins)
  2001. self.fSomethingChanged = True
  2002. self.fLastCheckValue += self.fCurPercentValue
  2003. def _checkKIT(self, kPATH, kType):
  2004. kitFiles = []
  2005. self.fKitPlugins = []
  2006. for iPATH in kPATH:
  2007. files = findSoundKits(iPATH, kType)
  2008. for file_ in files:
  2009. if file_ not in kitFiles:
  2010. kitFiles.append(file_)
  2011. kitFiles.sort()
  2012. for i in range(len(kitFiles)):
  2013. kit = kitFiles[i]
  2014. percent = ( float(i) / len(kitFiles) ) * self.fCurPercentValue
  2015. self._pluginLook(self.fLastCheckValue + percent, kit)
  2016. if kType == "gig":
  2017. plugins = checkPluginGIG(kit, self.fToolNative)
  2018. elif kType == "sf2":
  2019. plugins = checkPluginSF2(kit, self.fToolNative)
  2020. elif kType == "sfz":
  2021. plugins = checkPluginSFZ(kit, self.fToolNative)
  2022. else:
  2023. plugins = None
  2024. if plugins:
  2025. self.fKitPlugins.append(plugins)
  2026. self.fSomethingChanged = True
  2027. self.fLastCheckValue += self.fCurPercentValue
  2028. def _pluginLook(self, percent, plugin):
  2029. self.emit(SIGNAL("PluginLook(int, QString)"), percent, plugin)
  2030. # ------------------------------------------------------------------------------------------------------------
  2031. # Plugin Refresh Dialog
  2032. class PluginRefreshW(QDialog):
  2033. def __init__(self, parent):
  2034. QDialog.__init__(self, parent)
  2035. self.ui = ui_carla_refresh.Ui_PluginRefreshW()
  2036. self.ui.setupUi(self)
  2037. self._loadSettings()
  2038. self.ui.b_skip.setVisible(False)
  2039. if HAIKU:
  2040. self.ui.ch_posix32.setText("Haiku 32bit")
  2041. self.ui.ch_posix64.setText("Haiku 64bit")
  2042. elif LINUX:
  2043. self.ui.ch_posix32.setText("Linux 32bit")
  2044. self.ui.ch_posix64.setText("Linux 64bit")
  2045. elif MACOS:
  2046. self.ui.ch_posix32.setText("MacOS 32bit")
  2047. self.ui.ch_posix64.setText("MacOS 64bit")
  2048. self.fThread = SearchPluginsThread(self)
  2049. if carla_discovery_posix32 and not WINDOWS:
  2050. self.ui.ico_posix32.setPixmap(getIcon("dialog-ok-apply").pixmap(16, 16))
  2051. else:
  2052. self.ui.ico_posix32.setPixmap(getIcon("dialog-error").pixmap(16, 16))
  2053. self.ui.ch_posix32.setChecked(False)
  2054. self.ui.ch_posix32.setEnabled(False)
  2055. if carla_discovery_posix64 and not WINDOWS:
  2056. self.ui.ico_posix64.setPixmap(getIcon("dialog-ok-apply").pixmap(16, 16))
  2057. else:
  2058. self.ui.ico_posix64.setPixmap(getIcon("dialog-error").pixmap(16, 16))
  2059. self.ui.ch_posix64.setChecked(False)
  2060. self.ui.ch_posix64.setEnabled(False)
  2061. if carla_discovery_win32:
  2062. self.ui.ico_win32.setPixmap(getIcon("dialog-ok-apply").pixmap(16, 16))
  2063. else:
  2064. self.ui.ico_win32.setPixmap(getIcon("dialog-error").pixmap(16, 16))
  2065. self.ui.ch_win32.setChecked(False)
  2066. self.ui.ch_win32.setEnabled(False)
  2067. if carla_discovery_win64:
  2068. self.ui.ico_win64.setPixmap(getIcon("dialog-ok-apply").pixmap(16, 16))
  2069. else:
  2070. self.ui.ico_win64.setPixmap(getIcon("dialog-error").pixmap(16, 16))
  2071. self.ui.ch_win64.setChecked(False)
  2072. self.ui.ch_win64.setEnabled(False)
  2073. if haveLRDF:
  2074. self.ui.ico_rdflib.setPixmap(getIcon("dialog-ok-apply").pixmap(16, 16))
  2075. else:
  2076. self.ui.ico_rdflib.setPixmap(getIcon("dialog-error").pixmap(16, 16))
  2077. hasNative = bool(carla_discovery_native)
  2078. hasNonNative = False
  2079. if WINDOWS:
  2080. if kIs64bit:
  2081. hasNative = bool(carla_discovery_win64)
  2082. hasNonNative = bool(carla_discovery_win32)
  2083. self.fThread.setSearchToolNative(carla_discovery_win64)
  2084. self.ui.ch_win64.setChecked(False)
  2085. self.ui.ch_win64.setVisible(False)
  2086. self.ui.ico_win64.setVisible(False)
  2087. self.ui.label_win64.setVisible(False)
  2088. else:
  2089. hasNative = bool(carla_discovery_win32)
  2090. hasNonNative = bool(carla_discovery_win64)
  2091. self.fThread.setSearchToolNative(carla_discovery_win32)
  2092. self.ui.ch_win32.setChecked(False)
  2093. self.ui.ch_win32.setVisible(False)
  2094. self.ui.ico_win32.setVisible(False)
  2095. self.ui.label_win32.setVisible(False)
  2096. elif LINUX or MACOS:
  2097. if kIs64bit:
  2098. hasNonNative = bool(carla_discovery_posix32 or carla_discovery_win32 or carla_discovery_win64)
  2099. self.ui.ch_posix64.setChecked(False)
  2100. self.ui.ch_posix64.setVisible(False)
  2101. self.ui.ico_posix64.setVisible(False)
  2102. self.ui.label_posix64.setVisible(False)
  2103. else:
  2104. hasNonNative = bool(carla_discovery_posix64 or carla_discovery_win32 or carla_discovery_win64)
  2105. self.ui.ch_posix32.setChecked(False)
  2106. self.ui.ch_posix32.setVisible(False)
  2107. self.ui.ico_posix32.setVisible(False)
  2108. self.ui.label_posix32.setVisible(False)
  2109. if hasNative:
  2110. self.ui.ico_native.setPixmap(getIcon("dialog-ok-apply").pixmap(16, 16))
  2111. else:
  2112. self.ui.ico_native.setPixmap(getIcon("dialog-error").pixmap(16, 16))
  2113. self.ui.ch_native.setChecked(False)
  2114. self.ui.ch_native.setEnabled(False)
  2115. self.ui.ch_gig.setChecked(False)
  2116. self.ui.ch_gig.setEnabled(False)
  2117. self.ui.ch_sf2.setChecked(False)
  2118. self.ui.ch_sf2.setEnabled(False)
  2119. self.ui.ch_sfz.setChecked(False)
  2120. self.ui.ch_sfz.setEnabled(False)
  2121. if not hasNonNative:
  2122. self.ui.ch_ladspa.setChecked(False)
  2123. self.ui.ch_ladspa.setEnabled(False)
  2124. self.ui.ch_dssi.setChecked(False)
  2125. self.ui.ch_dssi.setEnabled(False)
  2126. self.ui.ch_lv2.setChecked(False)
  2127. self.ui.ch_lv2.setEnabled(False)
  2128. self.ui.ch_vst.setChecked(False)
  2129. self.ui.ch_vst.setEnabled(False)
  2130. self.ui.b_start.setEnabled(False)
  2131. #TODO
  2132. self.ui.ch_lv2.setChecked(False)
  2133. self.connect(self.ui.b_start, SIGNAL("clicked()"), SLOT("slot_start()"))
  2134. self.connect(self.ui.b_skip, SIGNAL("clicked()"), SLOT("slot_skip()"))
  2135. self.connect(self.fThread, SIGNAL("PluginLook(int, QString)"), SLOT("slot_handlePluginLook(int, QString)"))
  2136. self.connect(self.fThread, SIGNAL("finished()"), SLOT("slot_handlePluginThreadFinished()"))
  2137. @pyqtSlot()
  2138. def slot_start(self):
  2139. self.ui.progressBar.setMinimum(0)
  2140. self.ui.progressBar.setMaximum(100)
  2141. self.ui.progressBar.setValue(0)
  2142. self.ui.b_start.setEnabled(False)
  2143. self.ui.b_skip.setVisible(True)
  2144. self.ui.b_close.setVisible(False)
  2145. native, posix32, posix64, win32, win64 = (self.ui.ch_native.isChecked(), self.ui.ch_posix32.isChecked(), self.ui.ch_posix64.isChecked(), self.ui.ch_win32.isChecked(), self.ui.ch_win64.isChecked())
  2146. ladspa, dssi, lv2, vst, gig, sf2, sfz = (self.ui.ch_ladspa.isChecked(), self.ui.ch_dssi.isChecked(), self.ui.ch_lv2.isChecked(), self.ui.ch_vst.isChecked(),
  2147. self.ui.ch_gig.isChecked(), self.ui.ch_sf2.isChecked(), self.ui.ch_sfz.isChecked())
  2148. self.fThread.setSearchBinaryTypes(native, posix32, posix64, win32, win64)
  2149. self.fThread.setSearchPluginTypes(ladspa, dssi, lv2, vst, gig, sf2, sfz)
  2150. self.fThread.start()
  2151. @pyqtSlot()
  2152. def slot_skip(self):
  2153. self.fThread.skipPlugin()
  2154. @pyqtSlot(int, str)
  2155. def slot_handlePluginLook(self, percent, plugin):
  2156. self.ui.progressBar.setFormat("%s" % plugin)
  2157. self.ui.progressBar.setValue(percent)
  2158. @pyqtSlot()
  2159. def slot_handlePluginThreadFinished(self):
  2160. self.ui.progressBar.setMinimum(0)
  2161. self.ui.progressBar.setMaximum(1)
  2162. self.ui.progressBar.setValue(1)
  2163. self.ui.progressBar.setFormat(self.tr("Done"))
  2164. self.ui.b_start.setEnabled(True)
  2165. self.ui.b_skip.setVisible(False)
  2166. self.ui.b_close.setVisible(True)
  2167. def _saveSettings(self):
  2168. settings = QSettings()
  2169. settings.setValue("PluginDatabase/SearchLADSPA", self.ui.ch_ladspa.isChecked())
  2170. settings.setValue("PluginDatabase/SearchDSSI", self.ui.ch_dssi.isChecked())
  2171. settings.setValue("PluginDatabase/SearchLV2", self.ui.ch_lv2.isChecked())
  2172. settings.setValue("PluginDatabase/SearchVST", self.ui.ch_vst.isChecked())
  2173. settings.setValue("PluginDatabase/SearchGIG", self.ui.ch_gig.isChecked())
  2174. settings.setValue("PluginDatabase/SearchSF2", self.ui.ch_sf2.isChecked())
  2175. settings.setValue("PluginDatabase/SearchSFZ", self.ui.ch_sfz.isChecked())
  2176. settings.setValue("PluginDatabase/SearchNative", self.ui.ch_native.isChecked())
  2177. settings.setValue("PluginDatabase/SearchPOSIX32", self.ui.ch_posix32.isChecked())
  2178. settings.setValue("PluginDatabase/SearchPOSIX64", self.ui.ch_posix64.isChecked())
  2179. settings.setValue("PluginDatabase/SearchWin32", self.ui.ch_win32.isChecked())
  2180. settings.setValue("PluginDatabase/SearchWin64", self.ui.ch_win64.isChecked())
  2181. def _loadSettings(self):
  2182. settings = QSettings()
  2183. self.ui.ch_ladspa.setChecked(settings.value("PluginDatabase/SearchLADSPA", True, type=bool))
  2184. self.ui.ch_dssi.setChecked(settings.value("PluginDatabase/SearchDSSI", True, type=bool))
  2185. self.ui.ch_lv2.setChecked(settings.value("PluginDatabase/SearchLV2", True, type=bool))
  2186. self.ui.ch_vst.setChecked(settings.value("PluginDatabase/SearchVST", True, type=bool))
  2187. self.ui.ch_gig.setChecked(settings.value("PluginDatabase/SearchGIG", False, type=bool))
  2188. self.ui.ch_sf2.setChecked(settings.value("PluginDatabase/SearchSF2", False, type=bool))
  2189. self.ui.ch_sfz.setChecked(settings.value("PluginDatabase/SearchSFZ", False, type=bool))
  2190. self.ui.ch_native.setChecked(settings.value("PluginDatabase/SearchNative", True, type=bool))
  2191. self.ui.ch_posix32.setChecked(settings.value("PluginDatabase/SearchPOSIX32", False, type=bool))
  2192. self.ui.ch_posix64.setChecked(settings.value("PluginDatabase/SearchPOSIX64", False, type=bool))
  2193. self.ui.ch_win32.setChecked(settings.value("PluginDatabase/SearchWin32", False, type=bool))
  2194. self.ui.ch_win64.setChecked(settings.value("PluginDatabase/SearchWin64", False, type=bool))
  2195. def closeEvent(self, event):
  2196. if self.fThread.isRunning():
  2197. self.fThread.terminate()
  2198. self.fThread.wait()
  2199. self._saveSettings()
  2200. if self.fThread.somethingChanged():
  2201. self.accept()
  2202. else:
  2203. self.reject()
  2204. QDialog.closeEvent(self, event)
  2205. def done(self, r):
  2206. QDialog.done(self, r)
  2207. self.close()
  2208. # ------------------------------------------------------------------------------------------------------------
  2209. # Plugin Database Dialog
  2210. class PluginDatabaseW(QDialog):
  2211. def __init__(self, parent):
  2212. QDialog.__init__(self, parent)
  2213. self.ui = ui_carla_database.Ui_PluginDatabaseW()
  2214. self.ui.setupUi(self)
  2215. self.fLastTableIndex = 0
  2216. self.fRetPlugin = None
  2217. self.fRealParent = parent
  2218. self.ui.b_add.setEnabled(False)
  2219. if BINARY_NATIVE in (BINARY_POSIX32, BINARY_WIN32):
  2220. self.ui.ch_bridged.setText(self.tr("Bridged (64bit)"))
  2221. else:
  2222. self.ui.ch_bridged.setText(self.tr("Bridged (32bit)"))
  2223. if not (LINUX or MACOS):
  2224. self.ui.ch_bridged_wine.setChecked(False)
  2225. self.ui.ch_bridged_wine.setEnabled(False)
  2226. self._loadSettings()
  2227. self.connect(self.ui.b_add, SIGNAL("clicked()"), SLOT("slot_addPlugin()"))
  2228. self.connect(self.ui.b_refresh, SIGNAL("clicked()"), SLOT("slot_refreshPlugins()"))
  2229. self.connect(self.ui.tb_filters, SIGNAL("clicked()"), SLOT("slot_maybeShowFilters()"))
  2230. self.connect(self.ui.tableWidget, SIGNAL("currentCellChanged(int, int, int, int)"), SLOT("slot_checkPlugin(int)"))
  2231. self.connect(self.ui.tableWidget, SIGNAL("cellDoubleClicked(int, int)"), SLOT("slot_addPlugin()"))
  2232. self.connect(self.ui.lineEdit, SIGNAL("textChanged(QString)"), SLOT("slot_checkFilters()"))
  2233. self.connect(self.ui.ch_effects, SIGNAL("clicked()"), SLOT("slot_checkFilters()"))
  2234. self.connect(self.ui.ch_instruments, SIGNAL("clicked()"), SLOT("slot_checkFilters()"))
  2235. self.connect(self.ui.ch_midi, SIGNAL("clicked()"), SLOT("slot_checkFilters()"))
  2236. self.connect(self.ui.ch_other, SIGNAL("clicked()"), SLOT("slot_checkFilters()"))
  2237. self.connect(self.ui.ch_kits, SIGNAL("clicked()"), SLOT("slot_checkFilters()"))
  2238. self.connect(self.ui.ch_internal, SIGNAL("clicked()"), SLOT("slot_checkFilters()"))
  2239. self.connect(self.ui.ch_ladspa, SIGNAL("clicked()"), SLOT("slot_checkFilters()"))
  2240. self.connect(self.ui.ch_dssi, SIGNAL("clicked()"), SLOT("slot_checkFilters()"))
  2241. self.connect(self.ui.ch_lv2, SIGNAL("clicked()"), SLOT("slot_checkFilters()"))
  2242. self.connect(self.ui.ch_vst, SIGNAL("clicked()"), SLOT("slot_checkFilters()"))
  2243. self.connect(self.ui.ch_native, SIGNAL("clicked()"), SLOT("slot_checkFilters()"))
  2244. self.connect(self.ui.ch_bridged, SIGNAL("clicked()"), SLOT("slot_checkFilters()"))
  2245. self.connect(self.ui.ch_bridged_wine, SIGNAL("clicked()"), SLOT("slot_checkFilters()"))
  2246. self.connect(self.ui.ch_gui, SIGNAL("clicked()"), SLOT("slot_checkFilters()"))
  2247. self.connect(self.ui.ch_stereo, SIGNAL("clicked()"), SLOT("slot_checkFilters()"))
  2248. @pyqtSlot()
  2249. def slot_addPlugin(self):
  2250. if self.ui.tableWidget.currentRow() >= 0:
  2251. self.fRetPlugin = self.ui.tableWidget.item(self.ui.tableWidget.currentRow(), 0).pluginData
  2252. self.accept()
  2253. else:
  2254. self.reject()
  2255. @pyqtSlot(int)
  2256. def slot_checkPlugin(self, row):
  2257. self.ui.b_add.setEnabled(row >= 0)
  2258. @pyqtSlot()
  2259. def slot_checkFilters(self):
  2260. self._checkFilters()
  2261. @pyqtSlot()
  2262. def slot_maybeShowFilters(self):
  2263. self._showFilters(not self.ui.frame.isVisible())
  2264. @pyqtSlot()
  2265. def slot_refreshPlugins(self):
  2266. if PluginRefreshW(self).exec_():
  2267. self._reAddPlugins()
  2268. if self.fRealParent:
  2269. self.fRealParent.loadRDFs()
  2270. def _checkFilters(self):
  2271. text = self.ui.lineEdit.text().lower()
  2272. hideEffects = not self.ui.ch_effects.isChecked()
  2273. hideInstruments = not self.ui.ch_instruments.isChecked()
  2274. hideMidi = not self.ui.ch_midi.isChecked()
  2275. hideOther = not self.ui.ch_other.isChecked()
  2276. hideInternal = not self.ui.ch_internal.isChecked()
  2277. hideLadspa = not self.ui.ch_ladspa.isChecked()
  2278. hideDssi = not self.ui.ch_dssi.isChecked()
  2279. hideLV2 = not self.ui.ch_lv2.isChecked()
  2280. hideVST = not self.ui.ch_vst.isChecked()
  2281. hideKits = not self.ui.ch_kits.isChecked()
  2282. hideNative = not self.ui.ch_native.isChecked()
  2283. hideBridged = not self.ui.ch_bridged.isChecked()
  2284. hideBridgedWine = not self.ui.ch_bridged_wine.isChecked()
  2285. hideNonGui = self.ui.ch_gui.isChecked()
  2286. hideNonStereo = self.ui.ch_stereo.isChecked()
  2287. if HAIKU or LINUX or MACOS:
  2288. nativeBins = [BINARY_POSIX32, BINARY_POSIX64]
  2289. wineBins = [BINARY_WIN32, BINARY_WIN64]
  2290. elif WINDOWS:
  2291. nativeBins = [BINARY_WIN32, BINARY_WIN64]
  2292. wineBins = []
  2293. else:
  2294. nativeBins = []
  2295. wineBins = []
  2296. rowCount = self.ui.tableWidget.rowCount()
  2297. for i in range(rowCount):
  2298. self.ui.tableWidget.showRow(i)
  2299. plugin = self.ui.tableWidget.item(i, 0).pluginData
  2300. aIns = plugin['audio.ins']
  2301. aOuts = plugin['audio.outs']
  2302. mIns = plugin['midi.ins']
  2303. mOuts = plugin['midi.outs']
  2304. ptype = self.ui.tableWidget.item(i, 12).text()
  2305. isSynth = bool(plugin['hints'] & PLUGIN_IS_SYNTH)
  2306. isEffect = bool(aIns > 0 < aOuts and not isSynth)
  2307. isMidi = bool(aIns == 0 and aOuts == 0 and mIns > 0 < mOuts)
  2308. isKit = bool(ptype in ("GIG", "SF2", "SFZ"))
  2309. isOther = bool(not (isEffect or isSynth or isMidi or isKit))
  2310. isNative = bool(plugin['build'] == BINARY_NATIVE)
  2311. isStereo = bool(aIns == 2 and aOuts == 2) or (isSynth and aOuts == 2)
  2312. hasGui = bool(plugin['hints'] & PLUGIN_HAS_GUI)
  2313. isBridged = bool(not isNative and plugin['build'] in nativeBins)
  2314. isBridgedWine = bool(not isNative and plugin['build'] in wineBins)
  2315. if (hideEffects and isEffect):
  2316. self.ui.tableWidget.hideRow(i)
  2317. elif (hideInstruments and isSynth):
  2318. self.ui.tableWidget.hideRow(i)
  2319. elif (hideMidi and isMidi):
  2320. self.ui.tableWidget.hideRow(i)
  2321. elif (hideOther and isOther):
  2322. self.ui.tableWidget.hideRow(i)
  2323. elif (hideKits and isKit):
  2324. self.ui.tableWidget.hideRow(i)
  2325. elif (hideInternal and ptype == self.tr("Internal")):
  2326. self.ui.tableWidget.hideRow(i)
  2327. elif (hideLadspa and ptype == "LADSPA"):
  2328. self.ui.tableWidget.hideRow(i)
  2329. elif (hideDssi and ptype == "DSSI"):
  2330. self.ui.tableWidget.hideRow(i)
  2331. elif (hideLV2 and ptype == "LV2"):
  2332. self.ui.tableWidget.hideRow(i)
  2333. elif (hideVST and ptype == "VST"):
  2334. self.ui.tableWidget.hideRow(i)
  2335. elif (hideNative and isNative):
  2336. self.ui.tableWidget.hideRow(i)
  2337. elif (hideBridged and isBridged):
  2338. self.ui.tableWidget.hideRow(i)
  2339. elif (hideBridgedWine and isBridgedWine):
  2340. self.ui.tableWidget.hideRow(i)
  2341. elif (hideNonGui and not hasGui):
  2342. self.ui.tableWidget.hideRow(i)
  2343. elif (hideNonStereo and not isStereo):
  2344. self.ui.tableWidget.hideRow(i)
  2345. elif (text and not (
  2346. text in self.ui.tableWidget.item(i, 0).text().lower() or
  2347. text in self.ui.tableWidget.item(i, 1).text().lower() or
  2348. text in self.ui.tableWidget.item(i, 2).text().lower() or
  2349. text in self.ui.tableWidget.item(i, 3).text().lower() or
  2350. text in self.ui.tableWidget.item(i, 13).text().lower())):
  2351. self.ui.tableWidget.hideRow(i)
  2352. def _showFilters(self, yesNo):
  2353. self.ui.tb_filters.setArrowType(Qt.UpArrow if yesNo else Qt.DownArrow)
  2354. self.ui.frame.setVisible(yesNo)
  2355. def _reAddPlugins(self):
  2356. settingsDB = QSettings("falkTX", "CarlaPlugins")
  2357. rowCount = self.ui.tableWidget.rowCount()
  2358. for x in range(rowCount):
  2359. self.ui.tableWidget.removeRow(0)
  2360. self.fLastTableIndex = 0
  2361. self.ui.tableWidget.setSortingEnabled(False)
  2362. internalCount = 0
  2363. ladspaCount = 0
  2364. dssiCount = 0
  2365. lv2Count = 0
  2366. vstCount = 0
  2367. kitCount = 0
  2368. # ---------------------------------------------------------------------------
  2369. # Internal
  2370. internalPlugins = toList(settingsDB.value("Plugins/Internal", []))
  2371. for plugins in internalPlugins:
  2372. for plugin in plugins:
  2373. internalCount += 1
  2374. if (not Carla.isControl) and internalCount != Carla.host.get_internal_plugin_count():
  2375. internalCount = Carla.host.get_internal_plugin_count()
  2376. internalPlugins = []
  2377. for i in range(Carla.host.get_internal_plugin_count()):
  2378. descInfo = Carla.host.get_internal_plugin_info(i)
  2379. plugins = checkPluginInternal(descInfo)
  2380. if plugins:
  2381. internalPlugins.append(plugins)
  2382. settingsDB.setValue("Plugins/Internal", internalPlugins)
  2383. for plugins in internalPlugins:
  2384. for plugin in plugins:
  2385. self._addPluginToTable(plugin, self.tr("Internal"))
  2386. # ---------------------------------------------------------------------------
  2387. # LADSPA
  2388. ladspaPlugins = []
  2389. ladspaPlugins += toList(settingsDB.value("Plugins/LADSPA_native", []))
  2390. ladspaPlugins += toList(settingsDB.value("Plugins/LADSPA_posix32", []))
  2391. ladspaPlugins += toList(settingsDB.value("Plugins/LADSPA_posix64", []))
  2392. ladspaPlugins += toList(settingsDB.value("Plugins/LADSPA_win32", []))
  2393. ladspaPlugins += toList(settingsDB.value("Plugins/LADSPA_win64", []))
  2394. for plugins in ladspaPlugins:
  2395. for plugin in plugins:
  2396. self._addPluginToTable(plugin, "LADSPA")
  2397. ladspaCount += 1
  2398. # ---------------------------------------------------------------------------
  2399. # DSSI
  2400. dssiPlugins = []
  2401. dssiPlugins += toList(settingsDB.value("Plugins/DSSI_native", []))
  2402. dssiPlugins += toList(settingsDB.value("Plugins/DSSI_posix32", []))
  2403. dssiPlugins += toList(settingsDB.value("Plugins/DSSI_posix64", []))
  2404. dssiPlugins += toList(settingsDB.value("Plugins/DSSI_win32", []))
  2405. dssiPlugins += toList(settingsDB.value("Plugins/DSSI_win64", []))
  2406. for plugins in dssiPlugins:
  2407. for plugin in plugins:
  2408. self._addPluginToTable(plugin, "DSSI")
  2409. dssiCount += 1
  2410. # ---------------------------------------------------------------------------
  2411. # LV2
  2412. lv2Plugins = []
  2413. lv2Plugins += toList(settingsDB.value("Plugins/LV2_native", []))
  2414. lv2Plugins += toList(settingsDB.value("Plugins/LV2_posix32", []))
  2415. lv2Plugins += toList(settingsDB.value("Plugins/LV2_posix64", []))
  2416. lv2Plugins += toList(settingsDB.value("Plugins/LV2_win32", []))
  2417. lv2Plugins += toList(settingsDB.value("Plugins/LV2_win64", []))
  2418. for plugins in lv2Plugins:
  2419. for plugin in plugins:
  2420. self._addPluginToTable(plugin, "LV2")
  2421. lv2Count += 1
  2422. # ---------------------------------------------------------------------------
  2423. # VST
  2424. vstPlugins = []
  2425. vstPlugins += toList(settingsDB.value("Plugins/VST_native", []))
  2426. vstPlugins += toList(settingsDB.value("Plugins/VST_posix32", []))
  2427. vstPlugins += toList(settingsDB.value("Plugins/VST_posix64", []))
  2428. vstPlugins += toList(settingsDB.value("Plugins/VST_win32", []))
  2429. vstPlugins += toList(settingsDB.value("Plugins/VST_win64", []))
  2430. for plugins in vstPlugins:
  2431. for plugin in plugins:
  2432. self._addPluginToTable(plugin, "VST")
  2433. vstCount += 1
  2434. # ---------------------------------------------------------------------------
  2435. # Kits
  2436. gigs = toList(settingsDB.value("Plugins/GIG", []))
  2437. sf2s = toList(settingsDB.value("Plugins/SF2", []))
  2438. sfzs = toList(settingsDB.value("Plugins/SFZ", []))
  2439. for gig in gigs:
  2440. for gig_i in gig:
  2441. self._addPluginToTable(gig_i, "GIG")
  2442. kitCount += 1
  2443. for sf2 in sf2s:
  2444. for sf2_i in sf2:
  2445. self._addPluginToTable(sf2_i, "SF2")
  2446. kitCount += 1
  2447. for sfz in sfzs:
  2448. for sfz_i in sfz:
  2449. self._addPluginToTable(sfz_i, "SFZ")
  2450. kitCount += 1
  2451. # ---------------------------------------------------------------------------
  2452. self.ui.tableWidget.setSortingEnabled(True)
  2453. self.ui.tableWidget.sortByColumn(0, Qt.AscendingOrder)
  2454. self.ui.label.setText(self.tr("Have %i Internal, %i LADSPA, %i DSSI, %i LV2, %i VST and %i Sound Kits" % (internalCount, ladspaCount, dssiCount, lv2Count, vstCount, kitCount)))
  2455. self._checkFilters()
  2456. def _addPluginToTable(self, plugin, ptype):
  2457. index = self.fLastTableIndex
  2458. if plugin['build'] == BINARY_NATIVE:
  2459. bridgeText = self.tr("No")
  2460. else:
  2461. typeText = self.tr("Unknown")
  2462. if LINUX or MACOS:
  2463. if plugin['build'] == BINARY_POSIX32:
  2464. typeText = "32bit"
  2465. elif plugin['build'] == BINARY_POSIX64:
  2466. typeText = "64bit"
  2467. elif plugin['build'] == BINARY_WIN32:
  2468. typeText = "Windows 32bit"
  2469. elif plugin['build'] == BINARY_WIN64:
  2470. typeText = "Windows 64bit"
  2471. elif WINDOWS:
  2472. if plugin['build'] == BINARY_WIN32:
  2473. typeText = "32bit"
  2474. elif plugin['build'] == BINARY_WIN64:
  2475. typeText = "64bit"
  2476. bridgeText = self.tr("Yes (%s)" % typeText)
  2477. self.ui.tableWidget.insertRow(index)
  2478. self.ui.tableWidget.setItem(index, 0, QTableWidgetItem(str(plugin['name'])))
  2479. self.ui.tableWidget.setItem(index, 1, QTableWidgetItem(str(plugin['label'])))
  2480. self.ui.tableWidget.setItem(index, 2, QTableWidgetItem(str(plugin['maker'])))
  2481. self.ui.tableWidget.setItem(index, 3, QTableWidgetItem(str(plugin['uniqueId'])))
  2482. self.ui.tableWidget.setItem(index, 4, QTableWidgetItem(str(plugin['audio.ins'])))
  2483. self.ui.tableWidget.setItem(index, 5, QTableWidgetItem(str(plugin['audio.outs'])))
  2484. self.ui.tableWidget.setItem(index, 6, QTableWidgetItem(str(plugin['parameters.ins'])))
  2485. self.ui.tableWidget.setItem(index, 7, QTableWidgetItem(str(plugin['parameters.outs'])))
  2486. self.ui.tableWidget.setItem(index, 8, QTableWidgetItem(str(plugin['programs.total'])))
  2487. self.ui.tableWidget.setItem(index, 9, QTableWidgetItem(self.tr("Yes") if (plugin['hints'] & PLUGIN_HAS_GUI) else self.tr("No")))
  2488. self.ui.tableWidget.setItem(index, 10, QTableWidgetItem(self.tr("Yes") if (plugin['hints'] & PLUGIN_IS_SYNTH) else self.tr("No")))
  2489. self.ui.tableWidget.setItem(index, 11, QTableWidgetItem(bridgeText))
  2490. self.ui.tableWidget.setItem(index, 12, QTableWidgetItem(ptype))
  2491. self.ui.tableWidget.setItem(index, 13, QTableWidgetItem(str(plugin['binary'])))
  2492. self.ui.tableWidget.item(self.fLastTableIndex, 0).pluginData = plugin
  2493. self.fLastTableIndex += 1
  2494. def _saveSettings(self):
  2495. settings = QSettings()
  2496. settings.setValue("PluginDatabase/Geometry", self.saveGeometry())
  2497. settings.setValue("PluginDatabase/TableGeometry", self.ui.tableWidget.horizontalHeader().saveState())
  2498. settings.setValue("PluginDatabase/ShowFilters", (self.ui.tb_filters.arrowType() == Qt.UpArrow))
  2499. settings.setValue("PluginDatabase/ShowEffects", self.ui.ch_effects.isChecked())
  2500. settings.setValue("PluginDatabase/ShowInstruments", self.ui.ch_instruments.isChecked())
  2501. settings.setValue("PluginDatabase/ShowMIDI", self.ui.ch_midi.isChecked())
  2502. settings.setValue("PluginDatabase/ShowOther", self.ui.ch_other.isChecked())
  2503. settings.setValue("PluginDatabase/ShowInternal", self.ui.ch_internal.isChecked())
  2504. settings.setValue("PluginDatabase/ShowLADSPA", self.ui.ch_ladspa.isChecked())
  2505. settings.setValue("PluginDatabase/ShowDSSI", self.ui.ch_dssi.isChecked())
  2506. settings.setValue("PluginDatabase/ShowLV2", self.ui.ch_lv2.isChecked())
  2507. settings.setValue("PluginDatabase/ShowVST", self.ui.ch_vst.isChecked())
  2508. settings.setValue("PluginDatabase/ShowKits", self.ui.ch_kits.isChecked())
  2509. settings.setValue("PluginDatabase/ShowNative", self.ui.ch_native.isChecked())
  2510. settings.setValue("PluginDatabase/ShowBridged", self.ui.ch_bridged.isChecked())
  2511. settings.setValue("PluginDatabase/ShowBridgedWine", self.ui.ch_bridged_wine.isChecked())
  2512. settings.setValue("PluginDatabase/ShowHasGUI", self.ui.ch_gui.isChecked())
  2513. settings.setValue("PluginDatabase/ShowStereoOnly", self.ui.ch_stereo.isChecked())
  2514. def _loadSettings(self):
  2515. settings = QSettings()
  2516. self.restoreGeometry(settings.value("PluginDatabase/Geometry", ""))
  2517. self.ui.tableWidget.horizontalHeader().restoreState(settings.value("PluginDatabase/TableGeometry", ""))
  2518. self.ui.ch_effects.setChecked(settings.value("PluginDatabase/ShowEffects", True, type=bool))
  2519. self.ui.ch_instruments.setChecked(settings.value("PluginDatabase/ShowInstruments", True, type=bool))
  2520. self.ui.ch_midi.setChecked(settings.value("PluginDatabase/ShowMIDI", True, type=bool))
  2521. self.ui.ch_other.setChecked(settings.value("PluginDatabase/ShowOther", True, type=bool))
  2522. self.ui.ch_internal.setChecked(settings.value("PluginDatabase/ShowInternal", True, type=bool))
  2523. self.ui.ch_ladspa.setChecked(settings.value("PluginDatabase/ShowLADSPA", True, type=bool))
  2524. self.ui.ch_dssi.setChecked(settings.value("PluginDatabase/ShowDSSI", True, type=bool))
  2525. self.ui.ch_lv2.setChecked(settings.value("PluginDatabase/ShowLV2", True, type=bool))
  2526. self.ui.ch_vst.setChecked(settings.value("PluginDatabase/ShowVST", True, type=bool))
  2527. self.ui.ch_kits.setChecked(settings.value("PluginDatabase/ShowKits", True, type=bool))
  2528. self.ui.ch_native.setChecked(settings.value("PluginDatabase/ShowNative", True, type=bool))
  2529. self.ui.ch_bridged.setChecked(settings.value("PluginDatabase/ShowBridged", True, type=bool))
  2530. self.ui.ch_bridged_wine.setChecked(settings.value("PluginDatabase/ShowBridgedWine", True, type=bool))
  2531. self.ui.ch_gui.setChecked(settings.value("PluginDatabase/ShowHasGUI", False, type=bool))
  2532. self.ui.ch_stereo.setChecked(settings.value("PluginDatabase/ShowStereoOnly", False, type=bool))
  2533. self._showFilters(settings.value("PluginDatabase/ShowFilters", False, type=bool))
  2534. self._reAddPlugins()
  2535. def closeEvent(self, event):
  2536. self._saveSettings()
  2537. QDialog.closeEvent(self, event)
  2538. def done(self, r):
  2539. QDialog.done(self, r)
  2540. self.close()