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.

1833 lines
70KB

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