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

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