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.

1754 lines
67KB

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