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 67KB

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