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.

pluginlistdialog.py 44KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000
  1. #!/usr/bin/env python3
  2. # -*- coding: utf-8 -*-
  3. # Carla plugin host
  4. # Copyright (C) 2011-2022 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. import os
  20. from PyQt5.QtCore import pyqtSlot, Qt, QByteArray, QEventLoop
  21. from PyQt5.QtWidgets import QApplication, QDialog, QHeaderView, QTableWidgetItem, QWidget
  22. # ---------------------------------------------------------------------------------------------------------------------
  23. # Imports (Carla)
  24. from carla_backend import (
  25. BINARY_NATIVE,
  26. BINARY_OTHER,
  27. BINARY_POSIX32,
  28. BINARY_POSIX64,
  29. BINARY_WIN32,
  30. BINARY_WIN64,
  31. PLUGIN_AU,
  32. PLUGIN_DSSI,
  33. PLUGIN_HAS_CUSTOM_UI,
  34. PLUGIN_HAS_INLINE_DISPLAY,
  35. PLUGIN_INTERNAL,
  36. PLUGIN_IS_BRIDGE,
  37. PLUGIN_IS_RTSAFE,
  38. PLUGIN_IS_SYNTH,
  39. PLUGIN_JSFX,
  40. PLUGIN_LADSPA,
  41. PLUGIN_LV2,
  42. PLUGIN_SF2,
  43. PLUGIN_SFZ,
  44. PLUGIN_VST2,
  45. PLUGIN_VST3,
  46. PLUGIN_CLAP,
  47. )
  48. from carla_shared import (
  49. CARLA_DEFAULT_LV2_PATH,
  50. CARLA_KEY_PATHS_LV2,
  51. HAIKU,
  52. LINUX,
  53. MACOS,
  54. WINDOWS,
  55. fontMetricsHorizontalAdvance,
  56. gCarla,
  57. getIcon,
  58. kIs64bit,
  59. splitter,
  60. )
  61. from carla_utils import getPluginTypeAsString
  62. from utils import QSafeSettings
  63. # ---------------------------------------------------------------------------------------------------------------------
  64. # Imports (Local)
  65. from .discovery import PLUGIN_QUERY_API_VERSION, checkPluginCached
  66. from .pluginlistdialog_ui import Ui_PluginListDialog
  67. from .pluginlistrefreshdialog import PluginRefreshW
  68. # ---------------------------------------------------------------------------------------------------------------------
  69. # Plugin Database Dialog
  70. class PluginListDialog(QDialog):
  71. TABLEWIDGET_ITEM_FAVORITE = 0
  72. TABLEWIDGET_ITEM_NAME = 1
  73. TABLEWIDGET_ITEM_LABEL = 2
  74. TABLEWIDGET_ITEM_MAKER = 3
  75. TABLEWIDGET_ITEM_BINARY = 4
  76. def __init__(self, parent: QWidget, host, useSystemIcons: bool):
  77. QDialog.__init__(self, parent)
  78. self.host = host
  79. self.ui = Ui_PluginListDialog()
  80. self.ui.setupUi(self)
  81. # To be changed by parent
  82. self.hasLoadedLv2Plugins = False
  83. # ----------------------------------------------------------------------------------------------------
  84. # Internal stuff
  85. self.fLastTableIndex = 0
  86. self.fRetPlugin = None
  87. self.fRealParent = parent
  88. self.fFavoritePlugins = []
  89. self.fFavoritePluginsChanged = False
  90. self.fUseSystemIcons = useSystemIcons # TODO cpp
  91. self.fTrYes = self.tr("Yes")
  92. self.fTrNo = self.tr("No")
  93. self.fTrNative = self.tr("Native")
  94. # ----------------------------------------------------------------------------------------------------
  95. # Set-up GUI
  96. self.ui.b_add.setEnabled(False)
  97. self.addAction(self.ui.act_focus_search)
  98. self.ui.act_focus_search.triggered.connect(self.slot_focusSearchFieldAndSelectAll)
  99. if BINARY_NATIVE in (BINARY_POSIX32, BINARY_WIN32):
  100. self.ui.ch_bridged.setText(self.tr("Bridged (64bit)"))
  101. else:
  102. self.ui.ch_bridged.setText(self.tr("Bridged (32bit)"))
  103. if not (LINUX or MACOS):
  104. self.ui.ch_bridged_wine.setChecked(False)
  105. self.ui.ch_bridged_wine.setEnabled(False)
  106. if MACOS:
  107. self.setWindowModality(Qt.WindowModal)
  108. else:
  109. self.ui.ch_au.setChecked(False)
  110. self.ui.ch_au.setEnabled(False)
  111. self.ui.ch_au.setVisible(False)
  112. self.ui.tab_info.tabBar().hide()
  113. self.ui.tab_reqs.tabBar().hide()
  114. # FIXME, why /2 needed?
  115. self.ui.tab_info.setMinimumWidth(int(self.ui.la_id.width()/2) +
  116. fontMetricsHorizontalAdvance(self.ui.l_id.fontMetrics(), "9999999999") + 6*3)
  117. self.setWindowFlags(self.windowFlags() & ~Qt.WindowContextHelpButtonHint)
  118. # ----------------------------------------------------------------------------------------------------
  119. # Load settings
  120. self.loadSettings()
  121. # ----------------------------------------------------------------------------------------------------
  122. # Disable bridges if not enabled in settings
  123. # NOTE: We Assume win32 carla build will not run win64 plugins
  124. if (WINDOWS and not kIs64bit) or not host.showPluginBridges:
  125. self.ui.ch_native.setChecked(True)
  126. self.ui.ch_native.setEnabled(False)
  127. self.ui.ch_native.setVisible(True)
  128. self.ui.ch_bridged.setChecked(False)
  129. self.ui.ch_bridged.setEnabled(False)
  130. self.ui.ch_bridged.setVisible(False)
  131. self.ui.ch_bridged_wine.setChecked(False)
  132. self.ui.ch_bridged_wine.setEnabled(False)
  133. self.ui.ch_bridged_wine.setVisible(False)
  134. elif not host.showWineBridges:
  135. self.ui.ch_bridged_wine.setChecked(False)
  136. self.ui.ch_bridged_wine.setEnabled(False)
  137. self.ui.ch_bridged_wine.setVisible(False)
  138. # ----------------------------------------------------------------------------------------------------
  139. # Set-up Icons
  140. if useSystemIcons:
  141. self.ui.b_add.setIcon(getIcon('list-add', 16, 'svgz'))
  142. self.ui.b_cancel.setIcon(getIcon('dialog-cancel', 16, 'svgz'))
  143. self.ui.b_clear_filters.setIcon(getIcon('edit-clear', 16, 'svgz'))
  144. self.ui.b_refresh.setIcon(getIcon('view-refresh', 16, 'svgz'))
  145. hhi = self.ui.tableWidget.horizontalHeaderItem(self.TABLEWIDGET_ITEM_FAVORITE)
  146. hhi.setIcon(getIcon('bookmarks', 16, 'svgz'))
  147. # ----------------------------------------------------------------------------------------------------
  148. # Set-up connections
  149. self.finished.connect(self.slot_saveSettings)
  150. self.ui.b_add.clicked.connect(self.slot_addPlugin)
  151. self.ui.b_cancel.clicked.connect(self.reject)
  152. self.ui.b_refresh.clicked.connect(self.slot_refreshPlugins)
  153. self.ui.b_clear_filters.clicked.connect(self.slot_clearFilters)
  154. self.ui.lineEdit.textChanged.connect(self.slot_checkFilters)
  155. self.ui.tableWidget.currentCellChanged.connect(self.slot_checkPlugin)
  156. self.ui.tableWidget.cellClicked.connect(self.slot_cellClicked)
  157. self.ui.tableWidget.cellDoubleClicked.connect(self.slot_cellDoubleClicked)
  158. self.ui.ch_internal.clicked.connect(self.slot_checkFilters)
  159. self.ui.ch_ladspa.clicked.connect(self.slot_checkFilters)
  160. self.ui.ch_dssi.clicked.connect(self.slot_checkFilters)
  161. self.ui.ch_lv2.clicked.connect(self.slot_checkFilters)
  162. self.ui.ch_vst.clicked.connect(self.slot_checkFilters)
  163. self.ui.ch_vst3.clicked.connect(self.slot_checkFilters)
  164. self.ui.ch_clap.clicked.connect(self.slot_checkFilters)
  165. self.ui.ch_au.clicked.connect(self.slot_checkFilters)
  166. self.ui.ch_jsfx.clicked.connect(self.slot_checkFilters)
  167. self.ui.ch_kits.clicked.connect(self.slot_checkFilters)
  168. self.ui.ch_effects.clicked.connect(self.slot_checkFilters)
  169. self.ui.ch_instruments.clicked.connect(self.slot_checkFilters)
  170. self.ui.ch_midi.clicked.connect(self.slot_checkFilters)
  171. self.ui.ch_other.clicked.connect(self.slot_checkFilters)
  172. self.ui.ch_native.clicked.connect(self.slot_checkFilters)
  173. self.ui.ch_bridged.clicked.connect(self.slot_checkFilters)
  174. self.ui.ch_bridged_wine.clicked.connect(self.slot_checkFilters)
  175. self.ui.ch_favorites.clicked.connect(self.slot_checkFilters)
  176. self.ui.ch_rtsafe.clicked.connect(self.slot_checkFilters)
  177. self.ui.ch_cv.clicked.connect(self.slot_checkFilters)
  178. self.ui.ch_gui.clicked.connect(self.slot_checkFilters)
  179. self.ui.ch_inline_display.clicked.connect(self.slot_checkFilters)
  180. self.ui.ch_stereo.clicked.connect(self.slot_checkFilters)
  181. self.ui.ch_cat_all.clicked.connect(self.slot_checkFiltersCategoryAll)
  182. self.ui.ch_cat_delay.clicked.connect(self.slot_checkFiltersCategorySpecific)
  183. self.ui.ch_cat_distortion.clicked.connect(self.slot_checkFiltersCategorySpecific)
  184. self.ui.ch_cat_dynamics.clicked.connect(self.slot_checkFiltersCategorySpecific)
  185. self.ui.ch_cat_eq.clicked.connect(self.slot_checkFiltersCategorySpecific)
  186. self.ui.ch_cat_filter.clicked.connect(self.slot_checkFiltersCategorySpecific)
  187. self.ui.ch_cat_modulator.clicked.connect(self.slot_checkFiltersCategorySpecific)
  188. self.ui.ch_cat_synth.clicked.connect(self.slot_checkFiltersCategorySpecific)
  189. self.ui.ch_cat_utility.clicked.connect(self.slot_checkFiltersCategorySpecific)
  190. self.ui.ch_cat_other.clicked.connect(self.slot_checkFiltersCategorySpecific)
  191. # ----------------------------------------------------------------------------------------------------
  192. # Post-connect setup
  193. self._reAddPlugins()
  194. self.slot_focusSearchFieldAndSelectAll()
  195. # --------------------------------------------------------------------------------------------------------
  196. @pyqtSlot(int, int)
  197. def slot_cellClicked(self, row, column):
  198. if column != self.TABLEWIDGET_ITEM_FAVORITE:
  199. return
  200. widget = self.ui.tableWidget.item(row, self.TABLEWIDGET_ITEM_FAVORITE)
  201. plugin = self.ui.tableWidget.item(row, self.TABLEWIDGET_ITEM_NAME).data(Qt.UserRole+1)
  202. plugin = self._createFavoritePluginDict(plugin)
  203. if widget.checkState() == Qt.Checked:
  204. if not plugin in self.fFavoritePlugins:
  205. self.fFavoritePlugins.append(plugin)
  206. self.fFavoritePluginsChanged = True
  207. else:
  208. try:
  209. self.fFavoritePlugins.remove(plugin)
  210. self.fFavoritePluginsChanged = True
  211. except ValueError:
  212. pass
  213. @pyqtSlot(int, int)
  214. def slot_cellDoubleClicked(self, _, column):
  215. if column != self.TABLEWIDGET_ITEM_FAVORITE:
  216. self.slot_addPlugin()
  217. @pyqtSlot()
  218. def slot_focusSearchFieldAndSelectAll(self):
  219. self.ui.lineEdit.setFocus()
  220. self.ui.lineEdit.selectAll()
  221. @pyqtSlot()
  222. def slot_addPlugin(self):
  223. if self.ui.tableWidget.currentRow() >= 0:
  224. self.fRetPlugin = self.ui.tableWidget.item(self.ui.tableWidget.currentRow(),
  225. self.TABLEWIDGET_ITEM_NAME).data(Qt.UserRole+1)
  226. self.accept()
  227. else:
  228. self.reject()
  229. @pyqtSlot(int)
  230. def slot_checkPlugin(self, row):
  231. if row >= 0:
  232. self.ui.b_add.setEnabled(True)
  233. plugin = self.ui.tableWidget.item(row, self.TABLEWIDGET_ITEM_NAME).data(Qt.UserRole+1)
  234. isSynth = bool(plugin['hints'] & PLUGIN_IS_SYNTH)
  235. isEffect = bool(plugin['audio.ins'] > 0 < plugin['audio.outs'] and not isSynth)
  236. isMidi = bool(plugin['audio.ins'] == 0 and
  237. plugin['audio.outs'] == 0 and
  238. plugin['midi.ins'] > 0 < plugin['midi.outs'])
  239. # isKit = bool(plugin['type'] in (PLUGIN_SF2, PLUGIN_SFZ))
  240. # isOther = bool(not (isEffect or isSynth or isMidi or isKit))
  241. if isSynth:
  242. ptype = "Instrument"
  243. elif isEffect:
  244. ptype = "Effect"
  245. elif isMidi:
  246. ptype = "MIDI Plugin"
  247. else:
  248. ptype = "Other"
  249. if plugin['build'] == BINARY_NATIVE:
  250. parch = self.fTrNative
  251. elif plugin['build'] == BINARY_POSIX32:
  252. parch = "posix32"
  253. elif plugin['build'] == BINARY_POSIX64:
  254. parch = "posix64"
  255. elif plugin['build'] == BINARY_WIN32:
  256. parch = "win32"
  257. elif plugin['build'] == BINARY_WIN64:
  258. parch = "win64"
  259. elif plugin['build'] == BINARY_OTHER:
  260. parch = self.tr("Other")
  261. elif plugin['build'] == BINARY_WIN32:
  262. parch = self.tr("Unknown")
  263. self.ui.l_format.setText(getPluginTypeAsString(plugin['type']))
  264. self.ui.l_type.setText(ptype)
  265. self.ui.l_arch.setText(parch)
  266. self.ui.l_id.setText(str(plugin['uniqueId']))
  267. self.ui.l_ains.setText(str(plugin['audio.ins']))
  268. self.ui.l_aouts.setText(str(plugin['audio.outs']))
  269. self.ui.l_cvins.setText(str(plugin['cv.ins']))
  270. self.ui.l_cvouts.setText(str(plugin['cv.outs']))
  271. self.ui.l_mins.setText(str(plugin['midi.ins']))
  272. self.ui.l_mouts.setText(str(plugin['midi.outs']))
  273. self.ui.l_pins.setText(str(plugin['parameters.ins']))
  274. self.ui.l_pouts.setText(str(plugin['parameters.outs']))
  275. self.ui.l_gui.setText(self.fTrYes if plugin['hints'] & PLUGIN_HAS_CUSTOM_UI else self.fTrNo)
  276. self.ui.l_idisp.setText(self.fTrYes if plugin['hints'] & PLUGIN_HAS_INLINE_DISPLAY else self.fTrNo)
  277. self.ui.l_bridged.setText(self.fTrYes if plugin['hints'] & PLUGIN_IS_BRIDGE else self.fTrNo)
  278. self.ui.l_synth.setText(self.fTrYes if isSynth else self.fTrNo)
  279. else:
  280. self.ui.b_add.setEnabled(False)
  281. self.ui.l_format.setText("---")
  282. self.ui.l_type.setText("---")
  283. self.ui.l_arch.setText("---")
  284. self.ui.l_id.setText("---")
  285. self.ui.l_ains.setText("---")
  286. self.ui.l_aouts.setText("---")
  287. self.ui.l_cvins.setText("---")
  288. self.ui.l_cvouts.setText("---")
  289. self.ui.l_mins.setText("---")
  290. self.ui.l_mouts.setText("---")
  291. self.ui.l_pins.setText("---")
  292. self.ui.l_pouts.setText("---")
  293. self.ui.l_gui.setText("---")
  294. self.ui.l_idisp.setText("---")
  295. self.ui.l_bridged.setText("---")
  296. self.ui.l_synth.setText("---")
  297. @pyqtSlot()
  298. def slot_checkFilters(self):
  299. self._checkFilters()
  300. @pyqtSlot(bool)
  301. def slot_checkFiltersCategoryAll(self, clicked):
  302. self.ui.ch_cat_delay.setChecked(not clicked)
  303. self.ui.ch_cat_distortion.setChecked(not clicked)
  304. self.ui.ch_cat_dynamics.setChecked(not clicked)
  305. self.ui.ch_cat_eq.setChecked(not clicked)
  306. self.ui.ch_cat_filter.setChecked(not clicked)
  307. self.ui.ch_cat_modulator.setChecked(not clicked)
  308. self.ui.ch_cat_synth.setChecked(not clicked)
  309. self.ui.ch_cat_utility.setChecked(not clicked)
  310. self.ui.ch_cat_other.setChecked(not clicked)
  311. self._checkFilters()
  312. @pyqtSlot(bool)
  313. def slot_checkFiltersCategorySpecific(self, clicked):
  314. if clicked:
  315. self.ui.ch_cat_all.setChecked(False)
  316. elif not (self.ui.ch_cat_delay.isChecked() or
  317. self.ui.ch_cat_distortion.isChecked() or
  318. self.ui.ch_cat_dynamics.isChecked() or
  319. self.ui.ch_cat_eq.isChecked() or
  320. self.ui.ch_cat_filter.isChecked() or
  321. self.ui.ch_cat_modulator.isChecked() or
  322. self.ui.ch_cat_synth.isChecked() or
  323. self.ui.ch_cat_utility.isChecked() or
  324. self.ui.ch_cat_other.isChecked()):
  325. self.ui.ch_cat_all.setChecked(True)
  326. self._checkFilters()
  327. @pyqtSlot()
  328. def slot_refreshPlugins(self):
  329. if PluginRefreshW(self, self.host, self.fUseSystemIcons, self.hasLoadedLv2Plugins).exec_():
  330. self._reAddPlugins()
  331. if self.fRealParent:
  332. self.fRealParent.setLoadRDFsNeeded()
  333. @pyqtSlot()
  334. def slot_clearFilters(self):
  335. self.blockSignals(True)
  336. self.ui.ch_internal.setChecked(True)
  337. self.ui.ch_ladspa.setChecked(True)
  338. self.ui.ch_dssi.setChecked(True)
  339. self.ui.ch_lv2.setChecked(True)
  340. self.ui.ch_vst.setChecked(True)
  341. self.ui.ch_vst3.setChecked(True)
  342. self.ui.ch_clap.setChecked(True)
  343. self.ui.ch_jsfx.setChecked(True)
  344. self.ui.ch_kits.setChecked(True)
  345. self.ui.ch_instruments.setChecked(True)
  346. self.ui.ch_effects.setChecked(True)
  347. self.ui.ch_midi.setChecked(True)
  348. self.ui.ch_other.setChecked(True)
  349. self.ui.ch_native.setChecked(True)
  350. self.ui.ch_bridged.setChecked(False)
  351. self.ui.ch_bridged_wine.setChecked(False)
  352. self.ui.ch_favorites.setChecked(False)
  353. self.ui.ch_rtsafe.setChecked(False)
  354. self.ui.ch_stereo.setChecked(False)
  355. self.ui.ch_cv.setChecked(False)
  356. self.ui.ch_gui.setChecked(False)
  357. self.ui.ch_inline_display.setChecked(False)
  358. if self.ui.ch_au.isEnabled():
  359. self.ui.ch_au.setChecked(True)
  360. self.ui.ch_cat_all.setChecked(True)
  361. self.ui.ch_cat_delay.setChecked(False)
  362. self.ui.ch_cat_distortion.setChecked(False)
  363. self.ui.ch_cat_dynamics.setChecked(False)
  364. self.ui.ch_cat_eq.setChecked(False)
  365. self.ui.ch_cat_filter.setChecked(False)
  366. self.ui.ch_cat_modulator.setChecked(False)
  367. self.ui.ch_cat_synth.setChecked(False)
  368. self.ui.ch_cat_utility.setChecked(False)
  369. self.ui.ch_cat_other.setChecked(False)
  370. self.ui.lineEdit.clear()
  371. self.blockSignals(False)
  372. self._checkFilters()
  373. # --------------------------------------------------------------------------------------------------------
  374. @pyqtSlot()
  375. def slot_saveSettings(self):
  376. settings = QSafeSettings("falkTX", "CarlaDatabase2")
  377. settings.setValue("PluginDatabase/Geometry", self.saveGeometry())
  378. settings.setValue("PluginDatabase/TableGeometry_6", self.ui.tableWidget.horizontalHeader().saveState())
  379. settings.setValue("PluginDatabase/ShowEffects", self.ui.ch_effects.isChecked())
  380. settings.setValue("PluginDatabase/ShowInstruments", self.ui.ch_instruments.isChecked())
  381. settings.setValue("PluginDatabase/ShowMIDI", self.ui.ch_midi.isChecked())
  382. settings.setValue("PluginDatabase/ShowOther", self.ui.ch_other.isChecked())
  383. settings.setValue("PluginDatabase/ShowInternal", self.ui.ch_internal.isChecked())
  384. settings.setValue("PluginDatabase/ShowLADSPA", self.ui.ch_ladspa.isChecked())
  385. settings.setValue("PluginDatabase/ShowDSSI", self.ui.ch_dssi.isChecked())
  386. settings.setValue("PluginDatabase/ShowLV2", self.ui.ch_lv2.isChecked())
  387. settings.setValue("PluginDatabase/ShowVST2", self.ui.ch_vst.isChecked())
  388. settings.setValue("PluginDatabase/ShowVST3", self.ui.ch_vst3.isChecked())
  389. settings.setValue("PluginDatabase/ShowCLAP", self.ui.ch_clap.isChecked())
  390. settings.setValue("PluginDatabase/ShowAU", self.ui.ch_au.isChecked())
  391. settings.setValue("PluginDatabase/ShowJSFX", self.ui.ch_jsfx.isChecked())
  392. settings.setValue("PluginDatabase/ShowKits", self.ui.ch_kits.isChecked())
  393. settings.setValue("PluginDatabase/ShowNative", self.ui.ch_native.isChecked())
  394. settings.setValue("PluginDatabase/ShowBridged", self.ui.ch_bridged.isChecked())
  395. settings.setValue("PluginDatabase/ShowBridgedWine", self.ui.ch_bridged_wine.isChecked())
  396. settings.setValue("PluginDatabase/ShowFavorites", self.ui.ch_favorites.isChecked())
  397. settings.setValue("PluginDatabase/ShowRtSafe", self.ui.ch_rtsafe.isChecked())
  398. settings.setValue("PluginDatabase/ShowHasCV", self.ui.ch_cv.isChecked())
  399. settings.setValue("PluginDatabase/ShowHasGUI", self.ui.ch_gui.isChecked())
  400. settings.setValue("PluginDatabase/ShowHasInlineDisplay", self.ui.ch_inline_display.isChecked())
  401. settings.setValue("PluginDatabase/ShowStereoOnly", self.ui.ch_stereo.isChecked())
  402. settings.setValue("PluginDatabase/SearchText", self.ui.lineEdit.text())
  403. if self.ui.ch_cat_all.isChecked():
  404. settings.setValue("PluginDatabase/ShowCategory", "all")
  405. else:
  406. categories = ""
  407. if self.ui.ch_cat_delay.isChecked():
  408. categories += ":delay"
  409. if self.ui.ch_cat_distortion.isChecked():
  410. categories += ":distortion"
  411. if self.ui.ch_cat_dynamics.isChecked():
  412. categories += ":dynamics"
  413. if self.ui.ch_cat_eq.isChecked():
  414. categories += ":eq"
  415. if self.ui.ch_cat_filter.isChecked():
  416. categories += ":filter"
  417. if self.ui.ch_cat_modulator.isChecked():
  418. categories += ":modulator"
  419. if self.ui.ch_cat_synth.isChecked():
  420. categories += ":synth"
  421. if self.ui.ch_cat_utility.isChecked():
  422. categories += ":utility"
  423. if self.ui.ch_cat_other.isChecked():
  424. categories += ":other"
  425. if categories:
  426. categories += ":"
  427. settings.setValue("PluginDatabase/ShowCategory", categories)
  428. if self.fFavoritePluginsChanged:
  429. settings.setValue("PluginDatabase/Favorites", self.fFavoritePlugins)
  430. # --------------------------------------------------------------------------------------------------------
  431. def loadSettings(self):
  432. settings = QSafeSettings("falkTX", "CarlaDatabase2")
  433. self.fFavoritePlugins = settings.value("PluginDatabase/Favorites", [], list)
  434. self.fFavoritePluginsChanged = False
  435. self.restoreGeometry(settings.value("PluginDatabase/Geometry", QByteArray(), QByteArray))
  436. self.ui.ch_effects.setChecked(settings.value("PluginDatabase/ShowEffects", True, bool))
  437. self.ui.ch_instruments.setChecked(settings.value("PluginDatabase/ShowInstruments", True, bool))
  438. self.ui.ch_midi.setChecked(settings.value("PluginDatabase/ShowMIDI", True, bool))
  439. self.ui.ch_other.setChecked(settings.value("PluginDatabase/ShowOther", True, bool))
  440. self.ui.ch_internal.setChecked(settings.value("PluginDatabase/ShowInternal", True, bool))
  441. self.ui.ch_ladspa.setChecked(settings.value("PluginDatabase/ShowLADSPA", True, bool))
  442. self.ui.ch_dssi.setChecked(settings.value("PluginDatabase/ShowDSSI", True, bool))
  443. self.ui.ch_lv2.setChecked(settings.value("PluginDatabase/ShowLV2", True, bool))
  444. self.ui.ch_vst.setChecked(settings.value("PluginDatabase/ShowVST2", True, bool))
  445. self.ui.ch_vst3.setChecked(settings.value("PluginDatabase/ShowVST3", True, bool))
  446. self.ui.ch_clap.setChecked(settings.value("PluginDatabase/ShowCLAP", True, bool))
  447. self.ui.ch_au.setChecked(settings.value("PluginDatabase/ShowAU", MACOS, bool))
  448. self.ui.ch_jsfx.setChecked(settings.value("PluginDatabase/ShowJSFX", True, bool))
  449. self.ui.ch_kits.setChecked(settings.value("PluginDatabase/ShowKits", True, bool))
  450. self.ui.ch_native.setChecked(settings.value("PluginDatabase/ShowNative", True, bool))
  451. self.ui.ch_bridged.setChecked(settings.value("PluginDatabase/ShowBridged", True, bool))
  452. self.ui.ch_bridged_wine.setChecked(settings.value("PluginDatabase/ShowBridgedWine", True, bool))
  453. self.ui.ch_favorites.setChecked(settings.value("PluginDatabase/ShowFavorites", False, bool))
  454. self.ui.ch_rtsafe.setChecked(settings.value("PluginDatabase/ShowRtSafe", False, bool))
  455. self.ui.ch_cv.setChecked(settings.value("PluginDatabase/ShowHasCV", False, bool))
  456. self.ui.ch_gui.setChecked(settings.value("PluginDatabase/ShowHasGUI", False, bool))
  457. self.ui.ch_inline_display.setChecked(settings.value("PluginDatabase/ShowHasInlineDisplay", False, bool))
  458. self.ui.ch_stereo.setChecked(settings.value("PluginDatabase/ShowStereoOnly", False, bool))
  459. self.ui.lineEdit.setText(settings.value("PluginDatabase/SearchText", "", str))
  460. categories = settings.value("PluginDatabase/ShowCategory", "all", str)
  461. if categories == "all" or len(categories) < 2:
  462. self.ui.ch_cat_all.setChecked(True)
  463. self.ui.ch_cat_delay.setChecked(False)
  464. self.ui.ch_cat_distortion.setChecked(False)
  465. self.ui.ch_cat_dynamics.setChecked(False)
  466. self.ui.ch_cat_eq.setChecked(False)
  467. self.ui.ch_cat_filter.setChecked(False)
  468. self.ui.ch_cat_modulator.setChecked(False)
  469. self.ui.ch_cat_synth.setChecked(False)
  470. self.ui.ch_cat_utility.setChecked(False)
  471. self.ui.ch_cat_other.setChecked(False)
  472. else:
  473. self.ui.ch_cat_all.setChecked(False)
  474. self.ui.ch_cat_delay.setChecked(":delay:" in categories)
  475. self.ui.ch_cat_distortion.setChecked(":distortion:" in categories)
  476. self.ui.ch_cat_dynamics.setChecked(":dynamics:" in categories)
  477. self.ui.ch_cat_eq.setChecked(":eq:" in categories)
  478. self.ui.ch_cat_filter.setChecked(":filter:" in categories)
  479. self.ui.ch_cat_modulator.setChecked(":modulator:" in categories)
  480. self.ui.ch_cat_synth.setChecked(":synth:" in categories)
  481. self.ui.ch_cat_utility.setChecked(":utility:" in categories)
  482. self.ui.ch_cat_other.setChecked(":other:" in categories)
  483. tableGeometry = settings.value("PluginDatabase/TableGeometry_6", QByteArray(), QByteArray)
  484. horizontalHeader = self.ui.tableWidget.horizontalHeader()
  485. if not tableGeometry.isNull():
  486. horizontalHeader.restoreState(tableGeometry)
  487. else:
  488. self.ui.tableWidget.setColumnWidth(self.TABLEWIDGET_ITEM_NAME, 250)
  489. self.ui.tableWidget.setColumnWidth(self.TABLEWIDGET_ITEM_LABEL, 200)
  490. self.ui.tableWidget.setColumnWidth(self.TABLEWIDGET_ITEM_MAKER, 150)
  491. self.ui.tableWidget.sortByColumn(self.TABLEWIDGET_ITEM_NAME, Qt.AscendingOrder)
  492. horizontalHeader.setSectionResizeMode(self.TABLEWIDGET_ITEM_FAVORITE, QHeaderView.Fixed)
  493. self.ui.tableWidget.setColumnWidth(self.TABLEWIDGET_ITEM_FAVORITE, 24)
  494. self.ui.tableWidget.setSortingEnabled(True)
  495. # --------------------------------------------------------------------------------------------------------
  496. def _createFavoritePluginDict(self, plugin):
  497. return {
  498. 'name' : plugin['name'],
  499. 'build' : plugin['build'],
  500. 'type' : plugin['type'],
  501. 'filename': plugin['filename'],
  502. 'label' : plugin['label'],
  503. 'uniqueId': plugin['uniqueId'],
  504. }
  505. def _checkFilters(self):
  506. text = self.ui.lineEdit.text().lower()
  507. hideEffects = not self.ui.ch_effects.isChecked()
  508. hideInstruments = not self.ui.ch_instruments.isChecked()
  509. hideMidi = not self.ui.ch_midi.isChecked()
  510. hideOther = not self.ui.ch_other.isChecked()
  511. hideInternal = not self.ui.ch_internal.isChecked()
  512. hideLadspa = not self.ui.ch_ladspa.isChecked()
  513. hideDssi = not self.ui.ch_dssi.isChecked()
  514. hideLV2 = not self.ui.ch_lv2.isChecked()
  515. hideVST2 = not self.ui.ch_vst.isChecked()
  516. hideVST3 = not self.ui.ch_vst3.isChecked()
  517. hideCLAP = not self.ui.ch_clap.isChecked()
  518. hideAU = not self.ui.ch_au.isChecked()
  519. hideJSFX = not self.ui.ch_jsfx.isChecked()
  520. hideKits = not self.ui.ch_kits.isChecked()
  521. hideNative = not self.ui.ch_native.isChecked()
  522. hideBridged = not self.ui.ch_bridged.isChecked()
  523. hideBridgedWine = not self.ui.ch_bridged_wine.isChecked()
  524. hideNonFavs = self.ui.ch_favorites.isChecked()
  525. hideNonRtSafe = self.ui.ch_rtsafe.isChecked()
  526. hideNonCV = self.ui.ch_cv.isChecked()
  527. hideNonGui = self.ui.ch_gui.isChecked()
  528. hideNonIDisp = self.ui.ch_inline_display.isChecked()
  529. hideNonStereo = self.ui.ch_stereo.isChecked()
  530. if HAIKU or LINUX or MACOS:
  531. nativeBins = [BINARY_POSIX32, BINARY_POSIX64]
  532. wineBins = [BINARY_WIN32, BINARY_WIN64]
  533. elif WINDOWS:
  534. nativeBins = [BINARY_WIN32, BINARY_WIN64]
  535. wineBins = []
  536. else:
  537. nativeBins = []
  538. wineBins = []
  539. self.ui.tableWidget.setRowCount(self.fLastTableIndex)
  540. for i in range(self.fLastTableIndex):
  541. plugin = self.ui.tableWidget.item(i, self.TABLEWIDGET_ITEM_NAME).data(Qt.UserRole+1)
  542. ptext = self.ui.tableWidget.item(i, self.TABLEWIDGET_ITEM_NAME).data(Qt.UserRole+2)
  543. aIns = plugin['audio.ins']
  544. aOuts = plugin['audio.outs']
  545. cvIns = plugin['cv.ins']
  546. cvOuts = plugin['cv.outs']
  547. mIns = plugin['midi.ins']
  548. mOuts = plugin['midi.outs']
  549. phints = plugin['hints']
  550. ptype = plugin['type']
  551. categ = plugin['category']
  552. isSynth = bool(phints & PLUGIN_IS_SYNTH)
  553. isEffect = bool(aIns > 0 < aOuts and not isSynth)
  554. isMidi = bool(aIns == 0 and aOuts == 0 and mIns > 0 < mOuts)
  555. isKit = bool(ptype in (PLUGIN_SF2, PLUGIN_SFZ))
  556. isOther = bool(not (isEffect or isSynth or isMidi or isKit))
  557. isNative = bool(plugin['build'] == BINARY_NATIVE)
  558. isRtSafe = bool(phints & PLUGIN_IS_RTSAFE)
  559. isStereo = bool((aIns == 2 and aOuts == 2) or (isSynth and aOuts == 2))
  560. hasCV = bool(cvIns + cvOuts > 0)
  561. hasGui = bool(phints & PLUGIN_HAS_CUSTOM_UI)
  562. hasIDisp = bool(phints & PLUGIN_HAS_INLINE_DISPLAY)
  563. isBridged = bool(not isNative and plugin['build'] in nativeBins)
  564. isBridgedWine = bool(not isNative and plugin['build'] in wineBins)
  565. if hideEffects and isEffect:
  566. self.ui.tableWidget.hideRow(i)
  567. elif hideInstruments and isSynth:
  568. self.ui.tableWidget.hideRow(i)
  569. elif hideMidi and isMidi:
  570. self.ui.tableWidget.hideRow(i)
  571. elif hideOther and isOther:
  572. self.ui.tableWidget.hideRow(i)
  573. elif hideKits and isKit:
  574. self.ui.tableWidget.hideRow(i)
  575. elif hideInternal and ptype == PLUGIN_INTERNAL:
  576. self.ui.tableWidget.hideRow(i)
  577. elif hideLadspa and ptype == PLUGIN_LADSPA:
  578. self.ui.tableWidget.hideRow(i)
  579. elif hideDssi and ptype == PLUGIN_DSSI:
  580. self.ui.tableWidget.hideRow(i)
  581. elif hideLV2 and ptype == PLUGIN_LV2:
  582. self.ui.tableWidget.hideRow(i)
  583. elif hideVST2 and ptype == PLUGIN_VST2:
  584. self.ui.tableWidget.hideRow(i)
  585. elif hideVST3 and ptype == PLUGIN_VST3:
  586. self.ui.tableWidget.hideRow(i)
  587. elif hideCLAP and ptype == PLUGIN_CLAP:
  588. self.ui.tableWidget.hideRow(i)
  589. elif hideAU and ptype == PLUGIN_AU:
  590. self.ui.tableWidget.hideRow(i)
  591. elif hideJSFX and ptype == PLUGIN_JSFX:
  592. self.ui.tableWidget.hideRow(i)
  593. elif hideNative and isNative:
  594. self.ui.tableWidget.hideRow(i)
  595. elif hideBridged and isBridged:
  596. self.ui.tableWidget.hideRow(i)
  597. elif hideBridgedWine and isBridgedWine:
  598. self.ui.tableWidget.hideRow(i)
  599. elif hideNonRtSafe and not isRtSafe:
  600. self.ui.tableWidget.hideRow(i)
  601. elif hideNonCV and not hasCV:
  602. self.ui.tableWidget.hideRow(i)
  603. elif hideNonGui and not hasGui:
  604. self.ui.tableWidget.hideRow(i)
  605. elif hideNonIDisp and not hasIDisp:
  606. self.ui.tableWidget.hideRow(i)
  607. elif hideNonStereo and not isStereo:
  608. self.ui.tableWidget.hideRow(i)
  609. elif text and not all(t in ptext for t in text.strip().split(' ')):
  610. self.ui.tableWidget.hideRow(i)
  611. elif hideNonFavs and self._createFavoritePluginDict(plugin) not in self.fFavoritePlugins:
  612. self.ui.tableWidget.hideRow(i)
  613. elif (self.ui.ch_cat_all.isChecked() or
  614. (self.ui.ch_cat_delay.isChecked() and categ == "delay") or
  615. (self.ui.ch_cat_distortion.isChecked() and categ == "distortion") or
  616. (self.ui.ch_cat_dynamics.isChecked() and categ == "dynamics") or
  617. (self.ui.ch_cat_eq.isChecked() and categ == "eq") or
  618. (self.ui.ch_cat_filter.isChecked() and categ == "filter") or
  619. (self.ui.ch_cat_modulator.isChecked() and categ == "modulator") or
  620. (self.ui.ch_cat_synth.isChecked() and categ == "synth") or
  621. (self.ui.ch_cat_utility.isChecked() and categ == "utility") or
  622. (self.ui.ch_cat_other.isChecked() and categ == "other")):
  623. self.ui.tableWidget.showRow(i)
  624. else:
  625. self.ui.tableWidget.hideRow(i)
  626. # --------------------------------------------------------------------------------------------------------
  627. def _addPluginToTable(self, plugin, ptype):
  628. if plugin['API'] != PLUGIN_QUERY_API_VERSION:
  629. return
  630. if ptype in (PLUGIN_INTERNAL, PLUGIN_LV2, PLUGIN_SF2, PLUGIN_SFZ, PLUGIN_JSFX):
  631. plugin['build'] = BINARY_NATIVE
  632. index = self.fLastTableIndex
  633. isFav = bool(self._createFavoritePluginDict(plugin) in self.fFavoritePlugins)
  634. itemFav = QTableWidgetItem()
  635. itemFav.setCheckState(Qt.Checked if isFav else Qt.Unchecked)
  636. itemFav.setText(" " if isFav else " ")
  637. pluginText = (plugin['name']+plugin['label']+plugin['maker']+plugin['filename']).lower()
  638. self.ui.tableWidget.setItem(index, self.TABLEWIDGET_ITEM_FAVORITE, itemFav)
  639. self.ui.tableWidget.setItem(index, self.TABLEWIDGET_ITEM_NAME, QTableWidgetItem(plugin['name']))
  640. self.ui.tableWidget.setItem(index, self.TABLEWIDGET_ITEM_LABEL, QTableWidgetItem(plugin['label']))
  641. self.ui.tableWidget.setItem(index, self.TABLEWIDGET_ITEM_MAKER, QTableWidgetItem(plugin['maker']))
  642. self.ui.tableWidget.setItem(index, self.TABLEWIDGET_ITEM_BINARY, QTableWidgetItem(os.path.basename(plugin['filename'])))
  643. itemName = self.ui.tableWidget.item(index, self.TABLEWIDGET_ITEM_NAME)
  644. itemName.setData(Qt.UserRole+1, plugin)
  645. itemName.setData(Qt.UserRole+2, pluginText)
  646. self.fLastTableIndex += 1
  647. # --------------------------------------------------------------------------------------------------------
  648. def _reAddInternalHelper(self, settingsDB, ptype, path):
  649. if ptype == PLUGIN_INTERNAL:
  650. ptypeStr = "Internal"
  651. ptypeStrTr = self.tr("Internal")
  652. elif ptype == PLUGIN_LV2:
  653. ptypeStr = "LV2"
  654. ptypeStrTr = ptypeStr
  655. elif ptype == PLUGIN_AU:
  656. ptypeStr = "AU"
  657. ptypeStrTr = ptypeStr
  658. #elif ptype == PLUGIN_SFZ:
  659. #ptypeStr = "SFZ"
  660. #ptypeStrTr = ptypeStr
  661. # TODO(jsfx) what to do here?
  662. else:
  663. return 0
  664. plugins = settingsDB.value("Plugins/" + ptypeStr, [], list)
  665. pluginCount = settingsDB.value("PluginCount/" + ptypeStr, 0, int)
  666. if ptype == PLUGIN_AU:
  667. gCarla.utils.juce_init()
  668. pluginCountNew = gCarla.utils.get_cached_plugin_count(ptype, path)
  669. if pluginCountNew != pluginCount or len(plugins) != pluginCount or (len(plugins) > 0 and plugins[0]['API'] != PLUGIN_QUERY_API_VERSION):
  670. plugins = []
  671. pluginCount = pluginCountNew
  672. QApplication.processEvents(QEventLoop.ExcludeUserInputEvents, 50)
  673. if ptype == PLUGIN_AU:
  674. gCarla.utils.juce_idle()
  675. for i in range(pluginCountNew):
  676. descInfo = gCarla.utils.get_cached_plugin_info(ptype, i)
  677. if not descInfo['valid']:
  678. continue
  679. info = checkPluginCached(descInfo, ptype)
  680. plugins.append(info)
  681. if i % 50 == 0:
  682. QApplication.processEvents(QEventLoop.ExcludeUserInputEvents, 50)
  683. if ptype == PLUGIN_AU:
  684. gCarla.utils.juce_idle()
  685. settingsDB.setValue("Plugins/" + ptypeStr, plugins)
  686. settingsDB.setValue("PluginCount/" + ptypeStr, pluginCount)
  687. if ptype == PLUGIN_AU:
  688. gCarla.utils.juce_cleanup()
  689. # prepare rows in advance
  690. self.ui.tableWidget.setRowCount(self.fLastTableIndex + len(plugins))
  691. for plugin in plugins:
  692. self._addPluginToTable(plugin, ptype)
  693. return pluginCount
  694. def _reAddPlugins(self):
  695. settingsDB = QSafeSettings("falkTX", "CarlaPlugins5")
  696. self.fLastTableIndex = 0
  697. self.ui.tableWidget.setSortingEnabled(False)
  698. self.ui.tableWidget.clearContents()
  699. settings = QSafeSettings("falkTX", "Carla2")
  700. LV2_PATH = splitter.join(settings.value(CARLA_KEY_PATHS_LV2, CARLA_DEFAULT_LV2_PATH, list))
  701. del settings
  702. # ----------------------------------------------------------------------------------------------------
  703. # plugins handled through backend
  704. internalCount = self._reAddInternalHelper(settingsDB, PLUGIN_INTERNAL, "")
  705. lv2Count = self._reAddInternalHelper(settingsDB, PLUGIN_LV2, LV2_PATH)
  706. auCount = self._reAddInternalHelper(settingsDB, PLUGIN_AU, "") if MACOS else 0
  707. # ----------------------------------------------------------------------------------------------------
  708. # LADSPA
  709. ladspaPlugins = []
  710. ladspaPlugins += settingsDB.value("Plugins/LADSPA_native", [], list)
  711. ladspaPlugins += settingsDB.value("Plugins/LADSPA_posix32", [], list)
  712. ladspaPlugins += settingsDB.value("Plugins/LADSPA_posix64", [], list)
  713. ladspaPlugins += settingsDB.value("Plugins/LADSPA_win32", [], list)
  714. ladspaPlugins += settingsDB.value("Plugins/LADSPA_win64", [], list)
  715. # ----------------------------------------------------------------------------------------------------
  716. # DSSI
  717. dssiPlugins = []
  718. dssiPlugins += settingsDB.value("Plugins/DSSI_native", [], list)
  719. dssiPlugins += settingsDB.value("Plugins/DSSI_posix32", [], list)
  720. dssiPlugins += settingsDB.value("Plugins/DSSI_posix64", [], list)
  721. dssiPlugins += settingsDB.value("Plugins/DSSI_win32", [], list)
  722. dssiPlugins += settingsDB.value("Plugins/DSSI_win64", [], list)
  723. # ----------------------------------------------------------------------------------------------------
  724. # VST2
  725. vst2Plugins = []
  726. vst2Plugins += settingsDB.value("Plugins/VST2_native", [], list)
  727. vst2Plugins += settingsDB.value("Plugins/VST2_posix32", [], list)
  728. vst2Plugins += settingsDB.value("Plugins/VST2_posix64", [], list)
  729. vst2Plugins += settingsDB.value("Plugins/VST2_win32", [], list)
  730. vst2Plugins += settingsDB.value("Plugins/VST2_win64", [], list)
  731. # ----------------------------------------------------------------------------------------------------
  732. # VST3
  733. vst3Plugins = []
  734. vst3Plugins += settingsDB.value("Plugins/VST3_native", [], list)
  735. vst3Plugins += settingsDB.value("Plugins/VST3_posix32", [], list)
  736. vst3Plugins += settingsDB.value("Plugins/VST3_posix64", [], list)
  737. vst3Plugins += settingsDB.value("Plugins/VST3_win32", [], list)
  738. vst3Plugins += settingsDB.value("Plugins/VST3_win64", [], list)
  739. # ----------------------------------------------------------------------------------------------------
  740. # CLAP
  741. clapPlugins = []
  742. clapPlugins += settingsDB.value("Plugins/CLAP_native", [], list)
  743. clapPlugins += settingsDB.value("Plugins/CLAP_posix32", [], list)
  744. clapPlugins += settingsDB.value("Plugins/CLAP_posix64", [], list)
  745. clapPlugins += settingsDB.value("Plugins/CLAP_win32", [], list)
  746. clapPlugins += settingsDB.value("Plugins/CLAP_win64", [], list)
  747. # ----------------------------------------------------------------------------------------------------
  748. # AU (extra non-cached)
  749. auPlugins32 = settingsDB.value("Plugins/AU_posix32", [], list) if MACOS else []
  750. # ----------------------------------------------------------------------------------------------------
  751. # JSFX
  752. jsfxPlugins = settingsDB.value("Plugins/JSFX", [], list)
  753. # ----------------------------------------------------------------------------------------------------
  754. # Kits
  755. sf2s = settingsDB.value("Plugins/SF2", [], list)
  756. sfzs = settingsDB.value("Plugins/SFZ", [], list)
  757. # ----------------------------------------------------------------------------------------------------
  758. # count plugins first, so we can create rows in advance
  759. ladspaCount = 0
  760. dssiCount = 0
  761. vstCount = 0
  762. vst3Count = 0
  763. clapCount = 0
  764. au32Count = 0
  765. jsfxCount = len(jsfxPlugins)
  766. sf2Count = 0
  767. sfzCount = len(sfzs)
  768. for plugins in ladspaPlugins:
  769. ladspaCount += len(plugins)
  770. for plugins in dssiPlugins:
  771. dssiCount += len(plugins)
  772. for plugins in vst2Plugins:
  773. vstCount += len(plugins)
  774. for plugins in vst3Plugins:
  775. vst3Count += len(plugins)
  776. for plugins in clapPlugins:
  777. clapCount += len(plugins)
  778. for plugins in auPlugins32:
  779. au32Count += len(plugins)
  780. for plugins in sf2s:
  781. sf2Count += len(plugins)
  782. self.ui.tableWidget.setRowCount(self.fLastTableIndex +
  783. ladspaCount + dssiCount + vstCount + vst3Count + clapCount +
  784. auCount + au32Count + jsfxCount + sf2Count + sfzCount)
  785. if MACOS:
  786. self.ui.label.setText(self.tr("Have %i Internal, %i LADSPA, %i DSSI, %i LV2, %i VST2, %i VST3, %i CLAP, %i AudioUnit and %i JSFX plugins, plus %i Sound Kits" % (
  787. internalCount, ladspaCount, dssiCount, lv2Count, vstCount, vst3Count, clapCount, auCount+au32Count, jsfxCount, sf2Count+sfzCount)))
  788. else:
  789. self.ui.label.setText(self.tr("Have %i Internal, %i LADSPA, %i DSSI, %i LV2, %i VST2, %i VST3, %i CLAP and %i JSFX plugins, plus %i Sound Kits" % (
  790. internalCount, ladspaCount, dssiCount, lv2Count, vstCount, vst3Count, clapCount, jsfxCount, sf2Count+sfzCount)))
  791. # ----------------------------------------------------------------------------------------------------
  792. # now add all plugins to the table
  793. for plugins in ladspaPlugins:
  794. for plugin in plugins:
  795. self._addPluginToTable(plugin, PLUGIN_LADSPA)
  796. for plugins in dssiPlugins:
  797. for plugin in plugins:
  798. self._addPluginToTable(plugin, PLUGIN_DSSI)
  799. for plugins in vst2Plugins:
  800. for plugin in plugins:
  801. self._addPluginToTable(plugin, PLUGIN_VST2)
  802. for plugins in vst3Plugins:
  803. for plugin in plugins:
  804. self._addPluginToTable(plugin, PLUGIN_VST3)
  805. for plugins in clapPlugins:
  806. for plugin in plugins:
  807. self._addPluginToTable(plugin, PLUGIN_CLAP)
  808. for plugins in auPlugins32:
  809. for plugin in plugins:
  810. self._addPluginToTable(plugin, PLUGIN_AU)
  811. for plugin in jsfxPlugins:
  812. self._addPluginToTable(plugin, PLUGIN_JSFX)
  813. for sf2 in sf2s:
  814. for sf2_i in sf2:
  815. self._addPluginToTable(sf2_i, PLUGIN_SF2)
  816. for sfz in sfzs:
  817. self._addPluginToTable(sfz, PLUGIN_SFZ)
  818. # ----------------------------------------------------------------------------------------------------
  819. self.ui.tableWidget.setSortingEnabled(True)
  820. self._checkFilters()
  821. self.slot_checkPlugin(self.ui.tableWidget.currentRow())
  822. # --------------------------------------------------------------------------------------------------------
  823. def showEvent(self, event):
  824. self.slot_focusSearchFieldAndSelectAll()
  825. QDialog.showEvent(self, event)
  826. # ---------------------------------------------------------------------------------------------------------------------
  827. # Testing
  828. if __name__ == '__main__':
  829. import sys
  830. class _host:
  831. pathBinaries = ""
  832. showPluginBridges = False
  833. showWineBridges = False
  834. _host = _host()
  835. _app = QApplication(sys.argv)
  836. _gui = PluginListDialog(None, _host, True)
  837. if _gui.exec_():
  838. print(f"Result: {_gui.fRetPlugin}")
  839. # ---------------------------------------------------------------------------------------------------------------------