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