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.

carla_database.py 70KB

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