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.

1840 lines
69KB

  1. #!/usr/bin/env python3
  2. # -*- coding: utf-8 -*-
  3. # Carla plugin database code
  4. # Copyright (C) 2011-2014 Filipe Coelho <falktx@falktx.com>
  5. #
  6. # This program is free software; you can redistribute it and/or
  7. # modify it under the terms of the GNU General Public License as
  8. # published by the Free Software Foundation; either version 2 of
  9. # the License, or any later version.
  10. #
  11. # This program is distributed in the hope that it will be useful,
  12. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. # GNU General Public License for more details.
  15. #
  16. # For a full copy of the GNU General Public License see the doc/GPL.txt file.
  17. # ------------------------------------------------------------------------------------------------------------
  18. # Imports (Config)
  19. from carla_config import *
  20. # ------------------------------------------------------------------------------------------------------------
  21. # Imports (Global)
  22. from copy import deepcopy
  23. from subprocess import Popen, PIPE
  24. if config_UseQt5:
  25. from PyQt5.QtCore import pyqtSignal, pyqtSlot, Qt, QThread, QSettings
  26. from PyQt5.QtWidgets import QDialog, QTableWidgetItem
  27. else:
  28. from PyQt4.QtCore import pyqtSignal, pyqtSlot, Qt, QThread, QSettings
  29. from PyQt4.QtGui import QDialog, QTableWidgetItem
  30. # ------------------------------------------------------------------------------------------------------------
  31. # Imports (Custom)
  32. import ui_carla_database
  33. import ui_carla_refresh
  34. from carla_shared import *
  35. # ------------------------------------------------------------------------------------------------------------
  36. # Try Import LADSPA-RDF
  37. try:
  38. import ladspa_rdf
  39. import json
  40. haveLRDF = True
  41. except:
  42. qWarning("LRDF Support not available (LADSPA-RDF will be disabled)")
  43. haveLRDF = False
  44. # ------------------------------------------------------------------------------------------------------------
  45. # Set LADSPA-RDF Path
  46. if haveLRDF and readEnvVars:
  47. LADSPA_RDF_PATH_env = os.getenv("LADSPA_RDF_PATH")
  48. if LADSPA_RDF_PATH_env:
  49. ladspa_rdf.set_rdf_path(LADSPA_RDF_PATH_env.split(splitter))
  50. del LADSPA_RDF_PATH_env
  51. # ------------------------------------------------------------------------------------------------------------
  52. # Plugin Query (helper functions)
  53. def findBinaries(binPath, OS):
  54. binaries = []
  55. if OS == "WINDOWS":
  56. extensions = (".dll",)
  57. elif OS == "MACOS":
  58. extensions = (".dylib", ".so")
  59. else:
  60. extensions = (".so",)
  61. for root, dirs, files in os.walk(binPath):
  62. for name in [name for name in files if name.lower().endswith(extensions)]:
  63. binaries.append(os.path.join(root, name))
  64. return binaries
  65. def findVST3Binaries(binPath):
  66. binaries = []
  67. for root, dirs, files in os.walk(binPath):
  68. for name in [name for name in files if name.lower().endswith(".vst3")]:
  69. binaries.append(os.path.join(root, name))
  70. return binaries
  71. def findLV2Bundles(bundlePath):
  72. bundles = []
  73. for root, dirs, files in os.walk(bundlePath):
  74. if os.path.exists(os.path.join(root, "manifest.ttl")):
  75. bundles.append(root)
  76. return bundles
  77. def findMacVSTBundles(bundlePath, isVST3):
  78. bundles = []
  79. for root, dirs, files in os.walk(bundlePath):
  80. for name in [name for name in dirs if name.lower().endswith(".vst3" if isVST3 else ".vst")]:
  81. bundles.append(os.path.join(root, name))
  82. return bundles
  83. def findFilenames(filePath, stype):
  84. filenames = []
  85. if stype == "csd":
  86. extensions = (".csd",)
  87. elif stype == "gig":
  88. extensions = (".gig",)
  89. elif stype == "sf2":
  90. extensions = (".sf2",)
  91. elif stype == "sfz":
  92. extensions = (".sfz",)
  93. else:
  94. return []
  95. for root, dirs, files in os.walk(filePath):
  96. for name in [name for name in files if name.lower().endswith(extensions)]:
  97. filenames.append(os.path.join(root, name))
  98. return filenames
  99. # ------------------------------------------------------------------------------------------------------------
  100. # Plugin Query
  101. PLUGIN_QUERY_API_VERSION = 3
  102. PyPluginInfo = {
  103. 'API': PLUGIN_QUERY_API_VERSION,
  104. 'build': BINARY_NONE,
  105. 'type': PLUGIN_NONE,
  106. 'hints': 0x0,
  107. 'filename': "",
  108. 'name': "",
  109. 'label': "",
  110. 'maker': "",
  111. 'copyright': "",
  112. 'uniqueId': 0,
  113. 'audio.ins': 0,
  114. 'audio.outs': 0,
  115. 'audio.total': 0,
  116. 'midi.ins': 0,
  117. 'midi.outs': 0,
  118. 'midi.total': 0,
  119. 'parameters.ins': 0,
  120. 'parameters.outs': 0,
  121. 'parameters.total': 0,
  122. 'programs.total': 0
  123. }
  124. global gDiscoveryProcess
  125. gDiscoveryProcess = None
  126. def runCarlaDiscovery(itype, stype, filename, tool, isWine=False):
  127. if not os.path.exists(tool):
  128. qWarning("runCarlaDiscovery() - tool '%s' does not exist" % tool)
  129. return
  130. command = []
  131. if LINUX or MACOS:
  132. command.append("env")
  133. command.append("LANG=C")
  134. if isWine:
  135. command.append("WINEDEBUG=-all")
  136. command.append("wine")
  137. command.append(tool)
  138. command.append(stype)
  139. command.append(filename)
  140. global gDiscoveryProcess
  141. gDiscoveryProcess = Popen(command, stdout=PIPE)
  142. pinfo = None
  143. plugins = []
  144. fakeLabel = os.path.basename(filename).rsplit(".", 1)[0]
  145. while True:
  146. try:
  147. line = gDiscoveryProcess.stdout.readline().decode("utf-8", errors="ignore")
  148. except:
  149. print("ERROR: discovery readline failed")
  150. break
  151. # line is valid, strip it
  152. if line:
  153. line = line.strip()
  154. # line is invalid, try poll() again
  155. elif gDiscoveryProcess.poll() is None:
  156. continue
  157. # line is invalid and poll() failed, stop here
  158. else:
  159. break
  160. if line == "carla-discovery::init::-----------":
  161. pinfo = deepcopy(PyPluginInfo)
  162. pinfo['type'] = itype
  163. pinfo['filename'] = filename
  164. elif line == "carla-discovery::end::------------":
  165. if pinfo is not None:
  166. plugins.append(pinfo)
  167. del pinfo
  168. pinfo = None
  169. elif line == "Segmentation fault":
  170. print("carla-discovery::crash::%s crashed during discovery" % filename)
  171. elif line.startswith("err:module:import_dll Library"):
  172. print(line)
  173. elif line.startswith("carla-discovery::info::"):
  174. print("%s - %s" % (line, filename))
  175. elif line.startswith("carla-discovery::error::"):
  176. print("%s - %s" % (line, filename))
  177. elif line.startswith("carla-discovery::"):
  178. if pinfo == None:
  179. continue
  180. try:
  181. prop, value = line.replace("carla-discovery::", "").split("::", 1)
  182. except:
  183. continue
  184. if prop == "name":
  185. pinfo['name'] = value if value else fakeLabel
  186. elif prop == "label":
  187. pinfo['label'] = value if value else fakeLabel
  188. elif prop == "maker":
  189. pinfo['maker'] = value
  190. elif prop == "copyright":
  191. pinfo['copyright'] = value
  192. elif prop == "uniqueId":
  193. if value.isdigit(): pinfo['uniqueId'] = int(value)
  194. elif prop == "hints":
  195. if value.isdigit(): pinfo['hints'] = int(value)
  196. elif prop == "audio.ins":
  197. if value.isdigit(): pinfo['audio.ins'] = int(value)
  198. elif prop == "audio.outs":
  199. if value.isdigit(): pinfo['audio.outs'] = int(value)
  200. elif prop == "audio.total":
  201. if value.isdigit(): pinfo['audio.total'] = int(value)
  202. elif prop == "midi.ins":
  203. if value.isdigit(): pinfo['midi.ins'] = int(value)
  204. elif prop == "midi.outs":
  205. if value.isdigit(): pinfo['midi.outs'] = int(value)
  206. elif prop == "midi.total":
  207. if value.isdigit(): pinfo['midi.total'] = int(value)
  208. elif prop == "parameters.ins":
  209. if value.isdigit(): pinfo['parameters.ins'] = int(value)
  210. elif prop == "parameters.outs":
  211. if value.isdigit(): pinfo['parameters.outs'] = int(value)
  212. elif prop == "parameters.total":
  213. if value.isdigit(): pinfo['parameters.total'] = int(value)
  214. elif prop == "programs.total":
  215. if value.isdigit(): pinfo['programs.total'] = int(value)
  216. elif prop == "build":
  217. if value.isdigit(): pinfo['build'] = int(value)
  218. elif prop == "uri":
  219. if value:
  220. pinfo['label'] = value
  221. else:
  222. # cannot use empty URIs
  223. del pinfo
  224. pinfo = None
  225. continue
  226. # FIXME?
  227. tmp = gDiscoveryProcess
  228. gDiscoveryProcess = None
  229. del gDiscoveryProcess, tmp
  230. return plugins
  231. def killDiscovery():
  232. global gDiscoveryProcess
  233. if gDiscoveryProcess is not None:
  234. gDiscoveryProcess.kill()
  235. def checkPluginInternal(desc):
  236. plugins = []
  237. pinfo = deepcopy(PyPluginInfo)
  238. pinfo['build'] = BINARY_NATIVE
  239. pinfo['type'] = PLUGIN_INTERNAL
  240. pinfo['hints'] = desc['hints']
  241. pinfo['name'] = desc['name']
  242. pinfo['label'] = desc['label']
  243. pinfo['maker'] = desc['maker']
  244. pinfo['copyright'] = desc['copyright']
  245. pinfo['audio.ins'] = desc['audioIns']
  246. pinfo['audio.outs'] = desc['audioOuts']
  247. pinfo['audio.total'] = pinfo['audio.ins'] + pinfo['audio.outs']
  248. pinfo['midi.ins'] = desc['midiIns']
  249. pinfo['midi.outs'] = desc['midiOuts']
  250. pinfo['midi.total'] = pinfo['midi.ins'] + pinfo['midi.outs']
  251. pinfo['parameters.ins'] = desc['parameterIns']
  252. pinfo['parameters.outs'] = desc['parameterOuts']
  253. pinfo['parameters.total'] = pinfo['parameters.ins'] + pinfo['parameters.outs']
  254. plugins.append(pinfo)
  255. return plugins
  256. def checkPluginLADSPA(filename, tool, isWine=False):
  257. return runCarlaDiscovery(PLUGIN_LADSPA, "LADSPA", filename, tool, isWine)
  258. def checkPluginDSSI(filename, tool, isWine=False):
  259. return runCarlaDiscovery(PLUGIN_DSSI, "DSSI", filename, tool, isWine)
  260. def checkPluginLV2(filename, tool, isWine=False):
  261. return runCarlaDiscovery(PLUGIN_LV2, "LV2", filename, tool, isWine)
  262. def checkPluginVST(filename, tool, isWine=False):
  263. return runCarlaDiscovery(PLUGIN_VST, "VST", filename, tool, isWine)
  264. def checkPluginVST3(filename, tool, isWine=False):
  265. return runCarlaDiscovery(PLUGIN_VST3, "VST3", filename, tool, isWine)
  266. def checkPluginAU(filename, tool):
  267. return runCarlaDiscovery(PLUGIN_AU, "AU", filename, tool)
  268. def checkFileCSD(filename, tool):
  269. return runCarlaDiscovery(PLUGIN_FILE_CSD, "CSD", filename, tool)
  270. def checkFileGIG(filename, tool):
  271. return runCarlaDiscovery(PLUGIN_FILE_GIG, "GIG", filename, tool)
  272. def checkFileSF2(filename, tool):
  273. return runCarlaDiscovery(PLUGIN_FILE_SF2, "SF2", filename, tool)
  274. def checkFileSFZ(filename, tool):
  275. return runCarlaDiscovery(PLUGIN_FILE_SFZ, "SFZ", filename, tool)
  276. # ------------------------------------------------------------------------------------------------------------
  277. # Separate Thread for Plugin Search
  278. class SearchPluginsThread(QThread):
  279. pluginLook = pyqtSignal(int, str)
  280. def __init__(self, parent):
  281. QThread.__init__(self, parent)
  282. self.fContinueChecking = False
  283. self.fCheckNative = False
  284. self.fCheckPosix32 = False
  285. self.fCheckPosix64 = False
  286. self.fCheckWin32 = False
  287. self.fCheckWin64 = False
  288. self.fCheckLADSPA = False
  289. self.fCheckDSSI = False
  290. self.fCheckLV2 = False
  291. self.fCheckVST = False
  292. self.fCheckVST3 = False
  293. self.fCheckAU = False
  294. self.fCheckCSD = False
  295. self.fCheckGIG = False
  296. self.fCheckSF2 = False
  297. self.fCheckSFZ = False
  298. self.fToolNative = gCarla.discovery_native
  299. self.fCurCount = 0
  300. self.fCurPercentValue = 0
  301. self.fLastCheckValue = 0
  302. self.fSomethingChanged = False
  303. self.fLadspaPlugins = []
  304. self.fDssiPlugins = []
  305. self.fLv2Plugins = []
  306. self.fVstPlugins = []
  307. self.fVst3Plugins = []
  308. self.fAuPlugins = []
  309. self.fCsdFiles = []
  310. self.fKitPlugins = []
  311. # -------------------------------------------------------------
  312. def hasSomethingChanged(self):
  313. return self.fSomethingChanged
  314. def setSearchBinaryTypes(self, native, posix32, posix64, win32, win64):
  315. self.fCheckNative = native
  316. self.fCheckPosix32 = posix32
  317. self.fCheckPosix64 = posix64
  318. self.fCheckWin32 = win32
  319. self.fCheckWin64 = win64
  320. def setSearchPluginTypes(self, ladspa, dssi, lv2, vst, vst3, au, csd, gig, sf2, sfz):
  321. self.fCheckLADSPA = ladspa
  322. self.fCheckDSSI = dssi
  323. self.fCheckLV2 = lv2
  324. self.fCheckVST = vst
  325. self.fCheckVST3 = vst3
  326. self.fCheckAU = au and MACOS
  327. self.fCheckCSD = csd
  328. self.fCheckGIG = gig
  329. self.fCheckSF2 = sf2
  330. self.fCheckSFZ = sfz
  331. def setSearchToolNative(self, tool):
  332. self.fToolNative = tool
  333. def stop(self):
  334. self.fContinueChecking = False
  335. def run(self):
  336. self.fContinueChecking = True
  337. self.fCurCount = 0
  338. pluginCount = 0
  339. settingsDB = QSettings("falkTX", "CarlaPlugins2")
  340. if self.fCheckLADSPA: pluginCount += 1
  341. if self.fCheckDSSI: pluginCount += 1
  342. if self.fCheckLV2: pluginCount += 1
  343. if self.fCheckVST: pluginCount += 1
  344. if self.fCheckVST3: pluginCount += 1
  345. if self.fCheckAU: pluginCount += 1
  346. if self.fCheckNative:
  347. self.fCurCount += pluginCount
  348. if self.fCheckPosix32:
  349. self.fCurCount += pluginCount
  350. if self.fCheckVST3 and not MACOS:
  351. self.fCurCount -= 1
  352. if self.fCheckPosix64:
  353. self.fCurCount += pluginCount
  354. if self.fCheckVST3 and not MACOS:
  355. self.fCurCount -= 1
  356. if self.fCheckWin32:
  357. self.fCurCount += pluginCount
  358. if self.fCheckAU:
  359. self.fCurCount -= 1
  360. if self.fCheckWin64:
  361. self.fCurCount += pluginCount
  362. if self.fCheckAU:
  363. self.fCurCount -= 1
  364. if self.fCheckNative and self.fToolNative:
  365. if self.fCheckCSD: self.fCurCount += 1
  366. if self.fCheckGIG: self.fCurCount += 1
  367. if self.fCheckSF2: self.fCurCount += 1
  368. if self.fCheckSFZ: self.fCurCount += 1
  369. else:
  370. self.fCheckCSD = False
  371. self.fCheckGIG = False
  372. self.fCheckSF2 = False
  373. self.fCheckSFZ = False
  374. if self.fCurCount == 0:
  375. return
  376. self.fCurPercentValue = 100.0 / self.fCurCount
  377. self.fLastCheckValue = 0.0
  378. if HAIKU:
  379. OS = "HAIKU"
  380. elif LINUX:
  381. OS = "LINUX"
  382. elif MACOS:
  383. OS = "MACOS"
  384. elif WINDOWS:
  385. OS = "WINDOWS"
  386. else:
  387. OS = "UNKNOWN"
  388. if not self.fContinueChecking: return
  389. if self.fCheckLADSPA:
  390. checkValue = 0.0
  391. if haveLRDF:
  392. if self.fCheckNative: checkValue += 0.1
  393. if self.fCheckPosix32: checkValue += 0.1
  394. if self.fCheckPosix64: checkValue += 0.1
  395. if self.fCheckWin32: checkValue += 0.1
  396. if self.fCheckWin64: checkValue += 0.1
  397. rdfPadValue = self.fCurPercentValue * checkValue
  398. if self.fCheckNative:
  399. self._checkLADSPA(OS, self.fToolNative)
  400. settingsDB.setValue("Plugins/LADSPA_native", self.fLadspaPlugins)
  401. if not self.fContinueChecking: return
  402. if self.fCheckPosix32:
  403. self._checkLADSPA(OS, gCarla.discovery_posix32)
  404. settingsDB.setValue("Plugins/LADSPA_posix32", self.fLadspaPlugins)
  405. if not self.fContinueChecking: return
  406. if self.fCheckPosix64:
  407. self._checkLADSPA(OS, gCarla.discovery_posix64)
  408. settingsDB.setValue("Plugins/LADSPA_posix64", self.fLadspaPlugins)
  409. if not self.fContinueChecking: return
  410. if self.fCheckWin32:
  411. self._checkLADSPA("WINDOWS", gCarla.discovery_win32, not WINDOWS)
  412. settingsDB.setValue("Plugins/LADSPA_win32", self.fLadspaPlugins)
  413. if not self.fContinueChecking: return
  414. if self.fCheckWin64:
  415. self._checkLADSPA("WINDOWS", gCarla.discovery_win64, not WINDOWS)
  416. settingsDB.setValue("Plugins/LADSPA_win64", self.fLadspaPlugins)
  417. settingsDB.sync()
  418. if not self.fContinueChecking: return
  419. if haveLRDF and checkValue > 0:
  420. startValue = self.fLastCheckValue - rdfPadValue
  421. self._pluginLook(startValue, "LADSPA RDFs...")
  422. ladspaRdfInfo = ladspa_rdf.recheck_all_plugins(self, startValue, self.fCurPercentValue, checkValue)
  423. settingsDir = os.path.join(HOME, ".config", "falkTX")
  424. fdLadspa = open(os.path.join(settingsDir, "ladspa_rdf.db"), 'w')
  425. json.dump(ladspaRdfInfo, fdLadspa)
  426. fdLadspa.close()
  427. if not self.fContinueChecking: return
  428. if self.fCheckDSSI:
  429. if self.fCheckNative:
  430. self._checkDSSI(OS, self.fToolNative)
  431. settingsDB.setValue("Plugins/DSSI_native", self.fDssiPlugins)
  432. if not self.fContinueChecking: return
  433. if self.fCheckPosix32:
  434. self._checkDSSI(OS, gCarla.discovery_posix32)
  435. settingsDB.setValue("Plugins/DSSI_posix32", self.fDssiPlugins)
  436. if not self.fContinueChecking: return
  437. if self.fCheckPosix64:
  438. self._checkDSSI(OS, gCarla.discovery_posix64)
  439. settingsDB.setValue("Plugins/DSSI_posix64", self.fDssiPlugins)
  440. if not self.fContinueChecking: return
  441. if self.fCheckWin32:
  442. self._checkDSSI("WINDOWS", gCarla.discovery_win32, not WINDOWS)
  443. settingsDB.setValue("Plugins/DSSI_win32", self.fDssiPlugins)
  444. if not self.fContinueChecking: return
  445. if self.fCheckWin64:
  446. self._checkDSSI("WINDOWS", gCarla.discovery_win64, not WINDOWS)
  447. settingsDB.setValue("Plugins/DSSI_win64", self.fDssiPlugins)
  448. settingsDB.sync()
  449. if not self.fContinueChecking: return
  450. if self.fCheckLV2:
  451. if self.fCheckNative:
  452. self._checkLV2(self.fToolNative)
  453. settingsDB.setValue("Plugins/LV2_native", self.fLv2Plugins)
  454. if not self.fContinueChecking: return
  455. if self.fCheckPosix32:
  456. self._checkLV2(gCarla.discovery_posix32)
  457. settingsDB.setValue("Plugins/LV2_posix32", self.fLv2Plugins)
  458. if not self.fContinueChecking: return
  459. if self.fCheckPosix64:
  460. self._checkLV2(gCarla.discovery_posix64)
  461. settingsDB.setValue("Plugins/LV2_posix64", self.fLv2Plugins)
  462. if not self.fContinueChecking: return
  463. if self.fCheckWin32:
  464. self._checkLV2(gCarla.discovery_win32, not WINDOWS)
  465. settingsDB.setValue("Plugins/LV2_win32", self.fLv2Plugins)
  466. if not self.fContinueChecking: return
  467. if self.fCheckWin64:
  468. self._checkLV2(gCarla.discovery_win64, not WINDOWS)
  469. settingsDB.setValue("Plugins/LV2_win64", self.fLv2Plugins)
  470. settingsDB.sync()
  471. if not self.fContinueChecking: return
  472. if self.fCheckVST:
  473. if self.fCheckNative:
  474. self._checkVST(OS, self.fToolNative)
  475. settingsDB.setValue("Plugins/VST_native", self.fVstPlugins)
  476. if not self.fContinueChecking: return
  477. if self.fCheckPosix32:
  478. self._checkVST(OS, gCarla.discovery_posix32)
  479. settingsDB.setValue("Plugins/VST_posix32", self.fVstPlugins)
  480. if not self.fContinueChecking: return
  481. if self.fCheckPosix64:
  482. self._checkVST(OS, gCarla.discovery_posix64)
  483. settingsDB.setValue("Plugins/VST_posix64", self.fVstPlugins)
  484. if not self.fContinueChecking: return
  485. if self.fCheckWin32:
  486. self._checkVST("WINDOWS", gCarla.discovery_win32, not WINDOWS)
  487. settingsDB.setValue("Plugins/VST_win32", self.fVstPlugins)
  488. if not self.fContinueChecking: return
  489. if self.fCheckWin64:
  490. self._checkVST("WINDOWS", gCarla.discovery_win64, not WINDOWS)
  491. settingsDB.setValue("Plugins/VST_win64", self.fVstPlugins)
  492. settingsDB.sync()
  493. if not self.fContinueChecking: return
  494. if self.fCheckVST3:
  495. if self.fCheckNative:
  496. self._checkVST3(OS, self.fToolNative)
  497. settingsDB.setValue("Plugins/VST3_native", self.fVst3Plugins)
  498. if not self.fContinueChecking: return
  499. if self.fCheckPosix32 and MACOS:
  500. self._checkVST3(OS, gCarla.discovery_posix32)
  501. settingsDB.setValue("Plugins/VST3_posix32", self.fVst3Plugins)
  502. if not self.fContinueChecking: return
  503. if self.fCheckPosix64 and MACOS:
  504. self._checkVST3(OS, gCarla.discovery_posix64)
  505. settingsDB.setValue("Plugins/VST3_posix64", self.fVst3Plugins)
  506. if not self.fContinueChecking: return
  507. if self.fCheckWin32:
  508. self._checkVST3("WINDOWS", gCarla.discovery_win32, not WINDOWS)
  509. settingsDB.setValue("Plugins/VST3_win32", self.fVst3Plugins)
  510. if not self.fContinueChecking: return
  511. if self.fCheckWin64:
  512. self._checkVST3("WINDOWS", gCarla.discovery_win64, not WINDOWS)
  513. settingsDB.setValue("Plugins/VST3_win64", self.fVst3Plugins)
  514. settingsDB.sync()
  515. if not self.fContinueChecking: return
  516. if self.fCheckAU:
  517. if self.fCheckNative:
  518. self._checkAU(self.fToolNative)
  519. settingsDB.setValue("Plugins/AU_native", self.fAuPlugins)
  520. if not self.fContinueChecking: return
  521. if self.fCheckPosix32:
  522. self._checkAU(gCarla.discovery_posix32)
  523. settingsDB.setValue("Plugins/AU_posix32", self.fAuPlugins)
  524. if not self.fContinueChecking: return
  525. if self.fCheckPosix64:
  526. self._checkAU(gCarla.discovery_posix64)
  527. settingsDB.setValue("Plugins/AU_posix64", self.fAuPlugins)
  528. settingsDB.sync()
  529. if not self.fContinueChecking: return
  530. if self.fCheckCSD:
  531. self._checkCSD()
  532. settingsDB.setValue("Plugins/CSD", self.fCsdFiles)
  533. if not self.fContinueChecking: return
  534. if self.fCheckGIG:
  535. settings = QSettings()
  536. GIG_PATH = toList(settings.value(CARLA_KEY_PATHS_GIG, gCarla.DEFAULT_GIG_PATH))
  537. del settings
  538. self._checkKIT(GIG_PATH, "gig")
  539. settingsDB.setValue("Plugins/GIG", self.fKitPlugins)
  540. if not self.fContinueChecking: return
  541. if self.fCheckSF2:
  542. settings = QSettings()
  543. SF2_PATH = toList(settings.value(CARLA_KEY_PATHS_SF2, gCarla.DEFAULT_SF2_PATH))
  544. del settings
  545. self._checkKIT(SF2_PATH, "sf2")
  546. settingsDB.setValue("Plugins/SF2", self.fKitPlugins)
  547. if not self.fContinueChecking: return
  548. if self.fCheckSFZ:
  549. settings = QSettings()
  550. SFZ_PATH = toList(settings.value(CARLA_KEY_PATHS_SFZ, gCarla.DEFAULT_SFZ_PATH))
  551. del settings
  552. self._checkKIT(SFZ_PATH, "sfz")
  553. settingsDB.setValue("Plugins/SFZ", self.fKitPlugins)
  554. settingsDB.sync()
  555. def _checkLADSPA(self, OS, tool, isWine=False):
  556. ladspaBinaries = []
  557. self.fLadspaPlugins = []
  558. self._pluginLook(self.fLastCheckValue, "LADSPA plugins...")
  559. settings = QSettings()
  560. LADSPA_PATH = toList(settings.value(CARLA_KEY_PATHS_LADSPA, gCarla.DEFAULT_LADSPA_PATH))
  561. for iPATH in LADSPA_PATH:
  562. binaries = findBinaries(iPATH, OS)
  563. for binary in binaries:
  564. if binary not in ladspaBinaries:
  565. ladspaBinaries.append(binary)
  566. ladspaBinaries.sort()
  567. if not self.fContinueChecking: return
  568. for i in range(len(ladspaBinaries)):
  569. ladspa = ladspaBinaries[i]
  570. percent = ( float(i) / len(ladspaBinaries) ) * self.fCurPercentValue
  571. self._pluginLook((self.fLastCheckValue + percent) * 0.9, ladspa)
  572. plugins = checkPluginLADSPA(ladspa, tool, isWine)
  573. if plugins:
  574. self.fLadspaPlugins.append(plugins)
  575. self.fSomethingChanged = True
  576. if not self.fContinueChecking: break
  577. self.fLastCheckValue += self.fCurPercentValue
  578. def _checkDSSI(self, OS, tool, isWine=False):
  579. dssiBinaries = []
  580. self.fDssiPlugins = []
  581. self._pluginLook(self.fLastCheckValue, "DSSI plugins...")
  582. settings = QSettings()
  583. DSSI_PATH = toList(settings.value(CARLA_KEY_PATHS_DSSI, gCarla.DEFAULT_DSSI_PATH))
  584. for iPATH in DSSI_PATH:
  585. binaries = findBinaries(iPATH, OS)
  586. for binary in binaries:
  587. if binary not in dssiBinaries:
  588. dssiBinaries.append(binary)
  589. dssiBinaries.sort()
  590. if not self.fContinueChecking: return
  591. for i in range(len(dssiBinaries)):
  592. dssi = dssiBinaries[i]
  593. percent = ( float(i) / len(dssiBinaries) ) * self.fCurPercentValue
  594. self._pluginLook(self.fLastCheckValue + percent, dssi)
  595. plugins = checkPluginDSSI(dssi, tool, isWine)
  596. if plugins:
  597. self.fDssiPlugins.append(plugins)
  598. self.fSomethingChanged = True
  599. if not self.fContinueChecking: break
  600. self.fLastCheckValue += self.fCurPercentValue
  601. def _checkLV2(self, tool, isWine=False):
  602. lv2Bundles = []
  603. self.fLv2Plugins = []
  604. self._pluginLook(self.fLastCheckValue, "LV2 bundles...")
  605. settings = QSettings()
  606. LV2_PATH = toList(settings.value(CARLA_KEY_PATHS_LV2, gCarla.DEFAULT_LV2_PATH))
  607. for iPATH in LV2_PATH:
  608. bundles = findLV2Bundles(iPATH)
  609. for bundle in bundles:
  610. if bundle not in lv2Bundles:
  611. lv2Bundles.append(bundle)
  612. lv2Bundles.sort()
  613. if not self.fContinueChecking: return
  614. for i in range(len(lv2Bundles)):
  615. lv2 = lv2Bundles[i]
  616. percent = ( float(i) / len(lv2Bundles) ) * self.fCurPercentValue
  617. self._pluginLook(self.fLastCheckValue + percent, lv2)
  618. plugins = checkPluginLV2(lv2, tool, isWine)
  619. if plugins:
  620. self.fLv2Plugins.append(plugins)
  621. self.fSomethingChanged = True
  622. if not self.fContinueChecking: break
  623. self.fLastCheckValue += self.fCurPercentValue
  624. def _checkVST(self, OS, tool, isWine=False):
  625. vstBinaries = []
  626. self.fVstPlugins = []
  627. if MACOS and not isWine:
  628. self._pluginLook(self.fLastCheckValue, "VST bundles...")
  629. else:
  630. self._pluginLook(self.fLastCheckValue, "VST plugins...")
  631. settings = QSettings()
  632. VST_PATH = toList(settings.value(CARLA_KEY_PATHS_VST, gCarla.DEFAULT_VST_PATH))
  633. for iPATH in VST_PATH:
  634. if MACOS and not isWine:
  635. binaries = findMacVSTBundles(iPATH, False)
  636. else:
  637. binaries = findBinaries(iPATH, OS)
  638. for binary in binaries:
  639. if binary not in vstBinaries:
  640. vstBinaries.append(binary)
  641. vstBinaries.sort()
  642. if not self.fContinueChecking: return
  643. for i in range(len(vstBinaries)):
  644. vst = vstBinaries[i]
  645. percent = ( float(i) / len(vstBinaries) ) * self.fCurPercentValue
  646. self._pluginLook(self.fLastCheckValue + percent, vst)
  647. plugins = checkPluginVST(vst, tool, isWine)
  648. if plugins:
  649. self.fVstPlugins.append(plugins)
  650. self.fSomethingChanged = True
  651. if not self.fContinueChecking: break
  652. self.fLastCheckValue += self.fCurPercentValue
  653. def _checkVST3(self, OS, tool, isWine=False):
  654. vst3Binaries = []
  655. self.fVst3Plugins = []
  656. if MACOS and not isWine:
  657. self._pluginLook(self.fLastCheckValue, "VST3 bundles...")
  658. else:
  659. self._pluginLook(self.fLastCheckValue, "VST3 plugins...")
  660. settings = QSettings()
  661. VST3_PATH = toList(settings.value(CARLA_KEY_PATHS_VST3, gCarla.DEFAULT_VST3_PATH))
  662. for iPATH in VST3_PATH:
  663. if MACOS and not isWine:
  664. binaries = findMacVSTBundles(iPATH, True)
  665. else:
  666. binaries = findVST3Binaries(iPATH)
  667. for binary in binaries:
  668. if binary not in vst3Binaries:
  669. vst3Binaries.append(binary)
  670. vst3Binaries.sort()
  671. if not self.fContinueChecking: return
  672. for i in range(len(vst3Binaries)):
  673. vst3 = vst3Binaries[i]
  674. percent = ( float(i) / len(vst3Binaries) ) * self.fCurPercentValue
  675. self._pluginLook(self.fLastCheckValue + percent, vst3)
  676. plugins = checkPluginVST3(vst3, tool, isWine)
  677. if plugins:
  678. self.fVst3Plugins.append(plugins)
  679. self.fSomethingChanged = True
  680. if not self.fContinueChecking: break
  681. self.fLastCheckValue += self.fCurPercentValue
  682. def _checkAU(self, tool):
  683. auBinaries = []
  684. self.fAuPlugins = []
  685. # FIXME - this probably uses bundles
  686. self._pluginLook(self.fLastCheckValue, "AU plugins...")
  687. settings = QSettings()
  688. AU_PATH = toList(settings.value(CARLA_KEY_PATHS_AU, gCarla.DEFAULT_AU_PATH))
  689. for iPATH in AU_PATH:
  690. binaries = findBinaries(iPATH, "MACOS")
  691. for binary in binaries:
  692. if binary not in auBinaries:
  693. auBinaries.append(binary)
  694. auBinaries.sort()
  695. if not self.fContinueChecking: return
  696. for i in range(len(auBinaries)):
  697. au = auBinaries[i]
  698. percent = ( float(i) / len(auBinaries) ) * self.fCurPercentValue
  699. self._pluginLook(self.fLastCheckValue + percent, au)
  700. plugins = checkPluginAU(au, tool)
  701. if plugins:
  702. self.fAuPlugins.append(plugins)
  703. self.fSomethingChanged = True
  704. if not self.fContinueChecking: break
  705. self.fLastCheckValue += self.fCurPercentValue
  706. def _checkCSD(self):
  707. csdFiles = []
  708. self.fCsdFiles = []
  709. settings = QSettings()
  710. CSOUND_PATH = toList(settings.value(CARLA_KEY_PATHS_CSD, gCarla.DEFAULT_CSOUND_PATH))
  711. for iPATH in CSOUND_PATH:
  712. files = findFilenames(iPATH, "csd")
  713. for file_ in files:
  714. if file_ not in csdFiles:
  715. csdFiles.append(file_)
  716. csdFiles.sort()
  717. if not self.fContinueChecking: return
  718. for i in range(len(csdFiles)):
  719. csd = csdFiles[i]
  720. percent = ( float(i) / len(csdFiles) ) * self.fCurPercentValue
  721. self._pluginLook(self.fLastCheckValue + percent, csd)
  722. plugins = checkFileCSD(csd, self.fToolNative)
  723. if plugins:
  724. self.fCsdFiles.append(plugins)
  725. self.fSomethingChanged = True
  726. if not self.fContinueChecking: break
  727. self.fLastCheckValue += self.fCurPercentValue
  728. def _checkKIT(self, kitPATH, kitExtension):
  729. kitFiles = []
  730. self.fKitPlugins = []
  731. for iPATH in kitPATH:
  732. files = findFilenames(iPATH, kitExtension)
  733. for file_ in files:
  734. if file_ not in kitFiles:
  735. kitFiles.append(file_)
  736. kitFiles.sort()
  737. if not self.fContinueChecking: return
  738. for i in range(len(kitFiles)):
  739. kit = kitFiles[i]
  740. percent = ( float(i) / len(kitFiles) ) * self.fCurPercentValue
  741. self._pluginLook(self.fLastCheckValue + percent, kit)
  742. if kitExtension == "gig":
  743. plugins = checkFileGIG(kit, self.fToolNative)
  744. elif kitExtension == "sf2":
  745. plugins = checkFileSF2(kit, self.fToolNative)
  746. elif kitExtension == "sfz":
  747. plugins = checkFileSFZ(kit, self.fToolNative)
  748. else:
  749. plugins = None
  750. if plugins:
  751. self.fKitPlugins.append(plugins)
  752. self.fSomethingChanged = True
  753. if not self.fContinueChecking: break
  754. self.fLastCheckValue += self.fCurPercentValue
  755. def _pluginLook(self, percent, plugin):
  756. self.pluginLook.emit(percent, plugin)
  757. # ------------------------------------------------------------------------------------------------------------
  758. # Plugin Refresh Dialog
  759. class PluginRefreshW(QDialog):
  760. def __init__(self, parent):
  761. QDialog.__init__(self, parent)
  762. self.ui = ui_carla_refresh.Ui_PluginRefreshW()
  763. self.ui.setupUi(self)
  764. # -------------------------------------------------------------
  765. # Internal stuff
  766. self.fThread = SearchPluginsThread(self)
  767. # -------------------------------------------------------------
  768. # Load settings
  769. self.loadSettings()
  770. # -------------------------------------------------------------
  771. # Set-up GUI
  772. self.fIconYes = getIcon("dialog-ok-apply").pixmap(16, 16)
  773. self.fIconNo = getIcon("dialog-error").pixmap(16, 16)
  774. self.ui.b_skip.setVisible(False)
  775. if HAIKU:
  776. self.ui.ch_posix32.setText("Haiku 32bit")
  777. self.ui.ch_posix64.setText("Haiku 64bit")
  778. elif LINUX:
  779. self.ui.ch_posix32.setText("Linux 32bit")
  780. self.ui.ch_posix64.setText("Linux 64bit")
  781. elif MACOS:
  782. self.ui.ch_posix32.setText("MacOS 32bit")
  783. self.ui.ch_posix64.setText("MacOS 64bit")
  784. if gCarla.discovery_posix32 and not WINDOWS:
  785. self.ui.ico_posix32.setPixmap(self.fIconYes)
  786. else:
  787. self.ui.ico_posix32.setPixmap(self.fIconNo)
  788. self.ui.ch_posix32.setChecked(False)
  789. self.ui.ch_posix32.setEnabled(False)
  790. if gCarla.discovery_posix64 and not WINDOWS:
  791. self.ui.ico_posix64.setPixmap(self.fIconYes)
  792. else:
  793. self.ui.ico_posix64.setPixmap(self.fIconNo)
  794. self.ui.ch_posix64.setChecked(False)
  795. self.ui.ch_posix64.setEnabled(False)
  796. if gCarla.discovery_win32:
  797. self.ui.ico_win32.setPixmap(self.fIconYes)
  798. else:
  799. self.ui.ico_win32.setPixmap(self.fIconNo)
  800. self.ui.ch_win32.setChecked(False)
  801. self.ui.ch_win32.setEnabled(False)
  802. if gCarla.discovery_win64:
  803. self.ui.ico_win64.setPixmap(self.fIconYes)
  804. else:
  805. self.ui.ico_win64.setPixmap(self.fIconNo)
  806. self.ui.ch_win64.setChecked(False)
  807. self.ui.ch_win64.setEnabled(False)
  808. if haveLRDF:
  809. self.ui.ico_rdflib.setPixmap(self.fIconYes)
  810. else:
  811. self.ui.ico_rdflib.setPixmap(self.fIconNo)
  812. hasNative = bool(gCarla.discovery_native)
  813. hasNonNative = False
  814. if WINDOWS:
  815. if kIs64bit:
  816. hasNative = bool(gCarla.discovery_win64)
  817. hasNonNative = bool(gCarla.discovery_win32)
  818. self.fThread.setSearchToolNative(gCarla.discovery_win64)
  819. self.ui.ch_win64.setChecked(False)
  820. self.ui.ch_win64.setVisible(False)
  821. self.ui.ico_win64.setVisible(False)
  822. self.ui.label_win64.setVisible(False)
  823. else:
  824. hasNative = bool(gCarla.discovery_win32)
  825. hasNonNative = bool(gCarla.discovery_win64)
  826. self.fThread.setSearchToolNative(gCarla.discovery_win32)
  827. self.ui.ch_win32.setChecked(False)
  828. self.ui.ch_win32.setVisible(False)
  829. self.ui.ico_win32.setVisible(False)
  830. self.ui.label_win32.setVisible(False)
  831. else:
  832. if kIs64bit:
  833. hasNonNative = bool(gCarla.discovery_posix32 or gCarla.discovery_win32 or gCarla.discovery_win64)
  834. self.ui.ch_posix64.setChecked(False)
  835. self.ui.ch_posix64.setVisible(False)
  836. self.ui.ico_posix64.setVisible(False)
  837. self.ui.label_posix64.setVisible(False)
  838. else:
  839. hasNonNative = bool(gCarla.discovery_posix64 or gCarla.discovery_win32 or gCarla.discovery_win64)
  840. self.ui.ch_posix32.setChecked(False)
  841. self.ui.ch_posix32.setVisible(False)
  842. self.ui.ico_posix32.setVisible(False)
  843. self.ui.label_posix32.setVisible(False)
  844. if hasNative:
  845. self.ui.ico_native.setPixmap(self.fIconYes)
  846. else:
  847. self.ui.ico_native.setPixmap(self.fIconNo)
  848. self.ui.ch_native.setChecked(False)
  849. self.ui.ch_native.setEnabled(False)
  850. self.ui.ch_csound.setChecked(False)
  851. self.ui.ch_csound.setEnabled(False)
  852. self.ui.ch_gig.setChecked(False)
  853. self.ui.ch_gig.setEnabled(False)
  854. self.ui.ch_sf2.setChecked(False)
  855. self.ui.ch_sf2.setEnabled(False)
  856. self.ui.ch_sfz.setChecked(False)
  857. self.ui.ch_sfz.setEnabled(False)
  858. if not hasNonNative:
  859. self.ui.ch_ladspa.setChecked(False)
  860. self.ui.ch_ladspa.setEnabled(False)
  861. self.ui.ch_dssi.setChecked(False)
  862. self.ui.ch_dssi.setEnabled(False)
  863. self.ui.ch_lv2.setChecked(False)
  864. self.ui.ch_lv2.setEnabled(False)
  865. self.ui.ch_vst.setChecked(False)
  866. self.ui.ch_vst.setEnabled(False)
  867. self.ui.ch_vst3.setChecked(False)
  868. self.ui.ch_vst3.setEnabled(False)
  869. self.ui.ch_au.setChecked(False)
  870. self.ui.ch_au.setEnabled(False)
  871. if not MACOS:
  872. self.ui.ch_au.setChecked(False)
  873. self.ui.ch_au.setEnabled(False)
  874. self.ui.ch_au.setVisible(False)
  875. # TODO
  876. self.ui.ch_csound.setChecked(False)
  877. self.ui.ch_csound.setEnabled(False)
  878. self.ui.ch_csound.setVisible(False)
  879. # -------------------------------------------------------------
  880. # Set-up connections
  881. self.ui.b_start.clicked.connect(self.slot_start)
  882. self.ui.b_skip.clicked.connect(self.slot_skip)
  883. self.ui.ch_native.clicked.connect(self.slot_checkTools)
  884. self.ui.ch_posix32.clicked.connect(self.slot_checkTools)
  885. self.ui.ch_posix64.clicked.connect(self.slot_checkTools)
  886. self.ui.ch_win32.clicked.connect(self.slot_checkTools)
  887. self.ui.ch_win64.clicked.connect(self.slot_checkTools)
  888. self.ui.ch_ladspa.clicked.connect(self.slot_checkTools)
  889. self.ui.ch_dssi.clicked.connect(self.slot_checkTools)
  890. self.ui.ch_lv2.clicked.connect(self.slot_checkTools)
  891. self.ui.ch_vst.clicked.connect(self.slot_checkTools)
  892. self.ui.ch_vst3.clicked.connect(self.slot_checkTools)
  893. self.ui.ch_au.clicked.connect(self.slot_checkTools)
  894. self.ui.ch_csound.clicked.connect(self.slot_checkTools)
  895. self.ui.ch_gig.clicked.connect(self.slot_checkTools)
  896. self.ui.ch_sf2.clicked.connect(self.slot_checkTools)
  897. self.ui.ch_sfz.clicked.connect(self.slot_checkTools)
  898. self.fThread.pluginLook.connect(self.slot_handlePluginLook)
  899. self.fThread.finished.connect(self.slot_handlePluginThreadFinished)
  900. self.slot_checkTools()
  901. @pyqtSlot()
  902. def slot_start(self):
  903. self.ui.progressBar.setMinimum(0)
  904. self.ui.progressBar.setMaximum(100)
  905. self.ui.progressBar.setValue(0)
  906. self.ui.b_start.setEnabled(False)
  907. self.ui.b_skip.setVisible(True)
  908. self.ui.b_close.setVisible(False)
  909. self.ui.group_types.setEnabled(False)
  910. self.ui.group_options.setEnabled(False)
  911. if self.ui.ch_do_checks.isChecked():
  912. if os.getenv("CARLA_DISCOVERY_NO_PROCESSING_CHECKS"):
  913. os.environ.pop("CARLA_DISCOVERY_NO_PROCESSING_CHECKS")
  914. else:
  915. os.environ["CARLA_DISCOVERY_NO_PROCESSING_CHECKS"] = "true"
  916. native, posix32, posix64, win32, win64 = (self.ui.ch_native.isChecked(),
  917. self.ui.ch_posix32.isChecked(), self.ui.ch_posix64.isChecked(),
  918. self.ui.ch_win32.isChecked(), self.ui.ch_win64.isChecked())
  919. ladspa, dssi, lv2, vst, vst3, au, csound, gig, sf2, sfz = (self.ui.ch_ladspa.isChecked(), self.ui.ch_dssi.isChecked(),
  920. self.ui.ch_lv2.isChecked(), self.ui.ch_vst.isChecked(),
  921. self.ui.ch_vst3.isChecked(), self.ui.ch_au.isChecked(),
  922. self.ui.ch_csound.isChecked(), self.ui.ch_gig.isChecked(),
  923. self.ui.ch_sf2.isChecked(), self.ui.ch_sfz.isChecked())
  924. self.fThread.setSearchBinaryTypes(native, posix32, posix64, win32, win64)
  925. self.fThread.setSearchPluginTypes(ladspa, dssi, lv2, vst, vst3, au, csound, gig, sf2, sfz)
  926. self.fThread.start()
  927. @pyqtSlot()
  928. def slot_skip(self):
  929. killDiscovery()
  930. @pyqtSlot()
  931. def slot_checkTools(self):
  932. enabled1 = bool(self.ui.ch_native.isChecked() or self.ui.ch_posix32.isChecked() or self.ui.ch_posix64.isChecked() or self.ui.ch_win32.isChecked() or self.ui.ch_win64.isChecked())
  933. enabled2 = bool(self.ui.ch_ladspa.isChecked() or self.ui.ch_dssi.isChecked() or self.ui.ch_lv2.isChecked() or self.ui.ch_vst.isChecked() or self.ui.ch_vst3.isChecked() or
  934. self.ui.ch_au.isChecked() or self.ui.ch_csound.isChecked() or self.ui.ch_gig.isChecked() or self.ui.ch_sf2.isChecked() or self.ui.ch_sfz.isChecked())
  935. self.ui.b_start.setEnabled(enabled1 and enabled2)
  936. @pyqtSlot(int, str)
  937. def slot_handlePluginLook(self, percent, plugin):
  938. self.ui.progressBar.setFormat("%s" % plugin)
  939. self.ui.progressBar.setValue(percent)
  940. @pyqtSlot()
  941. def slot_handlePluginThreadFinished(self):
  942. self.ui.progressBar.setMinimum(0)
  943. self.ui.progressBar.setMaximum(1)
  944. self.ui.progressBar.setValue(1)
  945. self.ui.progressBar.setFormat(self.tr("Done"))
  946. self.ui.b_start.setEnabled(True)
  947. self.ui.b_skip.setVisible(False)
  948. self.ui.b_close.setVisible(True)
  949. self.ui.group_types.setEnabled(True)
  950. self.ui.group_options.setEnabled(True)
  951. def loadSettings(self):
  952. settings = QSettings()
  953. self.ui.ch_ladspa.setChecked(settings.value("PluginDatabase/SearchLADSPA", True, type=bool))
  954. self.ui.ch_dssi.setChecked(settings.value("PluginDatabase/SearchDSSI", True, type=bool))
  955. self.ui.ch_lv2.setChecked(settings.value("PluginDatabase/SearchLV2", True, type=bool))
  956. self.ui.ch_vst.setChecked(settings.value("PluginDatabase/SearchVST", True, type=bool))
  957. self.ui.ch_vst3.setChecked(settings.value("PluginDatabase/SearchVST3", (MACOS or WINDOWS), type=bool))
  958. self.ui.ch_au.setChecked(settings.value("PluginDatabase/SearchAU", True, type=bool))
  959. self.ui.ch_csound.setChecked(settings.value("PluginDatabase/SearchCsound", False, type=bool))
  960. self.ui.ch_gig.setChecked(settings.value("PluginDatabase/SearchGIG", False, type=bool))
  961. self.ui.ch_sf2.setChecked(settings.value("PluginDatabase/SearchSF2", False, type=bool))
  962. self.ui.ch_sfz.setChecked(settings.value("PluginDatabase/SearchSFZ", False, type=bool))
  963. self.ui.ch_native.setChecked(settings.value("PluginDatabase/SearchNative", True, type=bool))
  964. self.ui.ch_posix32.setChecked(settings.value("PluginDatabase/SearchPOSIX32", False, type=bool))
  965. self.ui.ch_posix64.setChecked(settings.value("PluginDatabase/SearchPOSIX64", False, type=bool))
  966. self.ui.ch_win32.setChecked(settings.value("PluginDatabase/SearchWin32", False, type=bool))
  967. self.ui.ch_win64.setChecked(settings.value("PluginDatabase/SearchWin64", False, type=bool))
  968. self.ui.ch_do_checks.setChecked(settings.value("PluginDatabase/DoChecks", False, type=bool))
  969. def saveSettings(self):
  970. settings = QSettings()
  971. settings.setValue("PluginDatabase/SearchLADSPA", self.ui.ch_ladspa.isChecked())
  972. settings.setValue("PluginDatabase/SearchDSSI", self.ui.ch_dssi.isChecked())
  973. settings.setValue("PluginDatabase/SearchLV2", self.ui.ch_lv2.isChecked())
  974. settings.setValue("PluginDatabase/SearchVST", self.ui.ch_vst.isChecked())
  975. settings.setValue("PluginDatabase/SearchVST3", self.ui.ch_vst3.isChecked())
  976. settings.setValue("PluginDatabase/SearchAU", self.ui.ch_au.isChecked())
  977. settings.setValue("PluginDatabase/SearchCsound", self.ui.ch_csound.isChecked())
  978. settings.setValue("PluginDatabase/SearchGIG", self.ui.ch_gig.isChecked())
  979. settings.setValue("PluginDatabase/SearchSF2", self.ui.ch_sf2.isChecked())
  980. settings.setValue("PluginDatabase/SearchSFZ", self.ui.ch_sfz.isChecked())
  981. settings.setValue("PluginDatabase/SearchNative", self.ui.ch_native.isChecked())
  982. settings.setValue("PluginDatabase/SearchPOSIX32", self.ui.ch_posix32.isChecked())
  983. settings.setValue("PluginDatabase/SearchPOSIX64", self.ui.ch_posix64.isChecked())
  984. settings.setValue("PluginDatabase/SearchWin32", self.ui.ch_win32.isChecked())
  985. settings.setValue("PluginDatabase/SearchWin64", self.ui.ch_win64.isChecked())
  986. settings.setValue("PluginDatabase/DoChecks", self.ui.ch_do_checks.isChecked())
  987. def closeEvent(self, event):
  988. self.saveSettings()
  989. if self.fThread.isRunning():
  990. self.fThread.stop()
  991. killDiscovery()
  992. #self.fThread.terminate()
  993. self.fThread.wait()
  994. if self.fThread.hasSomethingChanged():
  995. self.accept()
  996. else:
  997. self.reject()
  998. QDialog.closeEvent(self, event)
  999. def done(self, r):
  1000. QDialog.done(self, r)
  1001. self.close()
  1002. # ------------------------------------------------------------------------------------------------------------
  1003. # Plugin Database Dialog
  1004. class PluginDatabaseW(QDialog):
  1005. def __init__(self, parent):
  1006. QDialog.__init__(self, parent)
  1007. self.ui = ui_carla_database.Ui_PluginDatabaseW()
  1008. self.ui.setupUi(self)
  1009. # -------------------------------------------------------------
  1010. # Internal stuff
  1011. self.fLastTableIndex = 0
  1012. self.fRetPlugin = None
  1013. self.fRealParent = parent
  1014. # -------------------------------------------------------------
  1015. # Load settings
  1016. self.loadSettings()
  1017. # -------------------------------------------------------------
  1018. # Set-up GUI
  1019. self.ui.b_add.setEnabled(False)
  1020. if BINARY_NATIVE in (BINARY_POSIX32, BINARY_WIN32):
  1021. self.ui.ch_bridged.setText(self.tr("Bridged (64bit)"))
  1022. else:
  1023. self.ui.ch_bridged.setText(self.tr("Bridged (32bit)"))
  1024. if not (LINUX or MACOS):
  1025. self.ui.ch_bridged_wine.setChecked(False)
  1026. self.ui.ch_bridged_wine.setEnabled(False)
  1027. # -------------------------------------------------------------
  1028. # Set-up connections
  1029. self.ui.b_add.clicked.connect(self.slot_addPlugin)
  1030. self.ui.b_refresh.clicked.connect(self.slot_refreshPlugins)
  1031. self.ui.tb_filters.clicked.connect(self.slot_maybeShowFilters)
  1032. self.ui.lineEdit.textChanged.connect(self.slot_checkFilters)
  1033. self.ui.tableWidget.currentCellChanged.connect(self.slot_checkPlugin)
  1034. self.ui.tableWidget.cellDoubleClicked.connect(self.slot_addPlugin)
  1035. self.ui.ch_effects.clicked.connect(self.slot_checkFilters)
  1036. self.ui.ch_instruments.clicked.connect(self.slot_checkFilters)
  1037. self.ui.ch_midi.clicked.connect(self.slot_checkFilters)
  1038. self.ui.ch_other.clicked.connect(self.slot_checkFilters)
  1039. self.ui.ch_internal.clicked.connect(self.slot_checkFilters)
  1040. self.ui.ch_ladspa.clicked.connect(self.slot_checkFilters)
  1041. self.ui.ch_dssi.clicked.connect(self.slot_checkFilters)
  1042. self.ui.ch_lv2.clicked.connect(self.slot_checkFilters)
  1043. self.ui.ch_vst.clicked.connect(self.slot_checkFilters)
  1044. self.ui.ch_vst3.clicked.connect(self.slot_checkFilters)
  1045. self.ui.ch_au.clicked.connect(self.slot_checkFilters)
  1046. self.ui.ch_csound.clicked.connect(self.slot_checkFilters)
  1047. self.ui.ch_kits.clicked.connect(self.slot_checkFilters)
  1048. self.ui.ch_native.clicked.connect(self.slot_checkFilters)
  1049. self.ui.ch_bridged.clicked.connect(self.slot_checkFilters)
  1050. self.ui.ch_bridged_wine.clicked.connect(self.slot_checkFilters)
  1051. self.ui.ch_rtsafe.clicked.connect(self.slot_checkFilters)
  1052. self.ui.ch_gui.clicked.connect(self.slot_checkFilters)
  1053. self.ui.ch_stereo.clicked.connect(self.slot_checkFilters)
  1054. # -------------------------------------------------------------
  1055. @pyqtSlot()
  1056. def slot_addPlugin(self):
  1057. if self.ui.tableWidget.currentRow() >= 0:
  1058. self.fRetPlugin = self.ui.tableWidget.item(self.ui.tableWidget.currentRow(), 0).data(Qt.UserRole)
  1059. self.accept()
  1060. else:
  1061. self.reject()
  1062. @pyqtSlot(int)
  1063. def slot_checkPlugin(self, row):
  1064. self.ui.b_add.setEnabled(row >= 0)
  1065. @pyqtSlot()
  1066. def slot_checkFilters(self):
  1067. self._checkFilters()
  1068. @pyqtSlot()
  1069. def slot_maybeShowFilters(self):
  1070. self._showFilters(not self.ui.frame.isVisible())
  1071. @pyqtSlot()
  1072. def slot_refreshPlugins(self):
  1073. if PluginRefreshW(self).exec_():
  1074. self._reAddPlugins()
  1075. if self.fRealParent:
  1076. self.fRealParent.setLoadRDFsNeeded()
  1077. def _checkFilters(self):
  1078. text = self.ui.lineEdit.text().lower()
  1079. hideEffects = not self.ui.ch_effects.isChecked()
  1080. hideInstruments = not self.ui.ch_instruments.isChecked()
  1081. hideMidi = not self.ui.ch_midi.isChecked()
  1082. hideOther = not self.ui.ch_other.isChecked()
  1083. hideInternal = not self.ui.ch_internal.isChecked()
  1084. hideLadspa = not self.ui.ch_ladspa.isChecked()
  1085. hideDssi = not self.ui.ch_dssi.isChecked()
  1086. hideLV2 = not self.ui.ch_lv2.isChecked()
  1087. hideVST = not self.ui.ch_vst.isChecked()
  1088. hideVST3 = not self.ui.ch_vst3.isChecked()
  1089. hideAU = not self.ui.ch_au.isChecked()
  1090. hideCsound = not self.ui.ch_csound.isChecked()
  1091. hideKits = not self.ui.ch_kits.isChecked()
  1092. hideNative = not self.ui.ch_native.isChecked()
  1093. hideBridged = not self.ui.ch_bridged.isChecked()
  1094. hideBridgedWine = not self.ui.ch_bridged_wine.isChecked()
  1095. hideNonRtSafe = self.ui.ch_rtsafe.isChecked()
  1096. hideNonGui = self.ui.ch_gui.isChecked()
  1097. hideNonStereo = self.ui.ch_stereo.isChecked()
  1098. if HAIKU or LINUX or MACOS:
  1099. nativeBins = [BINARY_POSIX32, BINARY_POSIX64]
  1100. wineBins = [BINARY_WIN32, BINARY_WIN64]
  1101. elif WINDOWS:
  1102. nativeBins = [BINARY_WIN32, BINARY_WIN64]
  1103. wineBins = []
  1104. else:
  1105. nativeBins = []
  1106. wineBins = []
  1107. rowCount = self.ui.tableWidget.rowCount()
  1108. for i in range(rowCount):
  1109. self.ui.tableWidget.showRow(i)
  1110. plugin = self.ui.tableWidget.item(i, 0).data(Qt.UserRole)
  1111. aIns = plugin['audio.ins']
  1112. aOuts = plugin['audio.outs']
  1113. mIns = plugin['midi.ins']
  1114. mOuts = plugin['midi.outs']
  1115. ptype = self.ui.tableWidget.item(i, 12).text()
  1116. isSynth = bool(plugin['hints'] & PLUGIN_IS_SYNTH)
  1117. isEffect = bool(aIns > 0 < aOuts and not isSynth)
  1118. isMidi = bool(aIns == 0 and aOuts == 0 and mIns > 0 < mOuts)
  1119. isKit = bool(ptype in ("GIG", "SF2", "SFZ"))
  1120. isOther = bool(not (isEffect or isSynth or isMidi or isKit))
  1121. isNative = bool(plugin['build'] == BINARY_NATIVE)
  1122. isRtSafe = bool(plugin['hints'] & PLUGIN_IS_RTSAFE)
  1123. isStereo = bool(aIns == 2 and aOuts == 2) or (isSynth and aOuts == 2)
  1124. hasGui = bool(plugin['hints'] & PLUGIN_HAS_CUSTOM_UI)
  1125. isBridged = bool(not isNative and plugin['build'] in nativeBins)
  1126. isBridgedWine = bool(not isNative and plugin['build'] in wineBins)
  1127. if hideEffects and isEffect:
  1128. self.ui.tableWidget.hideRow(i)
  1129. elif hideInstruments and isSynth:
  1130. self.ui.tableWidget.hideRow(i)
  1131. elif hideMidi and isMidi:
  1132. self.ui.tableWidget.hideRow(i)
  1133. elif hideOther and isOther:
  1134. self.ui.tableWidget.hideRow(i)
  1135. elif hideKits and isKit:
  1136. self.ui.tableWidget.hideRow(i)
  1137. elif hideInternal and ptype == self.tr("Internal"):
  1138. self.ui.tableWidget.hideRow(i)
  1139. elif hideLadspa and ptype == "LADSPA":
  1140. self.ui.tableWidget.hideRow(i)
  1141. elif hideDssi and ptype == "DSSI":
  1142. self.ui.tableWidget.hideRow(i)
  1143. elif hideLV2 and ptype == "LV2":
  1144. self.ui.tableWidget.hideRow(i)
  1145. elif hideVST and ptype == "VST":
  1146. self.ui.tableWidget.hideRow(i)
  1147. elif hideVST3 and ptype == "VST3":
  1148. self.ui.tableWidget.hideRow(i)
  1149. elif hideAU and ptype == "AU":
  1150. self.ui.tableWidget.hideRow(i)
  1151. elif hideCsound and ptype == "CSD":
  1152. self.ui.tableWidget.hideRow(i)
  1153. elif hideNative and isNative:
  1154. self.ui.tableWidget.hideRow(i)
  1155. elif hideBridged and isBridged:
  1156. self.ui.tableWidget.hideRow(i)
  1157. elif hideBridgedWine and isBridgedWine:
  1158. self.ui.tableWidget.hideRow(i)
  1159. elif hideNonRtSafe and not isRtSafe:
  1160. self.ui.tableWidget.hideRow(i)
  1161. elif hideNonGui and not hasGui:
  1162. self.ui.tableWidget.hideRow(i)
  1163. elif hideNonStereo and not isStereo:
  1164. self.ui.tableWidget.hideRow(i)
  1165. elif (text and not (
  1166. text in self.ui.tableWidget.item(i, 0).text().lower() or
  1167. text in self.ui.tableWidget.item(i, 1).text().lower() or
  1168. text in self.ui.tableWidget.item(i, 2).text().lower() or
  1169. text in self.ui.tableWidget.item(i, 3).text().lower() or
  1170. text in self.ui.tableWidget.item(i, 13).text().lower())):
  1171. self.ui.tableWidget.hideRow(i)
  1172. def _showFilters(self, yesNo):
  1173. self.ui.tb_filters.setArrowType(Qt.UpArrow if yesNo else Qt.DownArrow)
  1174. self.ui.frame.setVisible(yesNo)
  1175. def _addPluginToTable(self, plugin, ptype):
  1176. if plugin['API'] != PLUGIN_QUERY_API_VERSION:
  1177. return
  1178. index = self.fLastTableIndex
  1179. if plugin['build'] == BINARY_NATIVE:
  1180. bridgeText = self.tr("No")
  1181. else:
  1182. if LINUX or MACOS:
  1183. if plugin['build'] == BINARY_WIN32:
  1184. typeText = "32bit"
  1185. elif plugin['build'] == BINARY_WIN64:
  1186. typeText = "64bit"
  1187. else:
  1188. typeText = self.tr("Unknown")
  1189. else:
  1190. if plugin['build'] == BINARY_POSIX32:
  1191. typeText = "32bit"
  1192. elif plugin['build'] == BINARY_POSIX64:
  1193. typeText = "64bit"
  1194. elif plugin['build'] == BINARY_WIN32:
  1195. typeText = "Windows 32bit"
  1196. elif plugin['build'] == BINARY_WIN64:
  1197. typeText = "Windows 64bit"
  1198. else:
  1199. typeText = self.tr("Unknown")
  1200. bridgeText = self.tr("Yes (%s)" % typeText)
  1201. self.ui.tableWidget.insertRow(index)
  1202. self.ui.tableWidget.setItem(index, 0, QTableWidgetItem(str(plugin['name'])))
  1203. self.ui.tableWidget.setItem(index, 1, QTableWidgetItem(str(plugin['label'])))
  1204. self.ui.tableWidget.setItem(index, 2, QTableWidgetItem(str(plugin['maker'])))
  1205. self.ui.tableWidget.setItem(index, 3, QTableWidgetItem(str(plugin['uniqueId'])))
  1206. self.ui.tableWidget.setItem(index, 4, QTableWidgetItem(str(plugin['audio.ins'])))
  1207. self.ui.tableWidget.setItem(index, 5, QTableWidgetItem(str(plugin['audio.outs'])))
  1208. self.ui.tableWidget.setItem(index, 6, QTableWidgetItem(str(plugin['parameters.ins'])))
  1209. self.ui.tableWidget.setItem(index, 7, QTableWidgetItem(str(plugin['parameters.outs'])))
  1210. self.ui.tableWidget.setItem(index, 8, QTableWidgetItem(str(plugin['programs.total'])))
  1211. self.ui.tableWidget.setItem(index, 9, QTableWidgetItem(self.tr("Yes") if (plugin['hints'] & PLUGIN_HAS_CUSTOM_UI) else self.tr("No")))
  1212. self.ui.tableWidget.setItem(index, 10, QTableWidgetItem(self.tr("Yes") if (plugin['hints'] & PLUGIN_IS_SYNTH) else self.tr("No")))
  1213. self.ui.tableWidget.setItem(index, 11, QTableWidgetItem(bridgeText))
  1214. self.ui.tableWidget.setItem(index, 12, QTableWidgetItem(ptype))
  1215. self.ui.tableWidget.setItem(index, 13, QTableWidgetItem(str(plugin['filename'])))
  1216. self.ui.tableWidget.item(index, 0).setData(Qt.UserRole, plugin)
  1217. self.fLastTableIndex += 1
  1218. def _reAddPlugins(self):
  1219. settingsDB = QSettings("falkTX", "CarlaPlugins2")
  1220. for x in range(self.ui.tableWidget.rowCount()):
  1221. self.ui.tableWidget.removeRow(0)
  1222. self.fLastTableIndex = 0
  1223. self.ui.tableWidget.setSortingEnabled(False)
  1224. internalCount = 0
  1225. ladspaCount = 0
  1226. dssiCount = 0
  1227. lv2Count = 0
  1228. vstCount = 0
  1229. vst3Count = 0
  1230. auCount = 0
  1231. csdCount = 0
  1232. kitCount = 0
  1233. # ---------------------------------------------------------------------------
  1234. # Internal
  1235. internalPlugins = toList(settingsDB.value("Plugins/Internal", []))
  1236. for plugins in internalPlugins:
  1237. internalCount += len(plugins)
  1238. canRefreshInternals = not (gCarla.isControl or gCarla.isPlugin or gCarla.host is None)
  1239. if canRefreshInternals and internalCount != gCarla.host.get_internal_plugin_count():
  1240. internalCount = gCarla.host.get_internal_plugin_count()
  1241. internalPlugins = []
  1242. for i in range(gCarla.host.get_internal_plugin_count()):
  1243. descInfo = gCarla.host.get_internal_plugin_info(i)
  1244. plugins = checkPluginInternal(descInfo)
  1245. if plugins:
  1246. internalPlugins.append(plugins)
  1247. settingsDB.setValue("Plugins/Internal", internalPlugins)
  1248. for plugins in internalPlugins:
  1249. for plugin in plugins:
  1250. self._addPluginToTable(plugin, self.tr("Internal"))
  1251. del internalPlugins
  1252. # ---------------------------------------------------------------------------
  1253. # LADSPA
  1254. ladspaPlugins = []
  1255. ladspaPlugins += toList(settingsDB.value("Plugins/LADSPA_native", []))
  1256. ladspaPlugins += toList(settingsDB.value("Plugins/LADSPA_posix32", []))
  1257. ladspaPlugins += toList(settingsDB.value("Plugins/LADSPA_posix64", []))
  1258. ladspaPlugins += toList(settingsDB.value("Plugins/LADSPA_win32", []))
  1259. ladspaPlugins += toList(settingsDB.value("Plugins/LADSPA_win64", []))
  1260. for plugins in ladspaPlugins:
  1261. for plugin in plugins:
  1262. self._addPluginToTable(plugin, "LADSPA")
  1263. ladspaCount += 1
  1264. del ladspaPlugins
  1265. # ---------------------------------------------------------------------------
  1266. # DSSI
  1267. dssiPlugins = []
  1268. dssiPlugins += toList(settingsDB.value("Plugins/DSSI_native", []))
  1269. dssiPlugins += toList(settingsDB.value("Plugins/DSSI_posix32", []))
  1270. dssiPlugins += toList(settingsDB.value("Plugins/DSSI_posix64", []))
  1271. dssiPlugins += toList(settingsDB.value("Plugins/DSSI_win32", []))
  1272. dssiPlugins += toList(settingsDB.value("Plugins/DSSI_win64", []))
  1273. for plugins in dssiPlugins:
  1274. for plugin in plugins:
  1275. self._addPluginToTable(plugin, "DSSI")
  1276. dssiCount += 1
  1277. del dssiPlugins
  1278. # ---------------------------------------------------------------------------
  1279. # LV2
  1280. lv2Plugins = []
  1281. lv2Plugins += toList(settingsDB.value("Plugins/LV2_native", []))
  1282. lv2Plugins += toList(settingsDB.value("Plugins/LV2_posix32", []))
  1283. lv2Plugins += toList(settingsDB.value("Plugins/LV2_posix64", []))
  1284. lv2Plugins += toList(settingsDB.value("Plugins/LV2_win32", []))
  1285. lv2Plugins += toList(settingsDB.value("Plugins/LV2_win64", []))
  1286. for plugins in lv2Plugins:
  1287. for plugin in plugins:
  1288. self._addPluginToTable(plugin, "LV2")
  1289. lv2Count += 1
  1290. del lv2Plugins
  1291. # ---------------------------------------------------------------------------
  1292. # VST
  1293. vstPlugins = []
  1294. vstPlugins += toList(settingsDB.value("Plugins/VST_native", []))
  1295. vstPlugins += toList(settingsDB.value("Plugins/VST_posix32", []))
  1296. vstPlugins += toList(settingsDB.value("Plugins/VST_posix64", []))
  1297. vstPlugins += toList(settingsDB.value("Plugins/VST_win32", []))
  1298. vstPlugins += toList(settingsDB.value("Plugins/VST_win64", []))
  1299. for plugins in vstPlugins:
  1300. for plugin in plugins:
  1301. self._addPluginToTable(plugin, "VST")
  1302. vstCount += 1
  1303. del vstPlugins
  1304. # ---------------------------------------------------------------------------
  1305. # VST3
  1306. vst3Plugins = []
  1307. vst3Plugins += toList(settingsDB.value("Plugins/VST3_native", []))
  1308. vst3Plugins += toList(settingsDB.value("Plugins/VST3_posix32", []))
  1309. vst3Plugins += toList(settingsDB.value("Plugins/VST3_posix64", []))
  1310. vst3Plugins += toList(settingsDB.value("Plugins/VST3_win32", []))
  1311. vst3Plugins += toList(settingsDB.value("Plugins/VST3_win64", []))
  1312. for plugins in vst3Plugins:
  1313. for plugin in plugins:
  1314. self._addPluginToTable(plugin, "VST3")
  1315. vst3Count += 1
  1316. del vst3Plugins
  1317. # ---------------------------------------------------------------------------
  1318. # AU
  1319. if MACOS:
  1320. auPlugins = []
  1321. auPlugins += toList(settingsDB.value("Plugins/AU_native", []))
  1322. auPlugins += toList(settingsDB.value("Plugins/AU_posix32", []))
  1323. auPlugins += toList(settingsDB.value("Plugins/AU_posix64", []))
  1324. for plugins in auPlugins:
  1325. for plugin in plugins:
  1326. self._addPluginToTable(plugin, "AU")
  1327. auCount += 1
  1328. del auPlugins
  1329. # ---------------------------------------------------------------------------
  1330. # Csound
  1331. #csds = toList(settingsDB.value("Plugins/CSD", []))
  1332. #for csd in csds:
  1333. #for csd_i in csd:
  1334. #self._addPluginToTable(csd_i, "CSD")
  1335. #csdCount += 1
  1336. #del csds
  1337. # ---------------------------------------------------------------------------
  1338. # Kits
  1339. gigs = toList(settingsDB.value("Plugins/GIG", []))
  1340. for gig in gigs:
  1341. for gig_i in gig:
  1342. self._addPluginToTable(gig_i, "GIG")
  1343. kitCount += 1
  1344. del gigs
  1345. # ---------------------------------------------------------------------------
  1346. sf2s = toList(settingsDB.value("Plugins/SF2", []))
  1347. for sf2 in sf2s:
  1348. for sf2_i in sf2:
  1349. self._addPluginToTable(sf2_i, "SF2")
  1350. kitCount += 1
  1351. del sf2s
  1352. # ---------------------------------------------------------------------------
  1353. sfzs = toList(settingsDB.value("Plugins/SFZ", []))
  1354. for sfz in sfzs:
  1355. for sfz_i in sfz:
  1356. self._addPluginToTable(sfz_i, "SFZ")
  1357. kitCount += 1
  1358. del sfzs
  1359. # ---------------------------------------------------------------------------
  1360. self.ui.tableWidget.setSortingEnabled(True)
  1361. self.ui.tableWidget.sortByColumn(0, Qt.AscendingOrder)
  1362. if MACOS:
  1363. self.ui.label.setText(self.tr("Have %i Internal, %i LADSPA, %i DSSI, %i LV2, %i VST, %i VST3 and %i AudioUnit plugins, plus %i Sound Kits" % (
  1364. internalCount, ladspaCount, dssiCount, lv2Count, vstCount, vst3Count, auCount, kitCount)))
  1365. else:
  1366. self.ui.label.setText(self.tr("Have %i Internal, %i LADSPA, %i DSSI, %i LV2, %i VST and %i VST3 plugins, plus %i Sound Kits" % (
  1367. internalCount, ladspaCount, dssiCount, lv2Count, vstCount, vst3Count, kitCount)))
  1368. # %i Csound modules and
  1369. self._checkFilters()
  1370. def loadSettings(self):
  1371. settings = QSettings()
  1372. self.restoreGeometry(settings.value("PluginDatabase/Geometry", ""))
  1373. self.ui.tableWidget.horizontalHeader().restoreState(settings.value("PluginDatabase/TableGeometry", ""))
  1374. self.ui.ch_effects.setChecked(settings.value("PluginDatabase/ShowEffects", True, type=bool))
  1375. self.ui.ch_instruments.setChecked(settings.value("PluginDatabase/ShowInstruments", True, type=bool))
  1376. self.ui.ch_midi.setChecked(settings.value("PluginDatabase/ShowMIDI", True, type=bool))
  1377. self.ui.ch_other.setChecked(settings.value("PluginDatabase/ShowOther", True, type=bool))
  1378. self.ui.ch_internal.setChecked(settings.value("PluginDatabase/ShowInternal", True, type=bool))
  1379. self.ui.ch_ladspa.setChecked(settings.value("PluginDatabase/ShowLADSPA", True, type=bool))
  1380. self.ui.ch_dssi.setChecked(settings.value("PluginDatabase/ShowDSSI", True, type=bool))
  1381. self.ui.ch_lv2.setChecked(settings.value("PluginDatabase/ShowLV2", True, type=bool))
  1382. self.ui.ch_vst.setChecked(settings.value("PluginDatabase/ShowVST", True, type=bool))
  1383. self.ui.ch_vst3.setChecked(settings.value("PluginDatabase/ShowVST3", (MACOS or WINDOWS), type=bool))
  1384. self.ui.ch_au.setChecked(settings.value("PluginDatabase/ShowAU", True, type=bool))
  1385. self.ui.ch_csound.setChecked(settings.value("PluginDatabase/ShowCsound", True, type=bool))
  1386. self.ui.ch_kits.setChecked(settings.value("PluginDatabase/ShowKits", True, type=bool))
  1387. self.ui.ch_native.setChecked(settings.value("PluginDatabase/ShowNative", True, type=bool))
  1388. self.ui.ch_bridged.setChecked(settings.value("PluginDatabase/ShowBridged", True, type=bool))
  1389. self.ui.ch_bridged_wine.setChecked(settings.value("PluginDatabase/ShowBridgedWine", True, type=bool))
  1390. self.ui.ch_rtsafe.setChecked(settings.value("PluginDatabase/ShowRtSafe", False, type=bool))
  1391. self.ui.ch_gui.setChecked(settings.value("PluginDatabase/ShowHasGUI", False, type=bool))
  1392. self.ui.ch_stereo.setChecked(settings.value("PluginDatabase/ShowStereoOnly", False, type=bool))
  1393. self._showFilters(settings.value("PluginDatabase/ShowFilters", False, type=bool))
  1394. self._reAddPlugins()
  1395. def saveSettings(self):
  1396. settings = QSettings()
  1397. settings.setValue("PluginDatabase/Geometry", self.saveGeometry())
  1398. settings.setValue("PluginDatabase/TableGeometry", self.ui.tableWidget.horizontalHeader().saveState())
  1399. settings.setValue("PluginDatabase/ShowFilters", (self.ui.tb_filters.arrowType() == Qt.UpArrow))
  1400. settings.setValue("PluginDatabase/ShowEffects", self.ui.ch_effects.isChecked())
  1401. settings.setValue("PluginDatabase/ShowInstruments", self.ui.ch_instruments.isChecked())
  1402. settings.setValue("PluginDatabase/ShowMIDI", self.ui.ch_midi.isChecked())
  1403. settings.setValue("PluginDatabase/ShowOther", self.ui.ch_other.isChecked())
  1404. settings.setValue("PluginDatabase/ShowInternal", self.ui.ch_internal.isChecked())
  1405. settings.setValue("PluginDatabase/ShowLADSPA", self.ui.ch_ladspa.isChecked())
  1406. settings.setValue("PluginDatabase/ShowDSSI", self.ui.ch_dssi.isChecked())
  1407. settings.setValue("PluginDatabase/ShowLV2", self.ui.ch_lv2.isChecked())
  1408. settings.setValue("PluginDatabase/ShowVST", self.ui.ch_vst.isChecked())
  1409. settings.setValue("PluginDatabase/ShowVST3", self.ui.ch_vst3.isChecked())
  1410. settings.setValue("PluginDatabase/ShowAU", self.ui.ch_au.isChecked())
  1411. settings.setValue("PluginDatabase/ShowCsound", self.ui.ch_csound.isChecked())
  1412. settings.setValue("PluginDatabase/ShowKits", self.ui.ch_kits.isChecked())
  1413. settings.setValue("PluginDatabase/ShowNative", self.ui.ch_native.isChecked())
  1414. settings.setValue("PluginDatabase/ShowBridged", self.ui.ch_bridged.isChecked())
  1415. settings.setValue("PluginDatabase/ShowBridgedWine", self.ui.ch_bridged_wine.isChecked())
  1416. settings.setValue("PluginDatabase/ShowRtSafe", self.ui.ch_rtsafe.isChecked())
  1417. settings.setValue("PluginDatabase/ShowHasGUI", self.ui.ch_gui.isChecked())
  1418. settings.setValue("PluginDatabase/ShowStereoOnly", self.ui.ch_stereo.isChecked())
  1419. def closeEvent(self, event):
  1420. self.saveSettings()
  1421. QDialog.closeEvent(self, event)
  1422. def done(self, r):
  1423. QDialog.done(self, r)
  1424. self.close()
  1425. # ------------------------------------------------------------------------------------------------------------
  1426. # Main
  1427. if __name__ == '__main__':
  1428. from carla_style import CarlaApplication
  1429. app = CarlaApplication()
  1430. initHost("Settings", None, False)
  1431. gui = PluginDatabaseW(None)
  1432. gui.show()
  1433. sys.exit(app.exec_())