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

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