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

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