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

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