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.

1852 lines
72KB

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