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.

1723 lines
67KB

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