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

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
10 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
10 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
9 years ago
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491
  1. #!/usr/bin/env python3
  2. # -*- coding: utf-8 -*-
  3. # Carla plugin database code
  4. # Copyright (C) 2011-2021 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. from PyQt5.QtCore import pyqtSignal, pyqtSlot, Qt, QByteArray, QEventLoop, QThread
  22. from PyQt5.QtGui import QPixmap
  23. from PyQt5.QtWidgets import QApplication, QDialog, QDialogButtonBox, QHeaderView, QTableWidgetItem
  24. # ---------------------------------------------------------------------------------------------------------------------
  25. # Imports (Custom)
  26. import ui_carla_add_jack
  27. import ui_carla_database
  28. import ui_carla_refresh
  29. from carla_backend import *
  30. from carla_shared import *
  31. from carla_utils import getPluginTypeAsString, getPluginCategoryAsString
  32. # ---------------------------------------------------------------------------------------------------------------------
  33. # Try Import LADSPA-RDF
  34. if WINDOWS:
  35. haveLRDF = False
  36. elif not CXFREEZE:
  37. try:
  38. import ladspa_rdf
  39. import json
  40. haveLRDF = True
  41. except:
  42. qWarning("LRDF Support not available (LADSPA-RDF will be disabled)")
  43. haveLRDF = False
  44. else:
  45. qWarning("LRDF Support disabled for static build (LADSPA-RDF will be disabled)")
  46. haveLRDF = False
  47. # ---------------------------------------------------------------------------------------------------------------------
  48. # Set LADSPA-RDF Path
  49. if haveLRDF and readEnvVars:
  50. LADSPA_RDF_PATH_env = os.getenv("LADSPA_RDF_PATH")
  51. if LADSPA_RDF_PATH_env:
  52. try:
  53. ladspa_rdf.set_rdf_path(LADSPA_RDF_PATH_env.split(splitter))
  54. except:
  55. pass
  56. del LADSPA_RDF_PATH_env
  57. # ---------------------------------------------------------------------------------------------------------------------
  58. # Plugin Query (helper functions)
  59. def findBinaries(binPath, pluginType, OS):
  60. binaries = []
  61. if OS == "HAIKU":
  62. extensions = ("") if pluginType == PLUGIN_VST2 else (".so",)
  63. elif OS == "MACOS":
  64. extensions = (".dylib", ".so")
  65. elif OS == "WINDOWS":
  66. extensions = (".dll",)
  67. else:
  68. extensions = (".so",)
  69. for root, dirs, files in os.walk(binPath):
  70. for name in tuple(name for name in files if name.lower().endswith(extensions)):
  71. binaries.append(os.path.join(root, name))
  72. return binaries
  73. def findVST3Binaries(binPath):
  74. binaries = []
  75. for root, dirs, files in os.walk(binPath):
  76. for name in tuple(name for name in (files+dirs) if name.lower().endswith(".vst3")):
  77. binaries.append(os.path.join(root, name))
  78. return binaries
  79. def findLV2Bundles(bundlePath):
  80. bundles = []
  81. for root, dirs, files in os.walk(bundlePath, followlinks=True):
  82. if root == bundlePath: continue
  83. if os.path.exists(os.path.join(root, "manifest.ttl")):
  84. bundles.append(root)
  85. return bundles
  86. def findMacVSTBundles(bundlePath, isVST3):
  87. bundles = []
  88. extension = ".vst3" if isVST3 else ".vst"
  89. for root, dirs, files in os.walk(bundlePath, followlinks=True):
  90. #if root == bundlePath: continue # FIXME
  91. for name in tuple(name for name in dirs if name.lower().endswith(extension)):
  92. bundles.append(os.path.join(root, name))
  93. return bundles
  94. def findFilenames(filePath, stype):
  95. filenames = []
  96. if stype == "sf2":
  97. extensions = (".sf2",".sf3",)
  98. else:
  99. return []
  100. for root, dirs, files in os.walk(filePath):
  101. for name in tuple(name for name in files if name.lower().endswith(extensions)):
  102. filenames.append(os.path.join(root, name))
  103. return filenames
  104. # ---------------------------------------------------------------------------------------------------------------------
  105. # Plugin Query
  106. PLUGIN_QUERY_API_VERSION = 12
  107. PyPluginInfo = {
  108. 'API': PLUGIN_QUERY_API_VERSION,
  109. 'valid': False,
  110. 'build': BINARY_NONE,
  111. 'type': PLUGIN_NONE,
  112. 'hints': 0x0,
  113. 'category': "",
  114. 'filename': "",
  115. 'name': "",
  116. 'label': "",
  117. 'maker': "",
  118. 'uniqueId': 0,
  119. 'audio.ins': 0,
  120. 'audio.outs': 0,
  121. 'cv.ins': 0,
  122. 'cv.outs': 0,
  123. 'midi.ins': 0,
  124. 'midi.outs': 0,
  125. 'parameters.ins': 0,
  126. 'parameters.outs': 0
  127. }
  128. gDiscoveryProcess = None
  129. def findWinePrefix(filename, recursionLimit = 10):
  130. if recursionLimit == 0 or len(filename) < 5 or "/" not in filename:
  131. return ""
  132. path = filename[:filename.rfind("/")]
  133. if os.path.isdir(path + "/dosdevices"):
  134. return path
  135. return findWinePrefix(path, recursionLimit-1)
  136. def runCarlaDiscovery(itype, stype, filename, tool, wineSettings=None):
  137. if not os.path.exists(tool):
  138. qWarning("runCarlaDiscovery() - tool '%s' does not exist" % tool)
  139. return
  140. command = []
  141. if LINUX or MACOS:
  142. command.append("env")
  143. command.append("LANG=C")
  144. command.append("LD_PRELOAD=")
  145. if wineSettings is not None:
  146. command.append("WINEDEBUG=-all")
  147. if wineSettings['autoPrefix']:
  148. winePrefix = findWinePrefix(filename)
  149. else:
  150. winePrefix = ""
  151. if not winePrefix:
  152. envWinePrefix = os.getenv("WINEPREFIX")
  153. if envWinePrefix:
  154. winePrefix = envWinePrefix
  155. elif wineSettings['fallbackPrefix']:
  156. winePrefix = os.path.expanduser(wineSettings['fallbackPrefix'])
  157. else:
  158. winePrefix = os.path.expanduser("~/.wine")
  159. wineCMD = wineSettings['executable'] if wineSettings['executable'] else "wine"
  160. if tool.endswith("64.exe") and os.path.exists(wineCMD + "64"):
  161. wineCMD += "64"
  162. command.append("WINEPREFIX=" + winePrefix)
  163. command.append(wineCMD)
  164. command.append(tool)
  165. command.append(stype)
  166. command.append(filename)
  167. global gDiscoveryProcess
  168. gDiscoveryProcess = Popen(command, stdout=PIPE)
  169. pinfo = None
  170. plugins = []
  171. fakeLabel = os.path.basename(filename).rsplit(".", 1)[0]
  172. while True:
  173. try:
  174. line = gDiscoveryProcess.stdout.readline().decode("utf-8", errors="ignore")
  175. except:
  176. print("ERROR: discovery readline failed")
  177. break
  178. # line is valid, strip it
  179. if line:
  180. line = line.strip()
  181. # line is invalid, try poll() again
  182. elif gDiscoveryProcess.poll() is None:
  183. continue
  184. # line is invalid and poll() failed, stop here
  185. else:
  186. break
  187. if line == "carla-discovery::init::-----------":
  188. pinfo = deepcopy(PyPluginInfo)
  189. pinfo['type'] = itype
  190. pinfo['filename'] = filename if filename != ":all" else ""
  191. elif line == "carla-discovery::end::------------":
  192. if pinfo is not None:
  193. plugins.append(pinfo)
  194. del pinfo
  195. pinfo = None
  196. elif line == "Segmentation fault":
  197. print("carla-discovery::crash::%s crashed during discovery" % filename)
  198. elif line.startswith("err:module:import_dll Library"):
  199. print(line)
  200. elif line.startswith("carla-discovery::info::"):
  201. print("%s - %s" % (line, filename))
  202. elif line.startswith("carla-discovery::warning::"):
  203. print("%s - %s" % (line, filename))
  204. elif line.startswith("carla-discovery::error::"):
  205. print("%s - %s" % (line, filename))
  206. elif line.startswith("carla-discovery::"):
  207. if pinfo == None:
  208. continue
  209. try:
  210. prop, value = line.replace("carla-discovery::", "").split("::", 1)
  211. except:
  212. continue
  213. if prop == "build":
  214. if value.isdigit(): pinfo['build'] = int(value)
  215. elif prop == "name":
  216. pinfo['name'] = value if value else fakeLabel
  217. elif prop == "label":
  218. pinfo['label'] = value if value else fakeLabel
  219. elif prop == "filename":
  220. pinfo['filename'] = value
  221. elif prop == "maker":
  222. pinfo['maker'] = value
  223. elif prop == "category":
  224. pinfo['category'] = value
  225. elif prop == "uniqueId":
  226. if value.isdigit(): pinfo['uniqueId'] = int(value)
  227. elif prop == "hints":
  228. if value.isdigit(): pinfo['hints'] = int(value)
  229. elif prop == "audio.ins":
  230. if value.isdigit(): pinfo['audio.ins'] = int(value)
  231. elif prop == "audio.outs":
  232. if value.isdigit(): pinfo['audio.outs'] = int(value)
  233. elif prop == "cv.ins":
  234. if value.isdigit(): pinfo['cv.ins'] = int(value)
  235. elif prop == "cv.outs":
  236. if value.isdigit(): pinfo['cv.outs'] = int(value)
  237. elif prop == "midi.ins":
  238. if value.isdigit(): pinfo['midi.ins'] = int(value)
  239. elif prop == "midi.outs":
  240. if value.isdigit(): pinfo['midi.outs'] = int(value)
  241. elif prop == "parameters.ins":
  242. if value.isdigit(): pinfo['parameters.ins'] = int(value)
  243. elif prop == "parameters.outs":
  244. if value.isdigit(): pinfo['parameters.outs'] = int(value)
  245. elif prop == "uri":
  246. if value:
  247. pinfo['label'] = value
  248. else:
  249. # cannot use empty URIs
  250. del pinfo
  251. pinfo = None
  252. continue
  253. else:
  254. print("%s - %s (unknown property)" % (line, filename))
  255. tmp = gDiscoveryProcess
  256. gDiscoveryProcess = None
  257. del tmp
  258. return plugins
  259. def killDiscovery():
  260. global gDiscoveryProcess
  261. if gDiscoveryProcess is not None:
  262. gDiscoveryProcess.kill()
  263. def checkPluginCached(desc, ptype):
  264. pinfo = deepcopy(PyPluginInfo)
  265. pinfo['build'] = BINARY_NATIVE
  266. pinfo['type'] = ptype
  267. pinfo['hints'] = desc['hints']
  268. pinfo['name'] = desc['name']
  269. pinfo['label'] = desc['label']
  270. pinfo['maker'] = desc['maker']
  271. pinfo['category'] = getPluginCategoryAsString(desc['category'])
  272. pinfo['audio.ins'] = desc['audioIns']
  273. pinfo['audio.outs'] = desc['audioOuts']
  274. pinfo['cv.ins'] = desc['cvIns']
  275. pinfo['cv.outs'] = desc['cvOuts']
  276. pinfo['midi.ins'] = desc['midiIns']
  277. pinfo['midi.outs'] = desc['midiOuts']
  278. pinfo['parameters.ins'] = desc['parameterIns']
  279. pinfo['parameters.outs'] = desc['parameterOuts']
  280. if ptype == PLUGIN_LV2:
  281. pinfo['filename'], pinfo['label'] = pinfo['label'].split('\\' if WINDOWS else '/',1)
  282. elif ptype == PLUGIN_SFZ:
  283. pinfo['filename'] = pinfo['label']
  284. pinfo['label'] = pinfo['name']
  285. # TODO(jsfx) what to do here?
  286. elif ptype == PLUGIN_JSFX:
  287. pinfo['filename'] = pinfo['label']
  288. pinfo['label'] = pinfo['name']
  289. return pinfo
  290. def checkPluginLADSPA(filename, tool, wineSettings=None):
  291. return runCarlaDiscovery(PLUGIN_LADSPA, "LADSPA", filename, tool, wineSettings)
  292. def checkPluginDSSI(filename, tool, wineSettings=None):
  293. return runCarlaDiscovery(PLUGIN_DSSI, "DSSI", filename, tool, wineSettings)
  294. def checkPluginLV2(filename, tool, wineSettings=None):
  295. return runCarlaDiscovery(PLUGIN_LV2, "LV2", filename, tool, wineSettings)
  296. def checkPluginVST2(filename, tool, wineSettings=None):
  297. return runCarlaDiscovery(PLUGIN_VST2, "VST2", filename, tool, wineSettings)
  298. def checkPluginVST3(filename, tool, wineSettings=None):
  299. return runCarlaDiscovery(PLUGIN_VST3, "VST3", filename, tool, wineSettings)
  300. def checkFileSF2(filename, tool):
  301. return runCarlaDiscovery(PLUGIN_SF2, "SF2", filename, tool)
  302. def checkFileSFZ(filename, tool):
  303. return runCarlaDiscovery(PLUGIN_SFZ, "SFZ", filename, tool)
  304. def checkAllPluginsAU(tool):
  305. return runCarlaDiscovery(PLUGIN_AU, "AU", ":all", tool)
  306. # ---------------------------------------------------------------------------------------------------------------------
  307. # Separate Thread for Plugin Search
  308. class SearchPluginsThread(QThread):
  309. pluginLook = pyqtSignal(int, str)
  310. def __init__(self, parent, pathBinaries):
  311. QThread.__init__(self, parent)
  312. self.fContinueChecking = False
  313. self.fPathBinaries = pathBinaries
  314. self.fCheckNative = False
  315. self.fCheckPosix32 = False
  316. self.fCheckPosix64 = False
  317. self.fCheckWin32 = False
  318. self.fCheckWin64 = False
  319. self.fCheckLADSPA = False
  320. self.fCheckDSSI = False
  321. self.fCheckLV2 = False
  322. self.fCheckVST2 = False
  323. self.fCheckVST3 = False
  324. self.fCheckAU = False
  325. self.fCheckSF2 = False
  326. self.fCheckSFZ = False
  327. self.fCheckJSFX = False
  328. if WINDOWS:
  329. toolNative = "carla-discovery-native.exe"
  330. self.fWineSettings = None
  331. else:
  332. toolNative = "carla-discovery-native"
  333. settings = QSafeSettings("falkTX", "Carla2")
  334. self.fWineSettings = {
  335. 'executable' : settings.value(CARLA_KEY_WINE_EXECUTABLE, CARLA_DEFAULT_WINE_EXECUTABLE, str),
  336. 'autoPrefix' : settings.value(CARLA_KEY_WINE_AUTO_PREFIX, CARLA_DEFAULT_WINE_AUTO_PREFIX, bool),
  337. 'fallbackPrefix': settings.value(CARLA_KEY_WINE_FALLBACK_PREFIX, CARLA_DEFAULT_WINE_FALLBACK_PREFIX, str)
  338. }
  339. del settings
  340. self.fToolNative = os.path.join(pathBinaries, toolNative)
  341. if not os.path.exists(self.fToolNative):
  342. self.fToolNative = ""
  343. self.fCurCount = 0
  344. self.fCurPercentValue = 0
  345. self.fLastCheckValue = 0
  346. self.fSomethingChanged = False
  347. # -------------------------------------------------------------
  348. def hasSomethingChanged(self):
  349. return self.fSomethingChanged
  350. def setSearchBinaryTypes(self, native, posix32, posix64, win32, win64):
  351. self.fCheckNative = native
  352. self.fCheckPosix32 = posix32
  353. self.fCheckPosix64 = posix64
  354. self.fCheckWin32 = win32
  355. self.fCheckWin64 = win64
  356. def setSearchPluginTypes(self, ladspa, dssi, lv2, vst2, vst3, au, sf2, sfz, jsfx):
  357. self.fCheckLADSPA = ladspa
  358. self.fCheckDSSI = dssi
  359. self.fCheckLV2 = lv2
  360. self.fCheckVST2 = vst2
  361. self.fCheckVST3 = vst3 and (LINUX or MACOS or WINDOWS)
  362. self.fCheckAU = au and MACOS
  363. self.fCheckSF2 = sf2
  364. self.fCheckSFZ = sfz
  365. self.fCheckJSFX = jsfx
  366. def stop(self):
  367. self.fContinueChecking = False
  368. def run(self):
  369. settingsDB = QSafeSettings("falkTX", "CarlaPlugins5")
  370. self.fContinueChecking = True
  371. self.fCurCount = 0
  372. # looking for plugins via external discovery
  373. pluginCount = 0
  374. if self.fCheckLADSPA: pluginCount += 1
  375. if self.fCheckDSSI: pluginCount += 1
  376. if self.fCheckVST2: pluginCount += 1
  377. if self.fCheckVST3: pluginCount += 1
  378. # Increase count by the number of externally discoverable plugin types
  379. if self.fCheckNative:
  380. self.fCurCount += pluginCount
  381. # Linux, MacOS and Windows are the only VST3 supported OSes
  382. if self.fCheckVST3 and not (LINUX or MACOS or WINDOWS):
  383. self.fCurCount -= 1
  384. if self.fCheckPosix32:
  385. self.fCurCount += pluginCount
  386. if self.fCheckVST3 and not (LINUX or MACOS):
  387. self.fCurCount -= 1
  388. if self.fCheckPosix64:
  389. self.fCurCount += pluginCount
  390. if self.fCheckVST3 and not (LINUX or MACOS):
  391. self.fCurCount -= 1
  392. if self.fCheckWin32:
  393. self.fCurCount += pluginCount
  394. if self.fCheckWin64:
  395. self.fCurCount += pluginCount
  396. # Special case for cached plugins, only "search" for native plugins (does not need tool)
  397. if self.fCheckLV2:
  398. if self.fCheckNative:
  399. self.fCurCount += 1
  400. else:
  401. self.fCheckLV2 = False
  402. if self.fCheckAU:
  403. if self.fCheckNative or self.fCheckPosix32:
  404. self.fCurCount += int(self.fCheckNative) + int(self.fCheckPosix32)
  405. else:
  406. self.fCheckAU = False
  407. if self.fCheckSFZ:
  408. if self.fCheckNative:
  409. self.fCurCount += 1
  410. else:
  411. self.fCheckSFZ = False
  412. # Special case for Sound Kits, only search native
  413. if self.fCheckNative and self.fToolNative:
  414. if self.fCheckSF2: self.fCurCount += 1
  415. else:
  416. self.fCheckSF2 = False
  417. if self.fCheckJSFX:
  418. if self.fCheckNative:
  419. self.fCurCount += 1
  420. else:
  421. self.fCheckJSFX = False
  422. if self.fCurCount == 0:
  423. return
  424. self.fCurPercentValue = 100.0 / self.fCurCount
  425. self.fLastCheckValue = 0.0
  426. del pluginCount
  427. if HAIKU:
  428. OS = "HAIKU"
  429. elif LINUX:
  430. OS = "LINUX"
  431. elif MACOS:
  432. OS = "MACOS"
  433. elif WINDOWS:
  434. OS = "WINDOWS"
  435. else:
  436. OS = "UNKNOWN"
  437. if not self.fContinueChecking: return
  438. self.fSomethingChanged = True
  439. if self.fCheckLADSPA:
  440. checkValue = 0.0
  441. if haveLRDF:
  442. if self.fCheckNative: checkValue += 0.1
  443. if self.fCheckPosix32: checkValue += 0.1
  444. if self.fCheckPosix64: checkValue += 0.1
  445. if self.fCheckWin32: checkValue += 0.1
  446. if self.fCheckWin64: checkValue += 0.1
  447. rdfPadValue = self.fCurPercentValue * checkValue
  448. if self.fCheckNative:
  449. plugins = self._checkLADSPA(OS, self.fToolNative)
  450. settingsDB.setValue("Plugins/LADSPA_native", plugins)
  451. if not self.fContinueChecking: return
  452. if self.fCheckPosix32:
  453. plugins = self._checkLADSPA(OS, os.path.join(self.fPathBinaries, "carla-discovery-posix32"))
  454. settingsDB.setValue("Plugins/LADSPA_posix32", plugins)
  455. if not self.fContinueChecking: return
  456. if self.fCheckPosix64:
  457. plugins = self._checkLADSPA(OS, os.path.join(self.fPathBinaries, "carla-discovery-posix64"))
  458. settingsDB.setValue("Plugins/LADSPA_posix64", plugins)
  459. if not self.fContinueChecking: return
  460. if self.fCheckWin32:
  461. plugins = self._checkLADSPA("WINDOWS", os.path.join(self.fPathBinaries, "carla-discovery-win32.exe"), not WINDOWS)
  462. settingsDB.setValue("Plugins/LADSPA_win32", plugins)
  463. if not self.fContinueChecking: return
  464. if self.fCheckWin64:
  465. plugins = self._checkLADSPA("WINDOWS", os.path.join(self.fPathBinaries, "carla-discovery-win64.exe"), not WINDOWS)
  466. settingsDB.setValue("Plugins/LADSPA_win64", plugins)
  467. settingsDB.sync()
  468. if not self.fContinueChecking: return
  469. if haveLRDF and checkValue > 0:
  470. startValue = self.fLastCheckValue - rdfPadValue
  471. self._pluginLook(startValue, "LADSPA RDFs...")
  472. try:
  473. ladspaRdfInfo = ladspa_rdf.recheck_all_plugins(self, startValue, self.fCurPercentValue, checkValue)
  474. except:
  475. ladspaRdfInfo = None
  476. if ladspaRdfInfo is not None:
  477. settingsDir = os.path.join(HOME, ".config", "falkTX")
  478. fdLadspa = open(os.path.join(settingsDir, "ladspa_rdf.db"), 'w')
  479. json.dump(ladspaRdfInfo, fdLadspa)
  480. fdLadspa.close()
  481. if not self.fContinueChecking: return
  482. if self.fCheckDSSI:
  483. if self.fCheckNative:
  484. plugins = self._checkDSSI(OS, self.fToolNative)
  485. settingsDB.setValue("Plugins/DSSI_native", plugins)
  486. if not self.fContinueChecking: return
  487. if self.fCheckPosix32:
  488. plugins = self._checkDSSI(OS, os.path.join(self.fPathBinaries, "carla-discovery-posix32"))
  489. settingsDB.setValue("Plugins/DSSI_posix32", plugins)
  490. if not self.fContinueChecking: return
  491. if self.fCheckPosix64:
  492. plugins = self._checkDSSI(OS, os.path.join(self.fPathBinaries, "carla-discovery-posix64"))
  493. settingsDB.setValue("Plugins/DSSI_posix64", plugins)
  494. if not self.fContinueChecking: return
  495. if self.fCheckWin32:
  496. plugins = self._checkDSSI("WINDOWS", os.path.join(self.fPathBinaries, "carla-discovery-win32.exe"), not WINDOWS)
  497. settingsDB.setValue("Plugins/DSSI_win32", plugins)
  498. if not self.fContinueChecking: return
  499. if self.fCheckWin64:
  500. plugins = self._checkDSSI("WINDOWS", os.path.join(self.fPathBinaries, "carla-discovery-win64.exe"), not WINDOWS)
  501. settingsDB.setValue("Plugins/DSSI_win64", plugins)
  502. settingsDB.sync()
  503. if not self.fContinueChecking: return
  504. if self.fCheckLV2:
  505. plugins = self._checkCached(True)
  506. settingsDB.setValue("Plugins/LV2", plugins)
  507. settingsDB.sync()
  508. if not self.fContinueChecking: return
  509. if self.fCheckVST2:
  510. if self.fCheckNative:
  511. plugins = self._checkVST2(OS, self.fToolNative)
  512. settingsDB.setValue("Plugins/VST2_native", plugins)
  513. if not self.fContinueChecking: return
  514. if self.fCheckPosix32:
  515. plugins = self._checkVST2(OS, os.path.join(self.fPathBinaries, "carla-discovery-posix32"))
  516. settingsDB.setValue("Plugins/VST2_posix32", plugins)
  517. if not self.fContinueChecking: return
  518. if self.fCheckPosix64:
  519. plugins = self._checkVST2(OS, os.path.join(self.fPathBinaries, "carla-discovery-posix64"))
  520. settingsDB.setValue("Plugins/VST2_posix64", plugins)
  521. if not self.fContinueChecking: return
  522. if self.fCheckWin32:
  523. plugins = self._checkVST2("WINDOWS", os.path.join(self.fPathBinaries, "carla-discovery-win32.exe"), not WINDOWS)
  524. settingsDB.setValue("Plugins/VST2_win32", plugins)
  525. if not self.fContinueChecking: return
  526. if self.fCheckWin64:
  527. plugins = self._checkVST2("WINDOWS", os.path.join(self.fPathBinaries, "carla-discovery-win64.exe"), not WINDOWS)
  528. settingsDB.setValue("Plugins/VST2_win64", plugins)
  529. if not self.fContinueChecking: return
  530. settingsDB.sync()
  531. if not self.fContinueChecking: return
  532. if self.fCheckVST3:
  533. if self.fCheckNative and (LINUX or MACOS or WINDOWS):
  534. plugins = self._checkVST3(OS, self.fToolNative)
  535. settingsDB.setValue("Plugins/VST3_native", plugins)
  536. if not self.fContinueChecking: return
  537. if self.fCheckPosix32:
  538. plugins = self._checkVST3(OS, os.path.join(self.fPathBinaries, "carla-discovery-posix32"))
  539. settingsDB.setValue("Plugins/VST3_posix32", plugins)
  540. if not self.fContinueChecking: return
  541. if self.fCheckPosix64:
  542. plugins = self._checkVST3(OS, os.path.join(self.fPathBinaries, "carla-discovery-posix64"))
  543. settingsDB.setValue("Plugins/VST3_posix64", plugins)
  544. if not self.fContinueChecking: return
  545. if self.fCheckWin32:
  546. plugins = self._checkVST3("WINDOWS", os.path.join(self.fPathBinaries, "carla-discovery-win32.exe"), not WINDOWS)
  547. settingsDB.setValue("Plugins/VST3_win32", plugins)
  548. if not self.fContinueChecking: return
  549. if self.fCheckWin64:
  550. plugins = self._checkVST3("WINDOWS", os.path.join(self.fPathBinaries, "carla-discovery-win64.exe"), not WINDOWS)
  551. settingsDB.setValue("Plugins/VST3_win64", plugins)
  552. if not self.fContinueChecking: return
  553. settingsDB.sync()
  554. if not self.fContinueChecking: return
  555. if self.fCheckAU:
  556. if self.fCheckNative:
  557. plugins = self._checkCached(False)
  558. settingsDB.setValue("Plugins/AU", plugins)
  559. settingsDB.sync()
  560. if not self.fContinueChecking: return
  561. if self.fCheckPosix32:
  562. plugins = self._checkAU(os.path.join(self.fPathBinaries, "carla-discovery-posix32"))
  563. settingsDB.setValue("Plugins/AU_posix32", self.fAuPlugins)
  564. if not self.fContinueChecking: return
  565. settingsDB.sync()
  566. if not self.fContinueChecking: return
  567. if self.fCheckSF2:
  568. settings = QSafeSettings("falkTX", "Carla2")
  569. SF2_PATH = settings.value(CARLA_KEY_PATHS_SF2, CARLA_DEFAULT_SF2_PATH, list)
  570. del settings
  571. kits = self._checkKIT(SF2_PATH, "sf2")
  572. settingsDB.setValue("Plugins/SF2", kits)
  573. settingsDB.sync()
  574. if not self.fContinueChecking: return
  575. if self.fCheckSFZ:
  576. kits = self._checkSfzCached()
  577. settingsDB.setValue("Plugins/SFZ", kits)
  578. settingsDB.sync()
  579. if self.fCheckJSFX:
  580. kits = self._checkJsfxCached()
  581. settingsDB.setValue("Plugins/JSFX", kits)
  582. settingsDB.sync()
  583. def _checkLADSPA(self, OS, tool, isWine=False):
  584. ladspaBinaries = []
  585. ladspaPlugins = []
  586. self._pluginLook(self.fLastCheckValue, "LADSPA plugins...")
  587. settings = QSafeSettings("falkTX", "Carla2")
  588. LADSPA_PATH = settings.value(CARLA_KEY_PATHS_LADSPA, CARLA_DEFAULT_LADSPA_PATH, list)
  589. del settings
  590. for iPATH in LADSPA_PATH:
  591. binaries = findBinaries(iPATH, PLUGIN_LADSPA, OS)
  592. for binary in binaries:
  593. if binary not in ladspaBinaries:
  594. ladspaBinaries.append(binary)
  595. ladspaBinaries.sort()
  596. if not self.fContinueChecking:
  597. return ladspaPlugins
  598. for i in range(len(ladspaBinaries)):
  599. ladspa = ladspaBinaries[i]
  600. percent = ( float(i) / len(ladspaBinaries) ) * self.fCurPercentValue
  601. self._pluginLook((self.fLastCheckValue + percent) * 0.9, ladspa)
  602. plugins = checkPluginLADSPA(ladspa, tool, self.fWineSettings if isWine else None)
  603. if plugins:
  604. ladspaPlugins.append(plugins)
  605. if not self.fContinueChecking:
  606. break
  607. self.fLastCheckValue += self.fCurPercentValue
  608. return ladspaPlugins
  609. def _checkDSSI(self, OS, tool, isWine=False):
  610. dssiBinaries = []
  611. dssiPlugins = []
  612. self._pluginLook(self.fLastCheckValue, "DSSI plugins...")
  613. settings = QSafeSettings("falkTX", "Carla2")
  614. DSSI_PATH = settings.value(CARLA_KEY_PATHS_DSSI, CARLA_DEFAULT_DSSI_PATH, list)
  615. del settings
  616. for iPATH in DSSI_PATH:
  617. binaries = findBinaries(iPATH, PLUGIN_DSSI, OS)
  618. for binary in binaries:
  619. if binary not in dssiBinaries:
  620. dssiBinaries.append(binary)
  621. dssiBinaries.sort()
  622. if not self.fContinueChecking:
  623. return dssiPlugins
  624. for i in range(len(dssiBinaries)):
  625. dssi = dssiBinaries[i]
  626. percent = ( float(i) / len(dssiBinaries) ) * self.fCurPercentValue
  627. self._pluginLook(self.fLastCheckValue + percent, dssi)
  628. plugins = checkPluginDSSI(dssi, tool, self.fWineSettings if isWine else None)
  629. if plugins:
  630. dssiPlugins.append(plugins)
  631. if not self.fContinueChecking:
  632. break
  633. self.fLastCheckValue += self.fCurPercentValue
  634. return dssiPlugins
  635. def _checkVST2(self, OS, tool, isWine=False):
  636. vst2Binaries = []
  637. vst2Plugins = []
  638. if MACOS and not isWine:
  639. self._pluginLook(self.fLastCheckValue, "VST2 bundles...")
  640. else:
  641. self._pluginLook(self.fLastCheckValue, "VST2 plugins...")
  642. settings = QSafeSettings("falkTX", "Carla2")
  643. VST2_PATH = settings.value(CARLA_KEY_PATHS_VST2, CARLA_DEFAULT_VST2_PATH, list)
  644. del settings
  645. for iPATH in VST2_PATH:
  646. if MACOS and not isWine:
  647. binaries = findMacVSTBundles(iPATH, False)
  648. else:
  649. binaries = findBinaries(iPATH, PLUGIN_VST2, OS)
  650. for binary in binaries:
  651. if binary not in vst2Binaries:
  652. vst2Binaries.append(binary)
  653. vst2Binaries.sort()
  654. if not self.fContinueChecking:
  655. return vst2Plugins
  656. for i in range(len(vst2Binaries)):
  657. vst2 = vst2Binaries[i]
  658. percent = ( float(i) / len(vst2Binaries) ) * self.fCurPercentValue
  659. self._pluginLook(self.fLastCheckValue + percent, vst2)
  660. plugins = checkPluginVST2(vst2, tool, self.fWineSettings if isWine else None)
  661. if plugins:
  662. vst2Plugins.append(plugins)
  663. if not self.fContinueChecking:
  664. break
  665. self.fLastCheckValue += self.fCurPercentValue
  666. return vst2Plugins
  667. def _checkVST3(self, OS, tool, isWine=False):
  668. vst3Binaries = []
  669. vst3Plugins = []
  670. if MACOS and not isWine:
  671. self._pluginLook(self.fLastCheckValue, "VST2 bundles...")
  672. else:
  673. self._pluginLook(self.fLastCheckValue, "VST2 plugins...")
  674. settings = QSafeSettings("falkTX", "Carla2")
  675. VST3_PATH = settings.value(CARLA_KEY_PATHS_VST3, CARLA_DEFAULT_VST3_PATH, list)
  676. del settings
  677. for iPATH in VST3_PATH:
  678. if MACOS and not isWine:
  679. binaries = findMacVSTBundles(iPATH, True)
  680. else:
  681. binaries = findVST3Binaries(iPATH)
  682. for binary in binaries:
  683. if binary not in vst3Binaries:
  684. vst3Binaries.append(binary)
  685. vst3Binaries.sort()
  686. if not self.fContinueChecking:
  687. return vst3Plugins
  688. for i in range(len(vst3Binaries)):
  689. vst3 = vst3Binaries[i]
  690. percent = ( float(i) / len(vst3Binaries) ) * self.fCurPercentValue
  691. self._pluginLook(self.fLastCheckValue + percent, vst3)
  692. plugins = checkPluginVST3(vst3, tool, self.fWineSettings if isWine else None)
  693. if plugins:
  694. vst3Plugins.append(plugins)
  695. if not self.fContinueChecking:
  696. break
  697. self.fLastCheckValue += self.fCurPercentValue
  698. return vst3Plugins
  699. def _checkAU(self, tool):
  700. auPlugins = []
  701. plugins = checkAllPluginsAU(tool)
  702. if plugins:
  703. auPlugins.append(plugins)
  704. self.fLastCheckValue += self.fCurPercentValue
  705. return auPlugins
  706. def _checkKIT(self, kitPATH, kitExtension):
  707. kitFiles = []
  708. kitPlugins = []
  709. for iPATH in kitPATH:
  710. files = findFilenames(iPATH, kitExtension)
  711. for file_ in files:
  712. if file_ not in kitFiles:
  713. kitFiles.append(file_)
  714. kitFiles.sort()
  715. if not self.fContinueChecking:
  716. return kitPlugins
  717. for i in range(len(kitFiles)):
  718. kit = kitFiles[i]
  719. percent = ( float(i) / len(kitFiles) ) * self.fCurPercentValue
  720. self._pluginLook(self.fLastCheckValue + percent, kit)
  721. if kitExtension == "sf2":
  722. plugins = checkFileSF2(kit, self.fToolNative)
  723. else:
  724. plugins = None
  725. if plugins:
  726. kitPlugins.append(plugins)
  727. if not self.fContinueChecking:
  728. break
  729. self.fLastCheckValue += self.fCurPercentValue
  730. return kitPlugins
  731. def _checkCached(self, isLV2):
  732. if isLV2:
  733. settings = QSafeSettings("falkTX", "Carla2")
  734. PLUG_PATH = splitter.join(settings.value(CARLA_KEY_PATHS_LV2, CARLA_DEFAULT_LV2_PATH, list))
  735. del settings
  736. PLUG_TEXT = "LV2"
  737. PLUG_TYPE = PLUGIN_LV2
  738. else: # AU
  739. PLUG_PATH = ""
  740. PLUG_TEXT = "AU"
  741. PLUG_TYPE = PLUGIN_AU
  742. plugins = []
  743. self._pluginLook(self.fLastCheckValue, "{} plugins...".format(PLUG_TEXT))
  744. if not isLV2:
  745. gCarla.utils.juce_init()
  746. count = gCarla.utils.get_cached_plugin_count(PLUG_TYPE, PLUG_PATH)
  747. if not self.fContinueChecking:
  748. return plugins
  749. for i in range(count):
  750. descInfo = gCarla.utils.get_cached_plugin_info(PLUG_TYPE, i)
  751. percent = ( float(i) / count ) * self.fCurPercentValue
  752. self._pluginLook(self.fLastCheckValue + percent, descInfo['label'])
  753. if not descInfo['valid']:
  754. continue
  755. plugins.append(checkPluginCached(descInfo, PLUG_TYPE))
  756. if not self.fContinueChecking:
  757. break
  758. if not isLV2:
  759. gCarla.utils.juce_cleanup()
  760. self.fLastCheckValue += self.fCurPercentValue
  761. return plugins
  762. def _checkSfzCached(self):
  763. settings = QSafeSettings("falkTX", "Carla2")
  764. PLUG_PATH = splitter.join(settings.value(CARLA_KEY_PATHS_SFZ, CARLA_DEFAULT_SFZ_PATH, list))
  765. del settings
  766. sfzKits = []
  767. self._pluginLook(self.fLastCheckValue, "SFZ kits...")
  768. count = gCarla.utils.get_cached_plugin_count(PLUGIN_SFZ, PLUG_PATH)
  769. if not self.fContinueChecking:
  770. return sfzKits
  771. for i in range(count):
  772. descInfo = gCarla.utils.get_cached_plugin_info(PLUGIN_SFZ, i)
  773. percent = ( float(i) / count ) * self.fCurPercentValue
  774. self._pluginLook(self.fLastCheckValue + percent, descInfo['label'])
  775. if not descInfo['valid']:
  776. continue
  777. sfzKits.append(checkPluginCached(descInfo, PLUGIN_SFZ))
  778. if not self.fContinueChecking:
  779. break
  780. self.fLastCheckValue += self.fCurPercentValue
  781. return sfzKits
  782. def _checkJsfxCached(self):
  783. settings = QSafeSettings("falkTX", "Carla2")
  784. PLUG_PATH = splitter.join(settings.value(CARLA_KEY_PATHS_JSFX, CARLA_DEFAULT_JSFX_PATH, list))
  785. del settings
  786. jsfxPlugins = []
  787. self._pluginLook(self.fLastCheckValue, "JSFX plugins...")
  788. count = gCarla.utils.get_cached_plugin_count(PLUGIN_JSFX, PLUG_PATH)
  789. if not self.fContinueChecking:
  790. return jsfxPlugins
  791. for i in range(count):
  792. descInfo = gCarla.utils.get_cached_plugin_info(PLUGIN_JSFX, i)
  793. percent = ( float(i) / count ) * self.fCurPercentValue
  794. self._pluginLook(self.fLastCheckValue + percent, descInfo['label'])
  795. if not descInfo['valid']:
  796. continue
  797. jsfxPlugins.append(checkPluginCached(descInfo, PLUGIN_JSFX))
  798. if not self.fContinueChecking:
  799. break
  800. self.fLastCheckValue += self.fCurPercentValue
  801. return jsfxPlugins
  802. def _pluginLook(self, percent, plugin):
  803. self.pluginLook.emit(percent, plugin)
  804. # ---------------------------------------------------------------------------------------------------------------------
  805. # Plugin Refresh Dialog
  806. class PluginRefreshW(QDialog):
  807. def __init__(self, parent, host, useSystemIcons):
  808. QDialog.__init__(self, parent)
  809. self.host = host
  810. self.ui = ui_carla_refresh.Ui_PluginRefreshW()
  811. self.ui.setupUi(self)
  812. # -------------------------------------------------------------------------------------------------------------
  813. # Internal stuff
  814. toolNative = "carla-discovery-native.exe" if WINDOWS else "carla-discovery-native"
  815. hasNative = os.path.exists(os.path.join(self.host.pathBinaries, toolNative))
  816. hasPosix32 = os.path.exists(os.path.join(self.host.pathBinaries, "carla-discovery-posix32"))
  817. hasPosix64 = os.path.exists(os.path.join(self.host.pathBinaries, "carla-discovery-posix64"))
  818. hasWin32 = os.path.exists(os.path.join(self.host.pathBinaries, "carla-discovery-win32.exe"))
  819. hasWin64 = os.path.exists(os.path.join(self.host.pathBinaries, "carla-discovery-win64.exe"))
  820. self.fThread = SearchPluginsThread(self, host.pathBinaries)
  821. # -------------------------------------------------------------------------------------------------------------
  822. # Set-up Icons
  823. if useSystemIcons:
  824. self.ui.b_start.setIcon(getIcon('arrow-right', 16, 'svgz'))
  825. self.ui.b_close.setIcon(getIcon('window-close', 16, 'svgz'))
  826. if QT_VERSION >= 0x50600:
  827. size = int(16 * self.devicePixelRatioF())
  828. else:
  829. size = 16
  830. self.fIconYes = QPixmap(getIcon('dialog-ok-apply', 16, 'svgz').pixmap(size))
  831. self.fIconNo = QPixmap(getIcon('dialog-error', 16, 'svgz').pixmap(size))
  832. else:
  833. self.fIconYes = QPixmap(":/16x16/dialog-ok-apply.svgz")
  834. self.fIconNo = QPixmap(":/16x16/dialog-error.svgz")
  835. # -------------------------------------------------------------------------------------------------------------
  836. # Set-up GUI
  837. self.ui.b_skip.setVisible(False)
  838. if HAIKU:
  839. self.ui.ch_posix32.setText("Haiku 32bit")
  840. self.ui.ch_posix64.setText("Haiku 64bit")
  841. elif LINUX:
  842. self.ui.ch_posix32.setText("Linux 32bit")
  843. self.ui.ch_posix64.setText("Linux 64bit")
  844. elif MACOS:
  845. self.ui.ch_posix32.setText("MacOS 32bit")
  846. self.ui.ch_posix64.setText("MacOS 64bit")
  847. if hasPosix32 and not WINDOWS:
  848. self.ui.ico_posix32.setPixmap(self.fIconYes)
  849. else:
  850. self.ui.ico_posix32.setPixmap(self.fIconNo)
  851. self.ui.ch_posix32.setEnabled(False)
  852. if hasPosix64 and not WINDOWS:
  853. self.ui.ico_posix64.setPixmap(self.fIconYes)
  854. else:
  855. self.ui.ico_posix64.setPixmap(self.fIconNo)
  856. self.ui.ch_posix64.setEnabled(False)
  857. if hasWin32:
  858. self.ui.ico_win32.setPixmap(self.fIconYes)
  859. else:
  860. self.ui.ico_win32.setPixmap(self.fIconNo)
  861. self.ui.ch_win32.setEnabled(False)
  862. if hasWin64:
  863. self.ui.ico_win64.setPixmap(self.fIconYes)
  864. else:
  865. self.ui.ico_win64.setPixmap(self.fIconNo)
  866. self.ui.ch_win64.setEnabled(False)
  867. if haveLRDF:
  868. self.ui.ico_rdflib.setPixmap(self.fIconYes)
  869. else:
  870. self.ui.ico_rdflib.setPixmap(self.fIconNo)
  871. if WINDOWS:
  872. if kIs64bit:
  873. hasNonNative = hasWin32
  874. self.ui.ch_win64.setEnabled(False)
  875. self.ui.ch_win64.setVisible(False)
  876. self.ui.ico_win64.setVisible(False)
  877. self.ui.label_win64.setVisible(False)
  878. else:
  879. hasNonNative = hasWin64
  880. self.ui.ch_win32.setEnabled(False)
  881. self.ui.ch_win32.setVisible(False)
  882. self.ui.ico_win32.setVisible(False)
  883. self.ui.label_win32.setVisible(False)
  884. self.ui.ch_posix32.setEnabled(False)
  885. self.ui.ch_posix32.setVisible(False)
  886. self.ui.ch_posix64.setEnabled(False)
  887. self.ui.ch_posix64.setVisible(False)
  888. self.ui.ico_posix32.hide()
  889. self.ui.ico_posix64.hide()
  890. self.ui.label_posix32.hide()
  891. self.ui.label_posix64.hide()
  892. self.ui.ico_rdflib.hide()
  893. self.ui.label_rdflib.hide()
  894. else:
  895. if kIs64bit:
  896. hasNonNative = bool(hasPosix32 or hasWin32 or hasWin64)
  897. self.ui.ch_posix64.setEnabled(False)
  898. self.ui.ch_posix64.setVisible(False)
  899. self.ui.ico_posix64.setVisible(False)
  900. self.ui.label_posix64.setVisible(False)
  901. else:
  902. hasNonNative = bool(hasPosix64 or hasWin32 or hasWin64)
  903. self.ui.ch_posix32.setEnabled(False)
  904. self.ui.ch_posix32.setVisible(False)
  905. self.ui.ico_posix32.setVisible(False)
  906. self.ui.label_posix32.setVisible(False)
  907. if not (LINUX or hasWin32 or hasWin64):
  908. self.ui.ch_vst3.setEnabled(False)
  909. self.ui.ch_vst3.setVisible(False)
  910. if MACOS:
  911. self.setWindowModality(Qt.WindowModal)
  912. else:
  913. self.ui.ch_au.setEnabled(False)
  914. self.ui.ch_au.setVisible(False)
  915. if hasNative:
  916. self.ui.ico_native.setPixmap(self.fIconYes)
  917. else:
  918. self.ui.ico_native.setPixmap(self.fIconNo)
  919. self.ui.ch_native.setEnabled(False)
  920. self.ui.ch_sf2.setEnabled(False)
  921. if not hasNonNative:
  922. self.ui.ch_ladspa.setEnabled(False)
  923. self.ui.ch_dssi.setEnabled(False)
  924. self.ui.ch_vst.setEnabled(False)
  925. self.ui.ch_vst3.setEnabled(False)
  926. self.setWindowFlags(self.windowFlags() & ~Qt.WindowContextHelpButtonHint)
  927. # -------------------------------------------------------------------------------------------------------------
  928. # Load settings
  929. self.loadSettings()
  930. # -------------------------------------------------------------------------------------------------------------
  931. # Hide bridges if disabled
  932. # NOTE: We Assume win32 carla build will not run win64 plugins
  933. if (WINDOWS and not kIs64bit) or not host.showPluginBridges:
  934. self.ui.ch_native.setChecked(True)
  935. self.ui.ch_native.setEnabled(False)
  936. self.ui.ch_native.setVisible(False)
  937. self.ui.ch_posix32.setChecked(False)
  938. self.ui.ch_posix32.setEnabled(False)
  939. self.ui.ch_posix32.setVisible(False)
  940. self.ui.ch_posix64.setChecked(False)
  941. self.ui.ch_posix64.setEnabled(False)
  942. self.ui.ch_posix64.setVisible(False)
  943. self.ui.ch_win32.setChecked(False)
  944. self.ui.ch_win32.setEnabled(False)
  945. self.ui.ch_win32.setVisible(False)
  946. self.ui.ch_win64.setChecked(False)
  947. self.ui.ch_win64.setEnabled(False)
  948. self.ui.ch_win64.setVisible(False)
  949. self.ui.ico_posix32.hide()
  950. self.ui.ico_posix64.hide()
  951. self.ui.ico_win32.hide()
  952. self.ui.ico_win64.hide()
  953. self.ui.label_posix32.hide()
  954. self.ui.label_posix64.hide()
  955. self.ui.label_win32.hide()
  956. self.ui.label_win64.hide()
  957. self.ui.sep_format.hide()
  958. elif not (WINDOWS or host.showWineBridges):
  959. self.ui.ch_win32.setChecked(False)
  960. self.ui.ch_win32.setEnabled(False)
  961. self.ui.ch_win32.setVisible(False)
  962. self.ui.ch_win64.setChecked(False)
  963. self.ui.ch_win64.setEnabled(False)
  964. self.ui.ch_win64.setVisible(False)
  965. self.ui.ico_win32.hide()
  966. self.ui.ico_win64.hide()
  967. self.ui.label_win32.hide()
  968. self.ui.label_win64.hide()
  969. # Disable non-supported features
  970. features = gCarla.utils.get_supported_features()
  971. if "sf2" not in features:
  972. self.ui.ch_sf2.setChecked(False)
  973. self.ui.ch_sf2.setEnabled(False)
  974. if MACOS and "juce" not in features:
  975. self.ui.ch_au.setChecked(False)
  976. self.ui.ch_au.setEnabled(False)
  977. # -------------------------------------------------------------------------------------------------------------
  978. # Resize to minimum size, as it's very likely UI stuff was hidden
  979. self.resize(self.minimumSize())
  980. # -------------------------------------------------------------------------------------------------------------
  981. # Set-up connections
  982. self.finished.connect(self.slot_saveSettings)
  983. self.ui.b_start.clicked.connect(self.slot_start)
  984. self.ui.b_skip.clicked.connect(self.slot_skip)
  985. self.ui.ch_native.clicked.connect(self.slot_checkTools)
  986. self.ui.ch_posix32.clicked.connect(self.slot_checkTools)
  987. self.ui.ch_posix64.clicked.connect(self.slot_checkTools)
  988. self.ui.ch_win32.clicked.connect(self.slot_checkTools)
  989. self.ui.ch_win64.clicked.connect(self.slot_checkTools)
  990. self.ui.ch_ladspa.clicked.connect(self.slot_checkTools)
  991. self.ui.ch_dssi.clicked.connect(self.slot_checkTools)
  992. self.ui.ch_lv2.clicked.connect(self.slot_checkTools)
  993. self.ui.ch_vst.clicked.connect(self.slot_checkTools)
  994. self.ui.ch_vst3.clicked.connect(self.slot_checkTools)
  995. self.ui.ch_au.clicked.connect(self.slot_checkTools)
  996. self.ui.ch_sf2.clicked.connect(self.slot_checkTools)
  997. self.ui.ch_sfz.clicked.connect(self.slot_checkTools)
  998. self.ui.ch_jsfx.clicked.connect(self.slot_checkTools)
  999. self.fThread.pluginLook.connect(self.slot_handlePluginLook)
  1000. self.fThread.finished.connect(self.slot_handlePluginThreadFinished)
  1001. # -------------------------------------------------------------------------------------------------------------
  1002. # Post-connect setup
  1003. self.slot_checkTools()
  1004. # -----------------------------------------------------------------------------------------------------------------
  1005. def loadSettings(self):
  1006. settings = QSafeSettings("falkTX", "CarlaRefresh2")
  1007. check = settings.value("PluginDatabase/SearchLADSPA", True, bool) and self.ui.ch_ladspa.isEnabled()
  1008. self.ui.ch_ladspa.setChecked(check)
  1009. check = settings.value("PluginDatabase/SearchDSSI", True, bool) and self.ui.ch_dssi.isEnabled()
  1010. self.ui.ch_dssi.setChecked(check)
  1011. check = settings.value("PluginDatabase/SearchLV2", True, bool) and self.ui.ch_lv2.isEnabled()
  1012. self.ui.ch_lv2.setChecked(check)
  1013. check = settings.value("PluginDatabase/SearchVST2", True, bool) and self.ui.ch_vst.isEnabled()
  1014. self.ui.ch_vst.setChecked(check)
  1015. check = settings.value("PluginDatabase/SearchVST3", True, bool) and self.ui.ch_vst3.isEnabled()
  1016. self.ui.ch_vst3.setChecked(check)
  1017. if MACOS:
  1018. check = settings.value("PluginDatabase/SearchAU", True, bool) and self.ui.ch_au.isEnabled()
  1019. else:
  1020. check = False
  1021. self.ui.ch_au.setChecked(check)
  1022. check = settings.value("PluginDatabase/SearchSF2", False, bool) and self.ui.ch_sf2.isEnabled()
  1023. self.ui.ch_sf2.setChecked(check)
  1024. check = settings.value("PluginDatabase/SearchSFZ", False, bool) and self.ui.ch_sfz.isEnabled()
  1025. self.ui.ch_sfz.setChecked(check)
  1026. check = settings.value("PluginDatabase/SearchJSFX", True, bool) and self.ui.ch_jsfx.isEnabled()
  1027. self.ui.ch_jsfx.setChecked(check)
  1028. check = settings.value("PluginDatabase/SearchNative", True, bool) and self.ui.ch_native.isEnabled()
  1029. self.ui.ch_native.setChecked(check)
  1030. check = settings.value("PluginDatabase/SearchPOSIX32", False, bool) and self.ui.ch_posix32.isEnabled()
  1031. self.ui.ch_posix32.setChecked(check)
  1032. check = settings.value("PluginDatabase/SearchPOSIX64", False, bool) and self.ui.ch_posix64.isEnabled()
  1033. self.ui.ch_posix64.setChecked(check)
  1034. check = settings.value("PluginDatabase/SearchWin32", False, bool) and self.ui.ch_win32.isEnabled()
  1035. self.ui.ch_win32.setChecked(check)
  1036. check = settings.value("PluginDatabase/SearchWin64", False, bool) and self.ui.ch_win64.isEnabled()
  1037. self.ui.ch_win64.setChecked(check)
  1038. self.ui.ch_do_checks.setChecked(settings.value("PluginDatabase/DoChecks", False, bool))
  1039. # -----------------------------------------------------------------------------------------------------------------
  1040. @pyqtSlot()
  1041. def slot_saveSettings(self):
  1042. settings = QSafeSettings("falkTX", "CarlaRefresh2")
  1043. settings.setValue("PluginDatabase/SearchLADSPA", self.ui.ch_ladspa.isChecked())
  1044. settings.setValue("PluginDatabase/SearchDSSI", self.ui.ch_dssi.isChecked())
  1045. settings.setValue("PluginDatabase/SearchLV2", self.ui.ch_lv2.isChecked())
  1046. settings.setValue("PluginDatabase/SearchVST2", self.ui.ch_vst.isChecked())
  1047. settings.setValue("PluginDatabase/SearchVST3", self.ui.ch_vst3.isChecked())
  1048. settings.setValue("PluginDatabase/SearchAU", self.ui.ch_au.isChecked())
  1049. settings.setValue("PluginDatabase/SearchSF2", self.ui.ch_sf2.isChecked())
  1050. settings.setValue("PluginDatabase/SearchSFZ", self.ui.ch_sfz.isChecked())
  1051. settings.setValue("PluginDatabase/SearchJSFX", self.ui.ch_jsfx.isChecked())
  1052. settings.setValue("PluginDatabase/SearchNative", self.ui.ch_native.isChecked())
  1053. settings.setValue("PluginDatabase/SearchPOSIX32", self.ui.ch_posix32.isChecked())
  1054. settings.setValue("PluginDatabase/SearchPOSIX64", self.ui.ch_posix64.isChecked())
  1055. settings.setValue("PluginDatabase/SearchWin32", self.ui.ch_win32.isChecked())
  1056. settings.setValue("PluginDatabase/SearchWin64", self.ui.ch_win64.isChecked())
  1057. settings.setValue("PluginDatabase/DoChecks", self.ui.ch_do_checks.isChecked())
  1058. # -----------------------------------------------------------------------------------------------------------------
  1059. @pyqtSlot()
  1060. def slot_start(self):
  1061. self.ui.progressBar.setMinimum(0)
  1062. self.ui.progressBar.setMaximum(100)
  1063. self.ui.progressBar.setValue(0)
  1064. self.ui.b_start.setEnabled(False)
  1065. self.ui.b_skip.setVisible(True)
  1066. self.ui.b_close.setVisible(False)
  1067. self.ui.group_types.setEnabled(False)
  1068. self.ui.group_options.setEnabled(False)
  1069. if self.ui.ch_do_checks.isChecked():
  1070. gCarla.utils.unsetenv("CARLA_DISCOVERY_NO_PROCESSING_CHECKS")
  1071. else:
  1072. gCarla.utils.setenv("CARLA_DISCOVERY_NO_PROCESSING_CHECKS", "true")
  1073. native, posix32, posix64, win32, win64 = (self.ui.ch_native.isChecked(),
  1074. self.ui.ch_posix32.isChecked(), self.ui.ch_posix64.isChecked(),
  1075. self.ui.ch_win32.isChecked(), self.ui.ch_win64.isChecked())
  1076. ladspa, dssi, lv2, vst, vst3, au, sf2, sfz, jsfx = (self.ui.ch_ladspa.isChecked(), self.ui.ch_dssi.isChecked(),
  1077. self.ui.ch_lv2.isChecked(), self.ui.ch_vst.isChecked(),
  1078. self.ui.ch_vst3.isChecked(), self.ui.ch_au.isChecked(),
  1079. self.ui.ch_sf2.isChecked(), self.ui.ch_sfz.isChecked(),
  1080. self.ui.ch_jsfx.isChecked())
  1081. self.fThread.setSearchBinaryTypes(native, posix32, posix64, win32, win64)
  1082. self.fThread.setSearchPluginTypes(ladspa, dssi, lv2, vst, vst3, au, sf2, sfz, jsfx)
  1083. self.fThread.start()
  1084. # -----------------------------------------------------------------------------------------------------------------
  1085. @pyqtSlot()
  1086. def slot_skip(self):
  1087. killDiscovery()
  1088. # -----------------------------------------------------------------------------------------------------------------
  1089. @pyqtSlot()
  1090. def slot_checkTools(self):
  1091. enabled1 = bool(self.ui.ch_native.isChecked() or
  1092. self.ui.ch_posix32.isChecked() or self.ui.ch_posix64.isChecked() or
  1093. self.ui.ch_win32.isChecked() or self.ui.ch_win64.isChecked())
  1094. enabled2 = bool(self.ui.ch_ladspa.isChecked() or self.ui.ch_dssi.isChecked() or
  1095. self.ui.ch_lv2.isChecked() or self.ui.ch_vst.isChecked() or
  1096. self.ui.ch_vst3.isChecked() or self.ui.ch_au.isChecked() or
  1097. self.ui.ch_sf2.isChecked() or self.ui.ch_sfz.isChecked() or
  1098. self.ui.ch_jsfx.isChecked())
  1099. self.ui.b_start.setEnabled(enabled1 and enabled2)
  1100. # -----------------------------------------------------------------------------------------------------------------
  1101. @pyqtSlot(int, str)
  1102. def slot_handlePluginLook(self, percent, plugin):
  1103. self.ui.progressBar.setFormat("%s" % plugin)
  1104. self.ui.progressBar.setValue(percent)
  1105. # -----------------------------------------------------------------------------------------------------------------
  1106. @pyqtSlot()
  1107. def slot_handlePluginThreadFinished(self):
  1108. self.ui.progressBar.setMinimum(0)
  1109. self.ui.progressBar.setMaximum(1)
  1110. self.ui.progressBar.setValue(1)
  1111. self.ui.progressBar.setFormat(self.tr("Done"))
  1112. self.ui.b_start.setEnabled(True)
  1113. self.ui.b_skip.setVisible(False)
  1114. self.ui.b_close.setVisible(True)
  1115. self.ui.group_types.setEnabled(True)
  1116. self.ui.group_options.setEnabled(True)
  1117. # -----------------------------------------------------------------------------------------------------------------
  1118. def closeEvent(self, event):
  1119. if self.fThread.isRunning():
  1120. self.fThread.stop()
  1121. killDiscovery()
  1122. #self.fThread.terminate()
  1123. self.fThread.wait()
  1124. if self.fThread.hasSomethingChanged():
  1125. self.accept()
  1126. else:
  1127. self.reject()
  1128. QDialog.closeEvent(self, event)
  1129. # ---------------------------------------------------------------------------------------------------------------------
  1130. # Plugin Database Dialog
  1131. class PluginDatabaseW(QDialog):
  1132. TABLEWIDGET_ITEM_FAVORITE = 0
  1133. TABLEWIDGET_ITEM_NAME = 1
  1134. TABLEWIDGET_ITEM_LABEL = 2
  1135. TABLEWIDGET_ITEM_MAKER = 3
  1136. TABLEWIDGET_ITEM_BINARY = 4
  1137. def __init__(self, parent, host, useSystemIcons):
  1138. QDialog.__init__(self, parent)
  1139. self.host = host
  1140. self.ui = ui_carla_database.Ui_PluginDatabaseW()
  1141. self.ui.setupUi(self)
  1142. # ----------------------------------------------------------------------------------------------------
  1143. # Internal stuff
  1144. self.fLastTableIndex = 0
  1145. self.fRetPlugin = None
  1146. self.fRealParent = parent
  1147. self.fFavoritePlugins = []
  1148. self.fFavoritePluginsChanged = False
  1149. self.fUseSystemIcons = useSystemIcons
  1150. self.fTrYes = self.tr("Yes")
  1151. self.fTrNo = self.tr("No")
  1152. self.fTrNative = self.tr("Native")
  1153. # ----------------------------------------------------------------------------------------------------
  1154. # Set-up GUI
  1155. self.ui.b_add.setEnabled(False)
  1156. self.addAction(self.ui.act_focus_search)
  1157. self.ui.act_focus_search.triggered.connect(self.slot_focusSearchFieldAndSelectAll)
  1158. if BINARY_NATIVE in (BINARY_POSIX32, BINARY_WIN32):
  1159. self.ui.ch_bridged.setText(self.tr("Bridged (64bit)"))
  1160. else:
  1161. self.ui.ch_bridged.setText(self.tr("Bridged (32bit)"))
  1162. if not (LINUX or MACOS):
  1163. self.ui.ch_bridged_wine.setChecked(False)
  1164. self.ui.ch_bridged_wine.setEnabled(False)
  1165. if MACOS:
  1166. self.setWindowModality(Qt.WindowModal)
  1167. else:
  1168. self.ui.ch_au.setChecked(False)
  1169. self.ui.ch_au.setEnabled(False)
  1170. self.ui.ch_au.setVisible(False)
  1171. self.ui.tab_info.tabBar().hide()
  1172. self.ui.tab_reqs.tabBar().hide()
  1173. # FIXME, why /2 needed?
  1174. self.ui.tab_info.setMinimumWidth(int(self.ui.la_id.width()/2) +
  1175. fontMetricsHorizontalAdvance(self.ui.l_id.fontMetrics(), "9999999999") + 6*3)
  1176. self.setWindowFlags(self.windowFlags() & ~Qt.WindowContextHelpButtonHint)
  1177. # ----------------------------------------------------------------------------------------------------
  1178. # Load settings
  1179. self.loadSettings()
  1180. # ----------------------------------------------------------------------------------------------------
  1181. # Disable bridges if not enabled in settings
  1182. # NOTE: We Assume win32 carla build will not run win64 plugins
  1183. if (WINDOWS and not kIs64bit) or not host.showPluginBridges:
  1184. self.ui.ch_native.setChecked(True)
  1185. self.ui.ch_native.setEnabled(False)
  1186. self.ui.ch_native.setVisible(True)
  1187. self.ui.ch_bridged.setChecked(False)
  1188. self.ui.ch_bridged.setEnabled(False)
  1189. self.ui.ch_bridged.setVisible(False)
  1190. self.ui.ch_bridged_wine.setChecked(False)
  1191. self.ui.ch_bridged_wine.setEnabled(False)
  1192. self.ui.ch_bridged_wine.setVisible(False)
  1193. self.ui.l_arch.setVisible(False)
  1194. elif not host.showWineBridges:
  1195. self.ui.ch_bridged_wine.setChecked(False)
  1196. self.ui.ch_bridged_wine.setEnabled(False)
  1197. self.ui.ch_bridged_wine.setVisible(False)
  1198. # ----------------------------------------------------------------------------------------------------
  1199. # Set-up Icons
  1200. if useSystemIcons:
  1201. self.ui.b_add.setIcon(getIcon('list-add', 16, 'svgz'))
  1202. self.ui.b_cancel.setIcon(getIcon('dialog-cancel', 16, 'svgz'))
  1203. self.ui.b_clear_filters.setIcon(getIcon('edit-clear', 16, 'svgz'))
  1204. self.ui.b_refresh.setIcon(getIcon('view-refresh', 16, 'svgz'))
  1205. self.ui.tableWidget.horizontalHeaderItem(self.TABLEWIDGET_ITEM_FAVORITE).setIcon(getIcon('bookmarks', 16, 'svgz'))
  1206. # ----------------------------------------------------------------------------------------------------
  1207. # Set-up connections
  1208. self.finished.connect(self.slot_saveSettings)
  1209. self.ui.b_add.clicked.connect(self.slot_addPlugin)
  1210. self.ui.b_cancel.clicked.connect(self.reject)
  1211. self.ui.b_refresh.clicked.connect(self.slot_refreshPlugins)
  1212. self.ui.b_clear_filters.clicked.connect(self.slot_clearFilters)
  1213. self.ui.lineEdit.textChanged.connect(self.slot_checkFilters)
  1214. self.ui.tableWidget.currentCellChanged.connect(self.slot_checkPlugin)
  1215. self.ui.tableWidget.cellClicked.connect(self.slot_cellClicked)
  1216. self.ui.tableWidget.cellDoubleClicked.connect(self.slot_cellDoubleClicked)
  1217. self.ui.ch_internal.clicked.connect(self.slot_checkFilters)
  1218. self.ui.ch_ladspa.clicked.connect(self.slot_checkFilters)
  1219. self.ui.ch_dssi.clicked.connect(self.slot_checkFilters)
  1220. self.ui.ch_lv2.clicked.connect(self.slot_checkFilters)
  1221. self.ui.ch_vst.clicked.connect(self.slot_checkFilters)
  1222. self.ui.ch_vst3.clicked.connect(self.slot_checkFilters)
  1223. self.ui.ch_au.clicked.connect(self.slot_checkFilters)
  1224. self.ui.ch_jsfx.clicked.connect(self.slot_checkFilters)
  1225. self.ui.ch_kits.clicked.connect(self.slot_checkFilters)
  1226. self.ui.ch_effects.clicked.connect(self.slot_checkFilters)
  1227. self.ui.ch_instruments.clicked.connect(self.slot_checkFilters)
  1228. self.ui.ch_midi.clicked.connect(self.slot_checkFilters)
  1229. self.ui.ch_other.clicked.connect(self.slot_checkFilters)
  1230. self.ui.ch_native.clicked.connect(self.slot_checkFilters)
  1231. self.ui.ch_bridged.clicked.connect(self.slot_checkFilters)
  1232. self.ui.ch_bridged_wine.clicked.connect(self.slot_checkFilters)
  1233. self.ui.ch_favorites.clicked.connect(self.slot_checkFilters)
  1234. self.ui.ch_rtsafe.clicked.connect(self.slot_checkFilters)
  1235. self.ui.ch_cv.clicked.connect(self.slot_checkFilters)
  1236. self.ui.ch_gui.clicked.connect(self.slot_checkFilters)
  1237. self.ui.ch_inline_display.clicked.connect(self.slot_checkFilters)
  1238. self.ui.ch_stereo.clicked.connect(self.slot_checkFilters)
  1239. self.ui.ch_cat_all.clicked.connect(self.slot_checkFiltersCategoryAll)
  1240. self.ui.ch_cat_delay.clicked.connect(self.slot_checkFiltersCategorySpecific)
  1241. self.ui.ch_cat_distortion.clicked.connect(self.slot_checkFiltersCategorySpecific)
  1242. self.ui.ch_cat_dynamics.clicked.connect(self.slot_checkFiltersCategorySpecific)
  1243. self.ui.ch_cat_eq.clicked.connect(self.slot_checkFiltersCategorySpecific)
  1244. self.ui.ch_cat_filter.clicked.connect(self.slot_checkFiltersCategorySpecific)
  1245. self.ui.ch_cat_modulator.clicked.connect(self.slot_checkFiltersCategorySpecific)
  1246. self.ui.ch_cat_synth.clicked.connect(self.slot_checkFiltersCategorySpecific)
  1247. self.ui.ch_cat_utility.clicked.connect(self.slot_checkFiltersCategorySpecific)
  1248. self.ui.ch_cat_other.clicked.connect(self.slot_checkFiltersCategorySpecific)
  1249. # ----------------------------------------------------------------------------------------------------
  1250. # Post-connect setup
  1251. self._reAddPlugins()
  1252. self.slot_focusSearchFieldAndSelectAll()
  1253. # --------------------------------------------------------------------------------------------------------
  1254. @pyqtSlot(int, int)
  1255. def slot_cellClicked(self, row, column):
  1256. if column == self.TABLEWIDGET_ITEM_FAVORITE:
  1257. widget = self.ui.tableWidget.item(row, self.TABLEWIDGET_ITEM_FAVORITE)
  1258. plugin = self.ui.tableWidget.item(row, self.TABLEWIDGET_ITEM_NAME).data(Qt.UserRole+1)
  1259. plugin = self._createFavoritePluginDict(plugin)
  1260. if widget.checkState() == Qt.Checked:
  1261. if not plugin in self.fFavoritePlugins:
  1262. self.fFavoritePlugins.append(plugin)
  1263. self.fFavoritePluginsChanged = True
  1264. else:
  1265. try:
  1266. self.fFavoritePlugins.remove(plugin)
  1267. self.fFavoritePluginsChanged = True
  1268. except ValueError:
  1269. pass
  1270. @pyqtSlot(int, int)
  1271. def slot_cellDoubleClicked(self, row, column):
  1272. if column != self.TABLEWIDGET_ITEM_FAVORITE:
  1273. self.slot_addPlugin()
  1274. @pyqtSlot()
  1275. def slot_focusSearchFieldAndSelectAll(self):
  1276. self.ui.lineEdit.setFocus()
  1277. self.ui.lineEdit.selectAll()
  1278. @pyqtSlot()
  1279. def slot_addPlugin(self):
  1280. if self.ui.tableWidget.currentRow() >= 0:
  1281. self.fRetPlugin = self.ui.tableWidget.item(self.ui.tableWidget.currentRow(),
  1282. self.TABLEWIDGET_ITEM_NAME).data(Qt.UserRole+1)
  1283. self.accept()
  1284. else:
  1285. self.reject()
  1286. @pyqtSlot(int)
  1287. def slot_checkPlugin(self, row):
  1288. if row >= 0:
  1289. self.ui.b_add.setEnabled(True)
  1290. plugin = self.ui.tableWidget.item(self.ui.tableWidget.currentRow(),
  1291. self.TABLEWIDGET_ITEM_NAME).data(Qt.UserRole+1)
  1292. isSynth = bool(plugin['hints'] & PLUGIN_IS_SYNTH)
  1293. isEffect = bool(plugin['audio.ins'] > 0 < plugin['audio.outs'] and not isSynth)
  1294. isMidi = bool(plugin['audio.ins'] == 0 and plugin['audio.outs'] == 0 and plugin['midi.ins'] > 0 < plugin['midi.outs'])
  1295. isKit = bool(plugin['type'] in (PLUGIN_SF2, PLUGIN_SFZ))
  1296. isOther = bool(not (isEffect or isSynth or isMidi or isKit))
  1297. if isSynth:
  1298. ptype = "Instrument"
  1299. elif isEffect:
  1300. ptype = "Effect"
  1301. elif isMidi:
  1302. ptype = "MIDI Plugin"
  1303. else:
  1304. ptype = "Other"
  1305. if plugin['build'] == BINARY_NATIVE:
  1306. parch = self.fTrNative
  1307. elif plugin['build'] == BINARY_POSIX32:
  1308. parch = "posix32"
  1309. elif plugin['build'] == BINARY_POSIX64:
  1310. parch = "posix64"
  1311. elif plugin['build'] == BINARY_WIN32:
  1312. parch = "win32"
  1313. elif plugin['build'] == BINARY_WIN64:
  1314. parch = "win64"
  1315. elif plugin['build'] == BINARY_OTHER:
  1316. parch = self.tr("Other")
  1317. elif plugin['build'] == BINARY_WIN32:
  1318. parch = self.tr("Unknown")
  1319. self.ui.l_format.setText(getPluginTypeAsString(plugin['type']))
  1320. self.ui.l_type.setText(ptype)
  1321. self.ui.l_arch.setText(parch)
  1322. self.ui.l_id.setText(str(plugin['uniqueId']))
  1323. self.ui.l_ains.setText(str(plugin['audio.ins']))
  1324. self.ui.l_aouts.setText(str(plugin['audio.outs']))
  1325. self.ui.l_cvins.setText(str(plugin['cv.ins']))
  1326. self.ui.l_cvouts.setText(str(plugin['cv.outs']))
  1327. self.ui.l_mins.setText(str(plugin['midi.ins']))
  1328. self.ui.l_mouts.setText(str(plugin['midi.outs']))
  1329. self.ui.l_pins.setText(str(plugin['parameters.ins']))
  1330. self.ui.l_pouts.setText(str(plugin['parameters.outs']))
  1331. self.ui.l_gui.setText(self.fTrYes if plugin['hints'] & PLUGIN_HAS_CUSTOM_UI else self.fTrNo)
  1332. self.ui.l_idisp.setText(self.fTrYes if plugin['hints'] & PLUGIN_HAS_INLINE_DISPLAY else self.fTrNo)
  1333. self.ui.l_bridged.setText(self.fTrYes if plugin['hints'] & PLUGIN_IS_BRIDGE else self.fTrNo)
  1334. self.ui.l_synth.setText(self.fTrYes if isSynth else self.fTrNo)
  1335. else:
  1336. self.ui.b_add.setEnabled(False)
  1337. self.ui.l_format.setText("---")
  1338. self.ui.l_type.setText("---")
  1339. self.ui.l_arch.setText("---")
  1340. self.ui.l_id.setText("---")
  1341. self.ui.l_ains.setText("---")
  1342. self.ui.l_aouts.setText("---")
  1343. self.ui.l_cvins.setText("---")
  1344. self.ui.l_cvouts.setText("---")
  1345. self.ui.l_mins.setText("---")
  1346. self.ui.l_mouts.setText("---")
  1347. self.ui.l_pins.setText("---")
  1348. self.ui.l_pouts.setText("---")
  1349. self.ui.l_gui.setText("---")
  1350. self.ui.l_idisp.setText("---")
  1351. self.ui.l_bridged.setText("---")
  1352. self.ui.l_synth.setText("---")
  1353. @pyqtSlot()
  1354. def slot_checkFilters(self):
  1355. self._checkFilters()
  1356. @pyqtSlot(bool)
  1357. def slot_checkFiltersCategoryAll(self, clicked):
  1358. self.ui.ch_cat_delay.setChecked(not clicked)
  1359. self.ui.ch_cat_distortion.setChecked(not clicked)
  1360. self.ui.ch_cat_dynamics.setChecked(not clicked)
  1361. self.ui.ch_cat_eq.setChecked(not clicked)
  1362. self.ui.ch_cat_filter.setChecked(not clicked)
  1363. self.ui.ch_cat_modulator.setChecked(not clicked)
  1364. self.ui.ch_cat_synth.setChecked(not clicked)
  1365. self.ui.ch_cat_utility.setChecked(not clicked)
  1366. self.ui.ch_cat_other.setChecked(not clicked)
  1367. self._checkFilters()
  1368. @pyqtSlot(bool)
  1369. def slot_checkFiltersCategorySpecific(self, clicked):
  1370. if clicked:
  1371. self.ui.ch_cat_all.setChecked(False)
  1372. elif not (self.ui.ch_cat_delay.isChecked() or
  1373. self.ui.ch_cat_distortion.isChecked() or
  1374. self.ui.ch_cat_dynamics.isChecked() or
  1375. self.ui.ch_cat_eq.isChecked() or
  1376. self.ui.ch_cat_filter.isChecked() or
  1377. self.ui.ch_cat_modulator.isChecked() or
  1378. self.ui.ch_cat_synth.isChecked() or
  1379. self.ui.ch_cat_utility.isChecked() or
  1380. self.ui.ch_cat_other.isChecked()):
  1381. self.ui.ch_cat_all.setChecked(True)
  1382. self._checkFilters()
  1383. @pyqtSlot()
  1384. def slot_refreshPlugins(self):
  1385. if PluginRefreshW(self, self.host, self.fUseSystemIcons).exec_():
  1386. self._reAddPlugins()
  1387. if self.fRealParent:
  1388. self.fRealParent.setLoadRDFsNeeded()
  1389. @pyqtSlot()
  1390. def slot_clearFilters(self):
  1391. self.blockSignals(True)
  1392. self.ui.ch_internal.setChecked(True)
  1393. self.ui.ch_ladspa.setChecked(True)
  1394. self.ui.ch_dssi.setChecked(True)
  1395. self.ui.ch_lv2.setChecked(True)
  1396. self.ui.ch_vst.setChecked(True)
  1397. self.ui.ch_jsfx.setChecked(True)
  1398. self.ui.ch_kits.setChecked(True)
  1399. self.ui.ch_instruments.setChecked(True)
  1400. self.ui.ch_effects.setChecked(True)
  1401. self.ui.ch_midi.setChecked(True)
  1402. self.ui.ch_other.setChecked(True)
  1403. self.ui.ch_native.setChecked(True)
  1404. self.ui.ch_bridged.setChecked(False)
  1405. self.ui.ch_bridged_wine.setChecked(False)
  1406. self.ui.ch_favorites.setChecked(False)
  1407. self.ui.ch_rtsafe.setChecked(False)
  1408. self.ui.ch_stereo.setChecked(False)
  1409. self.ui.ch_cv.setChecked(False)
  1410. self.ui.ch_gui.setChecked(False)
  1411. self.ui.ch_inline_display.setChecked(False)
  1412. if self.ui.ch_vst3.isEnabled():
  1413. self.ui.ch_vst3.setChecked(True)
  1414. if self.ui.ch_au.isEnabled():
  1415. self.ui.ch_au.setChecked(True)
  1416. self.ui.ch_cat_all.setChecked(True)
  1417. self.ui.ch_cat_delay.setChecked(False)
  1418. self.ui.ch_cat_distortion.setChecked(False)
  1419. self.ui.ch_cat_dynamics.setChecked(False)
  1420. self.ui.ch_cat_eq.setChecked(False)
  1421. self.ui.ch_cat_filter.setChecked(False)
  1422. self.ui.ch_cat_modulator.setChecked(False)
  1423. self.ui.ch_cat_synth.setChecked(False)
  1424. self.ui.ch_cat_utility.setChecked(False)
  1425. self.ui.ch_cat_other.setChecked(False)
  1426. self.ui.lineEdit.clear()
  1427. self.blockSignals(False)
  1428. self._checkFilters()
  1429. # --------------------------------------------------------------------------------------------------------
  1430. @pyqtSlot()
  1431. def slot_saveSettings(self):
  1432. settings = QSafeSettings("falkTX", "CarlaDatabase2")
  1433. settings.setValue("PluginDatabase/Geometry", self.saveGeometry())
  1434. settings.setValue("PluginDatabase/TableGeometry_6", self.ui.tableWidget.horizontalHeader().saveState())
  1435. settings.setValue("PluginDatabase/ShowEffects", self.ui.ch_effects.isChecked())
  1436. settings.setValue("PluginDatabase/ShowInstruments", self.ui.ch_instruments.isChecked())
  1437. settings.setValue("PluginDatabase/ShowMIDI", self.ui.ch_midi.isChecked())
  1438. settings.setValue("PluginDatabase/ShowOther", self.ui.ch_other.isChecked())
  1439. settings.setValue("PluginDatabase/ShowInternal", self.ui.ch_internal.isChecked())
  1440. settings.setValue("PluginDatabase/ShowLADSPA", self.ui.ch_ladspa.isChecked())
  1441. settings.setValue("PluginDatabase/ShowDSSI", self.ui.ch_dssi.isChecked())
  1442. settings.setValue("PluginDatabase/ShowLV2", self.ui.ch_lv2.isChecked())
  1443. settings.setValue("PluginDatabase/ShowVST2", self.ui.ch_vst.isChecked())
  1444. settings.setValue("PluginDatabase/ShowVST3", self.ui.ch_vst3.isChecked())
  1445. settings.setValue("PluginDatabase/ShowAU", self.ui.ch_au.isChecked())
  1446. settings.setValue("PluginDatabase/ShowJSFX", self.ui.ch_jsfx.isChecked())
  1447. settings.setValue("PluginDatabase/ShowKits", self.ui.ch_kits.isChecked())
  1448. settings.setValue("PluginDatabase/ShowNative", self.ui.ch_native.isChecked())
  1449. settings.setValue("PluginDatabase/ShowBridged", self.ui.ch_bridged.isChecked())
  1450. settings.setValue("PluginDatabase/ShowBridgedWine", self.ui.ch_bridged_wine.isChecked())
  1451. settings.setValue("PluginDatabase/ShowFavorites", self.ui.ch_favorites.isChecked())
  1452. settings.setValue("PluginDatabase/ShowRtSafe", self.ui.ch_rtsafe.isChecked())
  1453. settings.setValue("PluginDatabase/ShowHasCV", self.ui.ch_cv.isChecked())
  1454. settings.setValue("PluginDatabase/ShowHasGUI", self.ui.ch_gui.isChecked())
  1455. settings.setValue("PluginDatabase/ShowHasInlineDisplay", self.ui.ch_inline_display.isChecked())
  1456. settings.setValue("PluginDatabase/ShowStereoOnly", self.ui.ch_stereo.isChecked())
  1457. settings.setValue("PluginDatabase/SearchText", self.ui.lineEdit.text())
  1458. if self.ui.ch_cat_all.isChecked():
  1459. settings.setValue("PluginDatabase/ShowCategory", "all")
  1460. else:
  1461. categoryhash = ""
  1462. if self.ui.ch_cat_delay.isChecked():
  1463. categoryhash += ":delay"
  1464. if self.ui.ch_cat_distortion.isChecked():
  1465. categoryhash += ":distortion"
  1466. if self.ui.ch_cat_dynamics.isChecked():
  1467. categoryhash += ":dynamics"
  1468. if self.ui.ch_cat_eq.isChecked():
  1469. categoryhash += ":eq"
  1470. if self.ui.ch_cat_filter.isChecked():
  1471. categoryhash += ":filter"
  1472. if self.ui.ch_cat_modulator.isChecked():
  1473. categoryhash += ":modulator"
  1474. if self.ui.ch_cat_synth.isChecked():
  1475. categoryhash += ":synth"
  1476. if self.ui.ch_cat_utility.isChecked():
  1477. categoryhash += ":utility"
  1478. if self.ui.ch_cat_other.isChecked():
  1479. categoryhash += ":other"
  1480. if categoryhash:
  1481. categoryhash += ":"
  1482. settings.setValue("PluginDatabase/ShowCategory", categoryhash)
  1483. if self.fFavoritePluginsChanged:
  1484. settings.setValue("PluginDatabase/Favorites", self.fFavoritePlugins)
  1485. # --------------------------------------------------------------------------------------------------------
  1486. def loadSettings(self):
  1487. settings = QSafeSettings("falkTX", "CarlaDatabase2")
  1488. self.fFavoritePlugins = settings.value("PluginDatabase/Favorites", [], list)
  1489. self.fFavoritePluginsChanged = False
  1490. self.restoreGeometry(settings.value("PluginDatabase/Geometry", QByteArray(), QByteArray))
  1491. self.ui.ch_effects.setChecked(settings.value("PluginDatabase/ShowEffects", True, bool))
  1492. self.ui.ch_instruments.setChecked(settings.value("PluginDatabase/ShowInstruments", True, bool))
  1493. self.ui.ch_midi.setChecked(settings.value("PluginDatabase/ShowMIDI", True, bool))
  1494. self.ui.ch_other.setChecked(settings.value("PluginDatabase/ShowOther", True, bool))
  1495. self.ui.ch_internal.setChecked(settings.value("PluginDatabase/ShowInternal", True, bool))
  1496. self.ui.ch_ladspa.setChecked(settings.value("PluginDatabase/ShowLADSPA", True, bool))
  1497. self.ui.ch_dssi.setChecked(settings.value("PluginDatabase/ShowDSSI", True, bool))
  1498. self.ui.ch_lv2.setChecked(settings.value("PluginDatabase/ShowLV2", True, bool))
  1499. self.ui.ch_vst.setChecked(settings.value("PluginDatabase/ShowVST2", True, bool))
  1500. self.ui.ch_vst3.setChecked(settings.value("PluginDatabase/ShowVST3", (MACOS or WINDOWS), bool))
  1501. self.ui.ch_au.setChecked(settings.value("PluginDatabase/ShowAU", MACOS, bool))
  1502. self.ui.ch_jsfx.setChecked(settings.value("PluginDatabase/ShowJSFX", True, bool))
  1503. self.ui.ch_kits.setChecked(settings.value("PluginDatabase/ShowKits", True, bool))
  1504. self.ui.ch_native.setChecked(settings.value("PluginDatabase/ShowNative", True, bool))
  1505. self.ui.ch_bridged.setChecked(settings.value("PluginDatabase/ShowBridged", True, bool))
  1506. self.ui.ch_bridged_wine.setChecked(settings.value("PluginDatabase/ShowBridgedWine", True, bool))
  1507. self.ui.ch_favorites.setChecked(settings.value("PluginDatabase/ShowFavorites", False, bool))
  1508. self.ui.ch_rtsafe.setChecked(settings.value("PluginDatabase/ShowRtSafe", False, bool))
  1509. self.ui.ch_cv.setChecked(settings.value("PluginDatabase/ShowHasCV", False, bool))
  1510. self.ui.ch_gui.setChecked(settings.value("PluginDatabase/ShowHasGUI", False, bool))
  1511. self.ui.ch_inline_display.setChecked(settings.value("PluginDatabase/ShowHasInlineDisplay", False, bool))
  1512. self.ui.ch_stereo.setChecked(settings.value("PluginDatabase/ShowStereoOnly", False, bool))
  1513. self.ui.lineEdit.setText(settings.value("PluginDatabase/SearchText", "", str))
  1514. categoryhash = settings.value("PluginDatabase/ShowCategory", "all", str)
  1515. if categoryhash == "all" or len(categoryhash) < 2:
  1516. self.ui.ch_cat_all.setChecked(True)
  1517. self.ui.ch_cat_delay.setChecked(False)
  1518. self.ui.ch_cat_distortion.setChecked(False)
  1519. self.ui.ch_cat_dynamics.setChecked(False)
  1520. self.ui.ch_cat_eq.setChecked(False)
  1521. self.ui.ch_cat_filter.setChecked(False)
  1522. self.ui.ch_cat_modulator.setChecked(False)
  1523. self.ui.ch_cat_synth.setChecked(False)
  1524. self.ui.ch_cat_utility.setChecked(False)
  1525. self.ui.ch_cat_other.setChecked(False)
  1526. else:
  1527. self.ui.ch_cat_all.setChecked(False)
  1528. self.ui.ch_cat_delay.setChecked(":delay:" in categoryhash)
  1529. self.ui.ch_cat_distortion.setChecked(":distortion:" in categoryhash)
  1530. self.ui.ch_cat_dynamics.setChecked(":dynamics:" in categoryhash)
  1531. self.ui.ch_cat_eq.setChecked(":eq:" in categoryhash)
  1532. self.ui.ch_cat_filter.setChecked(":filter:" in categoryhash)
  1533. self.ui.ch_cat_modulator.setChecked(":modulator:" in categoryhash)
  1534. self.ui.ch_cat_synth.setChecked(":synth:" in categoryhash)
  1535. self.ui.ch_cat_utility.setChecked(":utility:" in categoryhash)
  1536. self.ui.ch_cat_other.setChecked(":other:" in categoryhash)
  1537. tableGeometry = settings.value("PluginDatabase/TableGeometry_6", QByteArray(), QByteArray)
  1538. horizontalHeader = self.ui.tableWidget.horizontalHeader()
  1539. if not tableGeometry.isNull():
  1540. horizontalHeader.restoreState(tableGeometry)
  1541. else:
  1542. horizontalHeader.setSectionResizeMode(self.TABLEWIDGET_ITEM_FAVORITE, QHeaderView.Fixed)
  1543. self.ui.tableWidget.setColumnWidth(self.TABLEWIDGET_ITEM_FAVORITE, 24)
  1544. self.ui.tableWidget.setColumnWidth(self.TABLEWIDGET_ITEM_NAME, 250)
  1545. self.ui.tableWidget.setColumnWidth(self.TABLEWIDGET_ITEM_LABEL, 200)
  1546. self.ui.tableWidget.setColumnWidth(self.TABLEWIDGET_ITEM_MAKER, 150)
  1547. self.ui.tableWidget.sortByColumn(self.TABLEWIDGET_ITEM_NAME, Qt.AscendingOrder)
  1548. # --------------------------------------------------------------------------------------------------------
  1549. def _createFavoritePluginDict(self, plugin):
  1550. return {
  1551. 'name' : plugin['name'],
  1552. 'build' : plugin['build'],
  1553. 'type' : plugin['type'],
  1554. 'filename': plugin['filename'],
  1555. 'label' : plugin['label'],
  1556. 'uniqueId': plugin['uniqueId'],
  1557. }
  1558. def _checkFilters(self):
  1559. text = self.ui.lineEdit.text().lower()
  1560. hideEffects = not self.ui.ch_effects.isChecked()
  1561. hideInstruments = not self.ui.ch_instruments.isChecked()
  1562. hideMidi = not self.ui.ch_midi.isChecked()
  1563. hideOther = not self.ui.ch_other.isChecked()
  1564. hideInternal = not self.ui.ch_internal.isChecked()
  1565. hideLadspa = not self.ui.ch_ladspa.isChecked()
  1566. hideDssi = not self.ui.ch_dssi.isChecked()
  1567. hideLV2 = not self.ui.ch_lv2.isChecked()
  1568. hideVST2 = not self.ui.ch_vst.isChecked()
  1569. hideVST3 = not self.ui.ch_vst3.isChecked()
  1570. hideAU = not self.ui.ch_au.isChecked()
  1571. hideJSFX = not self.ui.ch_jsfx.isChecked()
  1572. hideKits = not self.ui.ch_kits.isChecked()
  1573. hideNative = not self.ui.ch_native.isChecked()
  1574. hideBridged = not self.ui.ch_bridged.isChecked()
  1575. hideBridgedWine = not self.ui.ch_bridged_wine.isChecked()
  1576. hideNonFavs = self.ui.ch_favorites.isChecked()
  1577. hideNonRtSafe = self.ui.ch_rtsafe.isChecked()
  1578. hideNonCV = self.ui.ch_cv.isChecked()
  1579. hideNonGui = self.ui.ch_gui.isChecked()
  1580. hideNonIDisp = self.ui.ch_inline_display.isChecked()
  1581. hideNonStereo = self.ui.ch_stereo.isChecked()
  1582. if HAIKU or LINUX or MACOS:
  1583. nativeBins = [BINARY_POSIX32, BINARY_POSIX64]
  1584. wineBins = [BINARY_WIN32, BINARY_WIN64]
  1585. elif WINDOWS:
  1586. nativeBins = [BINARY_WIN32, BINARY_WIN64]
  1587. wineBins = []
  1588. else:
  1589. nativeBins = []
  1590. wineBins = []
  1591. self.ui.tableWidget.setRowCount(self.fLastTableIndex)
  1592. for i in range(self.fLastTableIndex):
  1593. plugin = self.ui.tableWidget.item(i, self.TABLEWIDGET_ITEM_NAME).data(Qt.UserRole+1)
  1594. ptext = self.ui.tableWidget.item(i, self.TABLEWIDGET_ITEM_NAME).data(Qt.UserRole+2)
  1595. aIns = plugin['audio.ins']
  1596. aOuts = plugin['audio.outs']
  1597. cvIns = plugin['cv.ins']
  1598. cvOuts = plugin['cv.outs']
  1599. mIns = plugin['midi.ins']
  1600. mOuts = plugin['midi.outs']
  1601. phints = plugin['hints']
  1602. ptype = plugin['type']
  1603. categ = plugin['category']
  1604. isSynth = bool(phints & PLUGIN_IS_SYNTH)
  1605. isEffect = bool(aIns > 0 < aOuts and not isSynth)
  1606. isMidi = bool(aIns == 0 and aOuts == 0 and mIns > 0 < mOuts)
  1607. isKit = bool(ptype in (PLUGIN_SF2, PLUGIN_SFZ))
  1608. isOther = bool(not (isEffect or isSynth or isMidi or isKit))
  1609. isNative = bool(plugin['build'] == BINARY_NATIVE)
  1610. isRtSafe = bool(phints & PLUGIN_IS_RTSAFE)
  1611. isStereo = bool(aIns == 2 and aOuts == 2) or (isSynth and aOuts == 2)
  1612. hasCV = bool(cvIns + cvOuts > 0)
  1613. hasGui = bool(phints & PLUGIN_HAS_CUSTOM_UI)
  1614. hasIDisp = bool(phints & PLUGIN_HAS_INLINE_DISPLAY)
  1615. isBridged = bool(not isNative and plugin['build'] in nativeBins)
  1616. isBridgedWine = bool(not isNative and plugin['build'] in wineBins)
  1617. if hideEffects and isEffect:
  1618. self.ui.tableWidget.hideRow(i)
  1619. elif hideInstruments and isSynth:
  1620. self.ui.tableWidget.hideRow(i)
  1621. elif hideMidi and isMidi:
  1622. self.ui.tableWidget.hideRow(i)
  1623. elif hideOther and isOther:
  1624. self.ui.tableWidget.hideRow(i)
  1625. elif hideKits and isKit:
  1626. self.ui.tableWidget.hideRow(i)
  1627. elif hideInternal and ptype == PLUGIN_INTERNAL:
  1628. self.ui.tableWidget.hideRow(i)
  1629. elif hideLadspa and ptype == PLUGIN_LADSPA:
  1630. self.ui.tableWidget.hideRow(i)
  1631. elif hideDssi and ptype == PLUGIN_DSSI:
  1632. self.ui.tableWidget.hideRow(i)
  1633. elif hideLV2 and ptype == PLUGIN_LV2:
  1634. self.ui.tableWidget.hideRow(i)
  1635. elif hideVST2 and ptype == PLUGIN_VST2:
  1636. self.ui.tableWidget.hideRow(i)
  1637. elif hideVST3 and ptype == PLUGIN_VST3:
  1638. self.ui.tableWidget.hideRow(i)
  1639. elif hideAU and ptype == PLUGIN_AU:
  1640. self.ui.tableWidget.hideRow(i)
  1641. elif hideJSFX and ptype == PLUGIN_JSFX:
  1642. self.ui.tableWidget.hideRow(i)
  1643. elif hideNative and isNative:
  1644. self.ui.tableWidget.hideRow(i)
  1645. elif hideBridged and isBridged:
  1646. self.ui.tableWidget.hideRow(i)
  1647. elif hideBridgedWine and isBridgedWine:
  1648. self.ui.tableWidget.hideRow(i)
  1649. elif hideNonRtSafe and not isRtSafe:
  1650. self.ui.tableWidget.hideRow(i)
  1651. elif hideNonCV and not hasCV:
  1652. self.ui.tableWidget.hideRow(i)
  1653. elif hideNonGui and not hasGui:
  1654. self.ui.tableWidget.hideRow(i)
  1655. elif hideNonIDisp and not hasIDisp:
  1656. self.ui.tableWidget.hideRow(i)
  1657. elif hideNonStereo and not isStereo:
  1658. self.ui.tableWidget.hideRow(i)
  1659. elif text and not all(t in ptext for t in text.strip().split(' ')):
  1660. self.ui.tableWidget.hideRow(i)
  1661. elif hideNonFavs and self._createFavoritePluginDict(plugin) not in self.fFavoritePlugins:
  1662. self.ui.tableWidget.hideRow(i)
  1663. elif (self.ui.ch_cat_all.isChecked() or
  1664. (self.ui.ch_cat_delay.isChecked() and categ == "delay") or
  1665. (self.ui.ch_cat_distortion.isChecked() and categ == "distortion") or
  1666. (self.ui.ch_cat_dynamics.isChecked() and categ == "dynamics") or
  1667. (self.ui.ch_cat_eq.isChecked() and categ == "eq") or
  1668. (self.ui.ch_cat_filter.isChecked() and categ == "filter") or
  1669. (self.ui.ch_cat_modulator.isChecked() and categ == "modulator") or
  1670. (self.ui.ch_cat_synth.isChecked() and categ == "synth") or
  1671. (self.ui.ch_cat_utility.isChecked() and categ == "utility") or
  1672. (self.ui.ch_cat_other.isChecked() and categ == "other")):
  1673. self.ui.tableWidget.showRow(i)
  1674. else:
  1675. self.ui.tableWidget.hideRow(i)
  1676. # --------------------------------------------------------------------------------------------------------
  1677. def _addPluginToTable(self, plugin, ptype):
  1678. if plugin['API'] != PLUGIN_QUERY_API_VERSION:
  1679. return
  1680. if ptype in (self.tr("Internal"), "LV2", "SF2", "SFZ", "JSFX"):
  1681. plugin['build'] = BINARY_NATIVE
  1682. index = self.fLastTableIndex
  1683. isFav = bool(self._createFavoritePluginDict(plugin) in self.fFavoritePlugins)
  1684. favItem = QTableWidgetItem()
  1685. favItem.setCheckState(Qt.Checked if isFav else Qt.Unchecked)
  1686. favItem.setText(" " if isFav else " ")
  1687. pluginText = (plugin['name']+plugin['label']+plugin['maker']+plugin['filename']).lower()
  1688. self.ui.tableWidget.setItem(index, self.TABLEWIDGET_ITEM_FAVORITE, favItem)
  1689. self.ui.tableWidget.setItem(index, self.TABLEWIDGET_ITEM_NAME, QTableWidgetItem(plugin['name']))
  1690. self.ui.tableWidget.setItem(index, self.TABLEWIDGET_ITEM_LABEL, QTableWidgetItem(plugin['label']))
  1691. self.ui.tableWidget.setItem(index, self.TABLEWIDGET_ITEM_MAKER, QTableWidgetItem(plugin['maker']))
  1692. self.ui.tableWidget.setItem(index, self.TABLEWIDGET_ITEM_BINARY, QTableWidgetItem(os.path.basename(plugin['filename'])))
  1693. self.ui.tableWidget.item(index, self.TABLEWIDGET_ITEM_NAME).setData(Qt.UserRole+1, plugin)
  1694. self.ui.tableWidget.item(index, self.TABLEWIDGET_ITEM_NAME).setData(Qt.UserRole+2, pluginText)
  1695. self.fLastTableIndex += 1
  1696. # --------------------------------------------------------------------------------------------------------
  1697. def _reAddInternalHelper(self, settingsDB, ptype, path):
  1698. if ptype == PLUGIN_INTERNAL:
  1699. ptypeStr = "Internal"
  1700. ptypeStrTr = self.tr("Internal")
  1701. elif ptype == PLUGIN_LV2:
  1702. ptypeStr = "LV2"
  1703. ptypeStrTr = ptypeStr
  1704. elif ptype == PLUGIN_AU:
  1705. ptypeStr = "AU"
  1706. ptypeStrTr = ptypeStr
  1707. #elif ptype == PLUGIN_SFZ:
  1708. #ptypeStr = "SFZ"
  1709. #ptypeStrTr = ptypeStr
  1710. # TODO(jsfx) what to do here?
  1711. else:
  1712. return 0
  1713. plugins = settingsDB.value("Plugins/" + ptypeStr, [], list)
  1714. pluginCount = settingsDB.value("PluginCount/" + ptypeStr, 0, int)
  1715. if ptype == PLUGIN_AU:
  1716. gCarla.utils.juce_init()
  1717. pluginCountNew = gCarla.utils.get_cached_plugin_count(ptype, path)
  1718. if pluginCountNew != pluginCount or len(plugins) != pluginCount or (len(plugins) > 0 and plugins[0]['API'] != PLUGIN_QUERY_API_VERSION):
  1719. plugins = []
  1720. pluginCount = pluginCountNew
  1721. QApplication.processEvents(QEventLoop.ExcludeUserInputEvents, 50)
  1722. if ptype == PLUGIN_AU:
  1723. gCarla.utils.juce_idle()
  1724. for i in range(pluginCountNew):
  1725. descInfo = gCarla.utils.get_cached_plugin_info(ptype, i)
  1726. if not descInfo['valid']:
  1727. continue
  1728. info = checkPluginCached(descInfo, ptype)
  1729. plugins.append(info)
  1730. if i % 50 == 0:
  1731. QApplication.processEvents(QEventLoop.ExcludeUserInputEvents, 50)
  1732. if ptype == PLUGIN_AU:
  1733. gCarla.utils.juce_idle()
  1734. settingsDB.setValue("Plugins/" + ptypeStr, plugins)
  1735. settingsDB.setValue("PluginCount/" + ptypeStr, pluginCount)
  1736. if ptype == PLUGIN_AU:
  1737. gCarla.utils.juce_cleanup()
  1738. # prepare rows in advance
  1739. self.ui.tableWidget.setRowCount(self.fLastTableIndex + len(plugins))
  1740. for plugin in plugins:
  1741. self._addPluginToTable(plugin, ptypeStrTr)
  1742. return pluginCount
  1743. def _reAddPlugins(self):
  1744. settingsDB = QSafeSettings("falkTX", "CarlaPlugins5")
  1745. self.fLastTableIndex = 0
  1746. self.ui.tableWidget.setSortingEnabled(False)
  1747. self.ui.tableWidget.clearContents()
  1748. settings = QSafeSettings("falkTX", "Carla2")
  1749. LV2_PATH = splitter.join(settings.value(CARLA_KEY_PATHS_LV2, CARLA_DEFAULT_LV2_PATH, list))
  1750. del settings
  1751. # ----------------------------------------------------------------------------------------------------
  1752. # plugins handled through backend
  1753. internalCount = self._reAddInternalHelper(settingsDB, PLUGIN_INTERNAL, "")
  1754. lv2Count = self._reAddInternalHelper(settingsDB, PLUGIN_LV2, LV2_PATH)
  1755. auCount = self._reAddInternalHelper(settingsDB, PLUGIN_AU, "") if MACOS else 0
  1756. # ----------------------------------------------------------------------------------------------------
  1757. # LADSPA
  1758. ladspaPlugins = []
  1759. ladspaPlugins += settingsDB.value("Plugins/LADSPA_native", [], list)
  1760. ladspaPlugins += settingsDB.value("Plugins/LADSPA_posix32", [], list)
  1761. ladspaPlugins += settingsDB.value("Plugins/LADSPA_posix64", [], list)
  1762. ladspaPlugins += settingsDB.value("Plugins/LADSPA_win32", [], list)
  1763. ladspaPlugins += settingsDB.value("Plugins/LADSPA_win64", [], list)
  1764. # ----------------------------------------------------------------------------------------------------
  1765. # DSSI
  1766. dssiPlugins = []
  1767. dssiPlugins += settingsDB.value("Plugins/DSSI_native", [], list)
  1768. dssiPlugins += settingsDB.value("Plugins/DSSI_posix32", [], list)
  1769. dssiPlugins += settingsDB.value("Plugins/DSSI_posix64", [], list)
  1770. dssiPlugins += settingsDB.value("Plugins/DSSI_win32", [], list)
  1771. dssiPlugins += settingsDB.value("Plugins/DSSI_win64", [], list)
  1772. # ----------------------------------------------------------------------------------------------------
  1773. # VST2
  1774. vst2Plugins = []
  1775. vst2Plugins += settingsDB.value("Plugins/VST2_native", [], list)
  1776. vst2Plugins += settingsDB.value("Plugins/VST2_posix32", [], list)
  1777. vst2Plugins += settingsDB.value("Plugins/VST2_posix64", [], list)
  1778. vst2Plugins += settingsDB.value("Plugins/VST2_win32", [], list)
  1779. vst2Plugins += settingsDB.value("Plugins/VST2_win64", [], list)
  1780. # ----------------------------------------------------------------------------------------------------
  1781. # VST3
  1782. vst3Plugins = []
  1783. vst3Plugins += settingsDB.value("Plugins/VST3_native", [], list)
  1784. vst3Plugins += settingsDB.value("Plugins/VST3_posix32", [], list)
  1785. vst3Plugins += settingsDB.value("Plugins/VST3_posix64", [], list)
  1786. vst3Plugins += settingsDB.value("Plugins/VST3_win32", [], list)
  1787. vst3Plugins += settingsDB.value("Plugins/VST3_win64", [], list)
  1788. # ----------------------------------------------------------------------------------------------------
  1789. # AU (extra non-cached)
  1790. auPlugins32 = settingsDB.value("Plugins/AU_posix32", [], list) if MACOS else []
  1791. # ----------------------------------------------------------------------------------------------------
  1792. # JSFX
  1793. jsfxPlugins = settingsDB.value("Plugins/JSFX", [], list)
  1794. # ----------------------------------------------------------------------------------------------------
  1795. # Kits
  1796. sf2s = settingsDB.value("Plugins/SF2", [], list)
  1797. sfzs = settingsDB.value("Plugins/SFZ", [], list)
  1798. # ----------------------------------------------------------------------------------------------------
  1799. # count plugins first, so we can create rows in advance
  1800. ladspaCount = 0
  1801. dssiCount = 0
  1802. vstCount = 0
  1803. vst3Count = 0
  1804. au32Count = 0
  1805. jsfxCount = len(jsfxPlugins)
  1806. sf2Count = 0
  1807. sfzCount = len(sfzs)
  1808. for plugins in ladspaPlugins:
  1809. ladspaCount += len(plugins)
  1810. for plugins in dssiPlugins:
  1811. dssiCount += len(plugins)
  1812. for plugins in vst2Plugins:
  1813. vstCount += len(plugins)
  1814. for plugins in vst3Plugins:
  1815. vst3Count += len(plugins)
  1816. for plugins in auPlugins32:
  1817. au32Count += len(plugins)
  1818. for plugins in sf2s:
  1819. sf2Count += len(plugins)
  1820. self.ui.tableWidget.setRowCount(self.fLastTableIndex +
  1821. ladspaCount + dssiCount + vstCount + vst3Count + au32Count + jsfxCount +
  1822. sf2Count + sfzCount)
  1823. if MACOS:
  1824. self.ui.label.setText(self.tr("Have %i Internal, %i LADSPA, %i DSSI, %i LV2, %i VST2, %i VST3, %i AudioUnit plugins and %i JSFX plugins, plus %i Sound Kits" % (
  1825. internalCount, ladspaCount, dssiCount, lv2Count, vstCount, vst3Count, auCount+au32Count, jsfxCount, sf2Count+sfzCount)))
  1826. else:
  1827. self.ui.label.setText(self.tr("Have %i Internal, %i LADSPA, %i DSSI, %i LV2, %i VST2, %i VST3 plugins and %i JSFX plugins, plus %i Sound Kits" % (
  1828. internalCount, ladspaCount, dssiCount, lv2Count, vstCount, vst3Count, jsfxCount, sf2Count+sfzCount)))
  1829. # ----------------------------------------------------------------------------------------------------
  1830. # now add all plugins to the table
  1831. for plugins in ladspaPlugins:
  1832. for plugin in plugins:
  1833. self._addPluginToTable(plugin, "LADSPA")
  1834. for plugins in dssiPlugins:
  1835. for plugin in plugins:
  1836. self._addPluginToTable(plugin, "DSSI")
  1837. for plugins in vst2Plugins:
  1838. for plugin in plugins:
  1839. self._addPluginToTable(plugin, "VST2")
  1840. for plugins in vst3Plugins:
  1841. for plugin in plugins:
  1842. self._addPluginToTable(plugin, "VST3")
  1843. for plugins in auPlugins32:
  1844. for plugin in plugins:
  1845. self._addPluginToTable(plugin, "AU")
  1846. for plugin in jsfxPlugins:
  1847. self._addPluginToTable(plugin, "JSFX")
  1848. for sf2 in sf2s:
  1849. for sf2_i in sf2:
  1850. self._addPluginToTable(sf2_i, "SF2")
  1851. for sfz in sfzs:
  1852. self._addPluginToTable(sfz, "SFZ")
  1853. # ----------------------------------------------------------------------------------------------------
  1854. self.ui.tableWidget.setSortingEnabled(True)
  1855. self._checkFilters()
  1856. self.slot_checkPlugin(self.ui.tableWidget.currentRow())
  1857. # --------------------------------------------------------------------------------------------------------
  1858. def showEvent(self, event):
  1859. self.slot_focusSearchFieldAndSelectAll()
  1860. QDialog.showEvent(self, event)
  1861. # ---------------------------------------------------------------------------------------------------------------------
  1862. # Jack Application Dialog
  1863. class JackApplicationW(QDialog):
  1864. SESSION_MGR_NONE = 0
  1865. SESSION_MGR_AUTO = 1
  1866. SESSION_MGR_JACK = 2
  1867. SESSION_MGR_LADISH = 3
  1868. SESSION_MGR_NSM = 4
  1869. UI_SESSION_NONE = 0
  1870. UI_SESSION_LADISH = 1
  1871. UI_SESSION_NSM = 2
  1872. FLAG_CONTROL_WINDOW = 0x01
  1873. FLAG_CAPTURE_FIRST_WINDOW = 0x02
  1874. FLAG_BUFFERS_ADDITION_MODE = 0x10
  1875. FLAG_MIDI_OUTPUT_CHANNEL_MIXDOWN = 0x20
  1876. FLAG_EXTERNAL_START = 0x40
  1877. def __init__(self, parent, projectFilename):
  1878. QDialog.__init__(self, parent)
  1879. self.ui = ui_carla_add_jack.Ui_Dialog()
  1880. self.ui.setupUi(self)
  1881. print("Add JACK Application: current project filename is '%s'" % (projectFilename,))
  1882. self.fProjectFilename = projectFilename
  1883. self.ui.group_error.setVisible(False)
  1884. self.adjustSize()
  1885. self.setWindowFlags(self.windowFlags() & ~Qt.WindowContextHelpButtonHint)
  1886. # --------------------------------------------------------------------------------------------------------------
  1887. # Load settings
  1888. self.loadSettings()
  1889. # --------------------------------------------------------------------------------------------------------------
  1890. # Set-up connections
  1891. self.finished.connect(self.slot_saveSettings)
  1892. self.ui.cb_session_mgr.currentIndexChanged.connect(self.slot_sessionManagerChanged)
  1893. self.ui.le_command.textChanged.connect(self.slot_commandChanged)
  1894. # -----------------------------------------------------------------------------------------------------------------
  1895. def getCommandAndFlags(self):
  1896. name = self.ui.le_name.text()
  1897. command = self.ui.le_command.text()
  1898. smgr = self.SESSION_MGR_NONE
  1899. flags = 0x0
  1900. if not name:
  1901. name = os.path.basename(command.split(" ",1)[0]).title()
  1902. uiSessionMgrIndex = self.ui.cb_session_mgr.currentIndex()
  1903. if uiSessionMgrIndex == self.UI_SESSION_LADISH:
  1904. smgr = self.SESSION_MGR_LADISH
  1905. elif uiSessionMgrIndex == self.UI_SESSION_NSM:
  1906. smgr = self.SESSION_MGR_NSM
  1907. if self.ui.cb_manage_window.isChecked():
  1908. flags |= self.FLAG_CONTROL_WINDOW
  1909. if self.ui.cb_capture_first_window.isChecked():
  1910. flags |= self.FLAG_CAPTURE_FIRST_WINDOW
  1911. if self.ui.cb_buffers_addition_mode.isChecked():
  1912. flags |= self.FLAG_BUFFERS_ADDITION_MODE
  1913. if self.ui.cb_out_midi_mixdown.isChecked():
  1914. flags |= self.FLAG_MIDI_OUTPUT_CHANNEL_MIXDOWN
  1915. if self.ui.cb_external_start.isChecked():
  1916. flags |= self.FLAG_EXTERNAL_START
  1917. baseIntVal = ord('0')
  1918. labelSetup = "%s%s%s%s%s%s" % (chr(baseIntVal+self.ui.sb_audio_ins.value()),
  1919. chr(baseIntVal+self.ui.sb_audio_outs.value()),
  1920. chr(baseIntVal+self.ui.sb_midi_ins.value()),
  1921. chr(baseIntVal+self.ui.sb_midi_outs.value()),
  1922. chr(baseIntVal+smgr),
  1923. chr(baseIntVal+flags))
  1924. return (command, name, labelSetup)
  1925. def checkIfButtonBoxShouldBeEnabled(self, index, text):
  1926. enabled = len(text) > 0
  1927. showErr = ""
  1928. # NSM applications must not be abstract or absolute paths, and must not contain arguments
  1929. if enabled and index == self.UI_SESSION_NSM:
  1930. if text[0] in (".", "/"):
  1931. showErr = self.tr("NSM applications cannot use abstract or absolute paths")
  1932. elif " " in text or ";" in text or "&" in text:
  1933. showErr = self.tr("NSM applications cannot use CLI arguments")
  1934. elif len(self.fProjectFilename) == 0:
  1935. showErr = self.tr("You need to save the current Carla project before NSM can be used")
  1936. if showErr:
  1937. enabled = False
  1938. self.ui.l_error.setText(showErr)
  1939. self.ui.group_error.setVisible(True)
  1940. else:
  1941. self.ui.group_error.setVisible(False)
  1942. self.ui.buttonBox.button(QDialogButtonBox.Ok).setEnabled(enabled)
  1943. def loadSettings(self):
  1944. settings = QSafeSettings("falkTX", "CarlaAddJackApp")
  1945. smName = settings.value("SessionManager", "", str)
  1946. if smName == "LADISH (SIGUSR1)":
  1947. self.ui.cb_session_mgr.setCurrentIndex(self.UI_SESSION_LADISH)
  1948. elif smName == "NSM":
  1949. self.ui.cb_session_mgr.setCurrentIndex(self.UI_SESSION_NSM)
  1950. else:
  1951. self.ui.cb_session_mgr.setCurrentIndex(self.UI_SESSION_NONE)
  1952. self.ui.le_command.setText(settings.value("Command", "", str))
  1953. self.ui.le_name.setText(settings.value("Name", "", str))
  1954. self.ui.sb_audio_ins.setValue(settings.value("NumAudioIns", 2, int))
  1955. self.ui.sb_audio_ins.setValue(settings.value("NumAudioIns", 2, int))
  1956. self.ui.sb_audio_outs.setValue(settings.value("NumAudioOuts", 2, int))
  1957. self.ui.sb_midi_ins.setValue(settings.value("NumMidiIns", 0, int))
  1958. self.ui.sb_midi_outs.setValue(settings.value("NumMidiOuts", 0, int))
  1959. self.ui.cb_manage_window.setChecked(settings.value("ManageWindow", True, bool))
  1960. self.ui.cb_capture_first_window.setChecked(settings.value("CaptureFirstWindow", False, bool))
  1961. self.ui.cb_out_midi_mixdown.setChecked(settings.value("MidiOutMixdown", False, bool))
  1962. self.checkIfButtonBoxShouldBeEnabled(self.ui.cb_session_mgr.currentIndex(),
  1963. self.ui.le_command.text())
  1964. # -----------------------------------------------------------------------------------------------------------------
  1965. @pyqtSlot(str)
  1966. def slot_commandChanged(self, text):
  1967. self.checkIfButtonBoxShouldBeEnabled(self.ui.cb_session_mgr.currentIndex(), text)
  1968. @pyqtSlot(int)
  1969. def slot_sessionManagerChanged(self, index):
  1970. self.checkIfButtonBoxShouldBeEnabled(index, self.ui.le_command.text())
  1971. @pyqtSlot()
  1972. def slot_saveSettings(self):
  1973. settings = QSafeSettings("falkTX", "CarlaAddJackApp")
  1974. settings.setValue("Command", self.ui.le_command.text())
  1975. settings.setValue("Name", self.ui.le_name.text())
  1976. settings.setValue("SessionManager", self.ui.cb_session_mgr.currentText())
  1977. settings.setValue("NumAudioIns", self.ui.sb_audio_ins.value())
  1978. settings.setValue("NumAudioOuts", self.ui.sb_audio_outs.value())
  1979. settings.setValue("NumMidiIns", self.ui.sb_midi_ins.value())
  1980. settings.setValue("NumMidiOuts", self.ui.sb_midi_outs.value())
  1981. settings.setValue("ManageWindow", self.ui.cb_manage_window.isChecked())
  1982. settings.setValue("CaptureFirstWindow", self.ui.cb_capture_first_window.isChecked())
  1983. settings.setValue("MidiOutMixdown", self.ui.cb_out_midi_mixdown.isChecked())
  1984. # ---------------------------------------------------------------------------------------------------------------------
  1985. # Main
  1986. if __name__ == '__main__':
  1987. from carla_app import CarlaApplication
  1988. from carla_host import initHost as _initHost, loadHostSettings as _loadHostSettings
  1989. # pylint: disable=ungrouped-imports
  1990. from carla_shared import handleInitialCommandLineArguments
  1991. # pylint: enable=ungrouped-imports
  1992. initName, libPrefix = handleInitialCommandLineArguments(__file__ if "__file__" in dir() else None)
  1993. app = CarlaApplication("Carla2-Database", libPrefix)
  1994. host = _initHost("Carla2-Database", libPrefix, False, False, False)
  1995. _loadHostSettings(host)
  1996. gui = PluginDatabaseW(None, host, True)
  1997. #gui = PluginRefreshW(None, host, True)
  1998. gui.show()
  1999. app.exit_exec()
  2000. # ------------------------------------------------------------------------------------------------------------