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