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.

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