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.

848 lines
28KB

  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 pyqtSignal, QThread
  21. from PyQt5.QtWidgets import QWidget
  22. # ---------------------------------------------------------------------------------------------------------------------
  23. # Imports (Custom)
  24. from carla_backend import (
  25. PLUGIN_AU,
  26. PLUGIN_DSSI,
  27. PLUGIN_JSFX,
  28. PLUGIN_LADSPA,
  29. PLUGIN_LV2,
  30. PLUGIN_SFZ,
  31. PLUGIN_VST2,
  32. PLUGIN_CLAP,
  33. )
  34. from carla_shared import (
  35. CARLA_DEFAULT_DSSI_PATH,
  36. CARLA_DEFAULT_JSFX_PATH,
  37. CARLA_DEFAULT_LADSPA_PATH,
  38. CARLA_DEFAULT_LV2_PATH,
  39. CARLA_DEFAULT_SF2_PATH,
  40. CARLA_DEFAULT_SFZ_PATH,
  41. CARLA_DEFAULT_VST2_PATH,
  42. CARLA_DEFAULT_VST3_PATH,
  43. CARLA_DEFAULT_CLAP_PATH,
  44. CARLA_DEFAULT_WINE_AUTO_PREFIX,
  45. CARLA_DEFAULT_WINE_EXECUTABLE,
  46. CARLA_DEFAULT_WINE_FALLBACK_PREFIX,
  47. CARLA_KEY_PATHS_DSSI,
  48. CARLA_KEY_PATHS_JSFX,
  49. CARLA_KEY_PATHS_LADSPA,
  50. CARLA_KEY_PATHS_LV2,
  51. CARLA_KEY_PATHS_SF2,
  52. CARLA_KEY_PATHS_SFZ,
  53. CARLA_KEY_PATHS_VST2,
  54. CARLA_KEY_PATHS_VST3,
  55. CARLA_KEY_PATHS_CLAP,
  56. CARLA_KEY_WINE_AUTO_PREFIX,
  57. CARLA_KEY_WINE_EXECUTABLE,
  58. CARLA_KEY_WINE_FALLBACK_PREFIX,
  59. HAIKU,
  60. LINUX,
  61. MACOS,
  62. WINDOWS,
  63. gCarla,
  64. splitter,
  65. )
  66. from utils import QSafeSettings
  67. from .discovery import (
  68. checkAllPluginsAU,
  69. checkFileSF2,
  70. checkPluginCached,
  71. checkPluginDSSI,
  72. checkPluginLADSPA,
  73. checkPluginVST2,
  74. checkPluginVST3,
  75. checkPluginCLAP,
  76. findBinaries,
  77. findFilenames,
  78. findMacVSTBundles,
  79. findVST3Binaries,
  80. findCLAPBinaries
  81. )
  82. # ---------------------------------------------------------------------------------------------------------------------
  83. # Separate Thread for Plugin Search
  84. class SearchPluginsThread(QThread):
  85. pluginLook = pyqtSignal(float, str)
  86. def __init__(self, parent: QWidget, pathBinaries: str):
  87. QThread.__init__(self, parent)
  88. self.fContinueChecking = False
  89. self.fPathBinaries = pathBinaries
  90. self.fCheckNative = False
  91. self.fCheckPosix32 = False
  92. self.fCheckPosix64 = False
  93. self.fCheckWin32 = False
  94. self.fCheckWin64 = False
  95. self.fCheckLADSPA = False
  96. self.fCheckDSSI = False
  97. self.fCheckLV2 = False
  98. self.fCheckVST2 = False
  99. self.fCheckVST3 = False
  100. self.fCheckCLAP = False
  101. self.fCheckAU = False
  102. self.fCheckSF2 = False
  103. self.fCheckSFZ = False
  104. self.fCheckJSFX = False
  105. if WINDOWS:
  106. toolNative = "carla-discovery-native.exe"
  107. self.fWineSettings = None
  108. else:
  109. toolNative = "carla-discovery-native"
  110. settings = QSafeSettings("falkTX", "Carla2")
  111. self.fWineSettings = {
  112. 'executable' : settings.value(CARLA_KEY_WINE_EXECUTABLE,
  113. CARLA_DEFAULT_WINE_EXECUTABLE, str),
  114. 'autoPrefix' : settings.value(CARLA_KEY_WINE_AUTO_PREFIX,
  115. CARLA_DEFAULT_WINE_AUTO_PREFIX, bool),
  116. 'fallbackPrefix': settings.value(CARLA_KEY_WINE_FALLBACK_PREFIX,
  117. CARLA_DEFAULT_WINE_FALLBACK_PREFIX, str),
  118. }
  119. del settings
  120. self.fToolNative = os.path.join(pathBinaries, toolNative)
  121. if not os.path.exists(self.fToolNative):
  122. self.fToolNative = ""
  123. self.fCurCount = 0
  124. self.fCurPercentValue = 0
  125. self.fLastCheckValue = 0
  126. self.fSomethingChanged = False
  127. # -----------------------------------------------------------------------------------------------------------------
  128. # public methods
  129. def hasSomethingChanged(self):
  130. return self.fSomethingChanged
  131. def setSearchBinaryTypes(self, native: bool, posix32: bool, posix64: bool, win32: bool, win64: bool):
  132. self.fCheckNative = native
  133. self.fCheckPosix32 = posix32
  134. self.fCheckPosix64 = posix64
  135. self.fCheckWin32 = win32
  136. self.fCheckWin64 = win64
  137. def setSearchPluginTypes(self, ladspa: bool, dssi: bool, lv2: bool, vst2: bool, vst3: bool, clap: bool,
  138. au: bool, sf2: bool, sfz: bool, jsfx: bool):
  139. self.fCheckLADSPA = ladspa
  140. self.fCheckDSSI = dssi
  141. self.fCheckLV2 = lv2
  142. self.fCheckVST2 = vst2
  143. self.fCheckVST3 = vst3
  144. self.fCheckCLAP = clap
  145. self.fCheckAU = au and MACOS
  146. self.fCheckSF2 = sf2
  147. self.fCheckSFZ = sfz
  148. self.fCheckJSFX = jsfx
  149. def stop(self):
  150. self.fContinueChecking = False
  151. # -----------------------------------------------------------------------------------------------------------------
  152. # protected reimplemented methods
  153. def run(self):
  154. settingsDB = QSafeSettings("falkTX", "CarlaPlugins5")
  155. self.fContinueChecking = True
  156. self.fCurCount = 0
  157. if self.fCheckNative and not self.fToolNative:
  158. self.fCheckNative = False
  159. # looking for plugins via external discovery
  160. pluginCount = 0
  161. if self.fCheckLADSPA:
  162. pluginCount += 1
  163. if self.fCheckDSSI:
  164. pluginCount += 1
  165. if self.fCheckVST2:
  166. pluginCount += 1
  167. if self.fCheckVST3:
  168. pluginCount += 1
  169. if self.fCheckCLAP:
  170. pluginCount += 1
  171. # Increase count by the number of externally discoverable plugin types
  172. if self.fCheckNative:
  173. self.fCurCount += pluginCount
  174. if self.fCheckPosix32:
  175. self.fCurCount += pluginCount
  176. if self.fCheckPosix64:
  177. self.fCurCount += pluginCount
  178. if self.fCheckWin32:
  179. self.fCurCount += pluginCount
  180. if self.fCheckWin64:
  181. self.fCurCount += pluginCount
  182. if self.fCheckLV2:
  183. if self.fCheckNative:
  184. self.fCurCount += 1
  185. else:
  186. self.fCheckLV2 = False
  187. if self.fCheckAU:
  188. if self.fCheckNative or self.fCheckPosix32:
  189. self.fCurCount += int(self.fCheckNative) + int(self.fCheckPosix32)
  190. else:
  191. self.fCheckAU = False
  192. if self.fCheckSF2:
  193. if self.fCheckNative:
  194. self.fCurCount += 1
  195. else:
  196. self.fCheckSF2 = False
  197. if self.fCheckSFZ:
  198. if self.fCheckNative:
  199. self.fCurCount += 1
  200. else:
  201. self.fCheckSFZ = False
  202. if self.fCheckJSFX:
  203. if self.fCheckNative:
  204. self.fCurCount += 1
  205. else:
  206. self.fCheckJSFX = False
  207. if self.fCurCount == 0:
  208. return
  209. self.fCurPercentValue = 100.0 / self.fCurCount
  210. self.fLastCheckValue = 0.0
  211. del pluginCount
  212. if HAIKU:
  213. OS = "HAIKU"
  214. elif LINUX:
  215. OS = "LINUX"
  216. elif MACOS:
  217. OS = "MACOS"
  218. elif WINDOWS:
  219. OS = "WINDOWS"
  220. else:
  221. OS = "UNKNOWN"
  222. if not self.fContinueChecking:
  223. return
  224. self.fSomethingChanged = True
  225. if self.fCheckLADSPA:
  226. if self.fCheckNative:
  227. plugins = self._checkLADSPA(OS, self.fToolNative)
  228. settingsDB.setValue("Plugins/LADSPA_native", plugins)
  229. if not self.fContinueChecking:
  230. return
  231. if self.fCheckPosix32:
  232. tool = os.path.join(self.fPathBinaries, "carla-discovery-posix32")
  233. plugins = self._checkLADSPA(OS, tool)
  234. settingsDB.setValue("Plugins/LADSPA_posix32", plugins)
  235. if not self.fContinueChecking:
  236. return
  237. if self.fCheckPosix64:
  238. tool = os.path.join(self.fPathBinaries, "carla-discovery-posix64")
  239. plugins = self._checkLADSPA(OS, tool)
  240. settingsDB.setValue("Plugins/LADSPA_posix64", plugins)
  241. if not self.fContinueChecking:
  242. return
  243. if self.fCheckWin32:
  244. tool = os.path.join(self.fPathBinaries, "carla-discovery-win32.exe")
  245. plugins = self._checkLADSPA("WINDOWS", tool, not WINDOWS)
  246. settingsDB.setValue("Plugins/LADSPA_win32", plugins)
  247. if not self.fContinueChecking:
  248. return
  249. if self.fCheckWin64:
  250. tool = os.path.join(self.fPathBinaries, "carla-discovery-win64.exe")
  251. plugins = self._checkLADSPA("WINDOWS", tool, not WINDOWS)
  252. settingsDB.setValue("Plugins/LADSPA_win64", plugins)
  253. settingsDB.sync()
  254. if not self.fContinueChecking:
  255. return
  256. if self.fCheckDSSI:
  257. if self.fCheckNative:
  258. plugins = self._checkDSSI(OS, self.fToolNative)
  259. settingsDB.setValue("Plugins/DSSI_native", plugins)
  260. if not self.fContinueChecking:
  261. return
  262. if self.fCheckPosix32:
  263. plugins = self._checkDSSI(OS, os.path.join(self.fPathBinaries, "carla-discovery-posix32"))
  264. settingsDB.setValue("Plugins/DSSI_posix32", plugins)
  265. if not self.fContinueChecking:
  266. return
  267. if self.fCheckPosix64:
  268. plugins = self._checkDSSI(OS, os.path.join(self.fPathBinaries, "carla-discovery-posix64"))
  269. settingsDB.setValue("Plugins/DSSI_posix64", plugins)
  270. if not self.fContinueChecking:
  271. return
  272. if self.fCheckWin32:
  273. tool = os.path.join(self.fPathBinaries, "carla-discovery-win32.exe")
  274. plugins = self._checkDSSI("WINDOWS", tool, not WINDOWS)
  275. settingsDB.setValue("Plugins/DSSI_win32", plugins)
  276. if not self.fContinueChecking:
  277. return
  278. if self.fCheckWin64:
  279. tool = os.path.join(self.fPathBinaries, "carla-discovery-win64.exe")
  280. plugins = self._checkDSSI("WINDOWS", tool, not WINDOWS)
  281. settingsDB.setValue("Plugins/DSSI_win64", plugins)
  282. settingsDB.sync()
  283. if not self.fContinueChecking:
  284. return
  285. if self.fCheckLV2:
  286. plugins = self._checkCached(True)
  287. settingsDB.setValue("Plugins/LV2", plugins)
  288. settingsDB.sync()
  289. if not self.fContinueChecking:
  290. return
  291. if self.fCheckVST2:
  292. if self.fCheckNative:
  293. plugins = self._checkVST2(OS, self.fToolNative)
  294. settingsDB.setValue("Plugins/VST2_native", plugins)
  295. if not self.fContinueChecking:
  296. return
  297. if self.fCheckPosix32:
  298. plugins = self._checkVST2(OS, os.path.join(self.fPathBinaries, "carla-discovery-posix32"))
  299. settingsDB.setValue("Plugins/VST2_posix32", plugins)
  300. if not self.fContinueChecking:
  301. return
  302. if self.fCheckPosix64:
  303. plugins = self._checkVST2(OS, os.path.join(self.fPathBinaries, "carla-discovery-posix64"))
  304. settingsDB.setValue("Plugins/VST2_posix64", plugins)
  305. if not self.fContinueChecking:
  306. return
  307. if self.fCheckWin32:
  308. tool = os.path.join(self.fPathBinaries, "carla-discovery-win32.exe")
  309. plugins = self._checkVST2("WINDOWS", tool, not WINDOWS)
  310. settingsDB.setValue("Plugins/VST2_win32", plugins)
  311. if not self.fContinueChecking:
  312. return
  313. if self.fCheckWin64:
  314. tool = os.path.join(self.fPathBinaries, "carla-discovery-win64.exe")
  315. plugins = self._checkVST2("WINDOWS", tool, not WINDOWS)
  316. settingsDB.setValue("Plugins/VST2_win64", plugins)
  317. if not self.fContinueChecking:
  318. return
  319. settingsDB.sync()
  320. if not self.fContinueChecking:
  321. return
  322. if self.fCheckVST3:
  323. if self.fCheckNative and (LINUX or MACOS or WINDOWS):
  324. plugins = self._checkVST3(self.fToolNative)
  325. settingsDB.setValue("Plugins/VST3_native", plugins)
  326. if not self.fContinueChecking:
  327. return
  328. if self.fCheckPosix32:
  329. plugins = self._checkVST3(os.path.join(self.fPathBinaries, "carla-discovery-posix32"))
  330. settingsDB.setValue("Plugins/VST3_posix32", plugins)
  331. if not self.fContinueChecking:
  332. return
  333. if self.fCheckPosix64:
  334. plugins = self._checkVST3(os.path.join(self.fPathBinaries, "carla-discovery-posix64"))
  335. settingsDB.setValue("Plugins/VST3_posix64", plugins)
  336. if not self.fContinueChecking:
  337. return
  338. if self.fCheckWin32:
  339. tool = os.path.join(self.fPathBinaries, "carla-discovery-win32.exe")
  340. plugins = self._checkVST3(tool, not WINDOWS)
  341. settingsDB.setValue("Plugins/VST3_win32", plugins)
  342. if not self.fContinueChecking:
  343. return
  344. if self.fCheckWin64:
  345. tool = os.path.join(self.fPathBinaries, "carla-discovery-win64.exe")
  346. plugins = self._checkVST3(tool, not WINDOWS)
  347. settingsDB.setValue("Plugins/VST3_win64", plugins)
  348. if not self.fContinueChecking:
  349. return
  350. settingsDB.sync()
  351. if not self.fContinueChecking:
  352. return
  353. if self.fCheckCLAP:
  354. if self.fCheckNative:
  355. plugins = self._checkCLAP(self.fToolNative)
  356. settingsDB.setValue("Plugins/CLAP_native", plugins)
  357. if not self.fContinueChecking:
  358. return
  359. if self.fCheckPosix32:
  360. plugins = self._checkCLAP(os.path.join(self.fPathBinaries, "carla-discovery-posix32"))
  361. settingsDB.setValue("Plugins/CLAP_posix32", plugins)
  362. if not self.fContinueChecking:
  363. return
  364. if self.fCheckPosix64:
  365. plugins = self._checkCLAP(os.path.join(self.fPathBinaries, "carla-discovery-posix64"))
  366. settingsDB.setValue("Plugins/CLAP_posix64", plugins)
  367. if not self.fContinueChecking:
  368. return
  369. if self.fCheckWin32:
  370. tool = os.path.join(self.fPathBinaries, "carla-discovery-win32.exe")
  371. plugins = self._checkCLAP(tool, not WINDOWS)
  372. settingsDB.setValue("Plugins/CLAP_win32", plugins)
  373. if not self.fContinueChecking:
  374. return
  375. if self.fCheckWin64:
  376. tool = os.path.join(self.fPathBinaries, "carla-discovery-win64.exe")
  377. plugins = self._checkCLAP(tool, not WINDOWS)
  378. settingsDB.setValue("Plugins/CLAP_win64", plugins)
  379. if not self.fContinueChecking:
  380. return
  381. settingsDB.sync()
  382. if not self.fContinueChecking:
  383. return
  384. if self.fCheckAU:
  385. if self.fCheckNative:
  386. plugins = self._checkCached(False)
  387. settingsDB.setValue("Plugins/AU", plugins)
  388. settingsDB.sync()
  389. if not self.fContinueChecking:
  390. return
  391. if self.fCheckPosix32:
  392. plugins = self._checkAU(os.path.join(self.fPathBinaries, "carla-discovery-posix32"))
  393. settingsDB.setValue("Plugins/AU_posix32", self.fAuPlugins)
  394. if not self.fContinueChecking:
  395. return
  396. settingsDB.sync()
  397. if not self.fContinueChecking:
  398. return
  399. if self.fCheckSF2:
  400. settings = QSafeSettings("falkTX", "Carla2")
  401. SF2_PATH = settings.value(CARLA_KEY_PATHS_SF2, CARLA_DEFAULT_SF2_PATH, list)
  402. del settings
  403. kits = self._checkKIT(SF2_PATH, "sf2")
  404. settingsDB.setValue("Plugins/SF2", kits)
  405. settingsDB.sync()
  406. if not self.fContinueChecking:
  407. return
  408. if self.fCheckSFZ:
  409. kits = self._checkSfzCached()
  410. settingsDB.setValue("Plugins/SFZ", kits)
  411. settingsDB.sync()
  412. if self.fCheckJSFX:
  413. kits = self._checkJsfxCached()
  414. settingsDB.setValue("Plugins/JSFX", kits)
  415. settingsDB.sync()
  416. # -----------------------------------------------------------------------------------------------------------------
  417. # private methods
  418. def _checkLADSPA(self, OS, tool, isWine=False):
  419. ladspaBinaries = []
  420. ladspaPlugins = []
  421. self._pluginLook(self.fLastCheckValue, "LADSPA plugins...")
  422. settings = QSafeSettings("falkTX", "Carla2")
  423. LADSPA_PATH = settings.value(CARLA_KEY_PATHS_LADSPA, CARLA_DEFAULT_LADSPA_PATH, list)
  424. del settings
  425. for iPATH in LADSPA_PATH:
  426. binaries = findBinaries(iPATH, PLUGIN_LADSPA, OS)
  427. for binary in binaries:
  428. if binary not in ladspaBinaries:
  429. ladspaBinaries.append(binary)
  430. ladspaBinaries.sort()
  431. if not self.fContinueChecking:
  432. return ladspaPlugins
  433. for i in range(len(ladspaBinaries)):
  434. ladspa = ladspaBinaries[i]
  435. percent = ( float(i) / len(ladspaBinaries) ) * self.fCurPercentValue
  436. self._pluginLook((self.fLastCheckValue + percent) * 0.9, ladspa)
  437. plugins = checkPluginLADSPA(ladspa, tool, self.fWineSettings if isWine else None)
  438. if plugins:
  439. ladspaPlugins.append(plugins)
  440. if not self.fContinueChecking:
  441. break
  442. self.fLastCheckValue += self.fCurPercentValue
  443. return ladspaPlugins
  444. def _checkDSSI(self, OS, tool, isWine=False):
  445. dssiBinaries = []
  446. dssiPlugins = []
  447. self._pluginLook(self.fLastCheckValue, "DSSI plugins...")
  448. settings = QSafeSettings("falkTX", "Carla2")
  449. DSSI_PATH = settings.value(CARLA_KEY_PATHS_DSSI, CARLA_DEFAULT_DSSI_PATH, list)
  450. del settings
  451. for iPATH in DSSI_PATH:
  452. binaries = findBinaries(iPATH, PLUGIN_DSSI, OS)
  453. for binary in binaries:
  454. if binary not in dssiBinaries:
  455. dssiBinaries.append(binary)
  456. dssiBinaries.sort()
  457. if not self.fContinueChecking:
  458. return dssiPlugins
  459. for i in range(len(dssiBinaries)):
  460. dssi = dssiBinaries[i]
  461. percent = ( float(i) / len(dssiBinaries) ) * self.fCurPercentValue
  462. self._pluginLook(self.fLastCheckValue + percent, dssi)
  463. plugins = checkPluginDSSI(dssi, tool, self.fWineSettings if isWine else None)
  464. if plugins:
  465. dssiPlugins.append(plugins)
  466. if not self.fContinueChecking:
  467. break
  468. self.fLastCheckValue += self.fCurPercentValue
  469. return dssiPlugins
  470. def _checkVST2(self, OS, tool, isWine=False):
  471. vst2Binaries = []
  472. vst2Plugins = []
  473. if MACOS and not isWine:
  474. self._pluginLook(self.fLastCheckValue, "VST2 bundles...")
  475. else:
  476. self._pluginLook(self.fLastCheckValue, "VST2 plugins...")
  477. settings = QSafeSettings("falkTX", "Carla2")
  478. VST2_PATH = settings.value(CARLA_KEY_PATHS_VST2, CARLA_DEFAULT_VST2_PATH, list)
  479. del settings
  480. for iPATH in VST2_PATH:
  481. if MACOS and not isWine:
  482. binaries = findMacVSTBundles(iPATH, False)
  483. else:
  484. binaries = findBinaries(iPATH, PLUGIN_VST2, OS)
  485. for binary in binaries:
  486. if binary not in vst2Binaries:
  487. vst2Binaries.append(binary)
  488. vst2Binaries.sort()
  489. if not self.fContinueChecking:
  490. return vst2Plugins
  491. for i in range(len(vst2Binaries)):
  492. vst2 = vst2Binaries[i]
  493. percent = ( float(i) / len(vst2Binaries) ) * self.fCurPercentValue
  494. self._pluginLook(self.fLastCheckValue + percent, vst2)
  495. plugins = checkPluginVST2(vst2, tool, self.fWineSettings if isWine else None)
  496. if plugins:
  497. vst2Plugins.append(plugins)
  498. if not self.fContinueChecking:
  499. break
  500. self.fLastCheckValue += self.fCurPercentValue
  501. return vst2Plugins
  502. def _checkVST3(self, tool, isWine=False):
  503. vst3Binaries = []
  504. vst3Plugins = []
  505. if MACOS and not isWine:
  506. self._pluginLook(self.fLastCheckValue, "VST3 bundles...")
  507. else:
  508. self._pluginLook(self.fLastCheckValue, "VST3 plugins...")
  509. settings = QSafeSettings("falkTX", "Carla2")
  510. VST3_PATH = settings.value(CARLA_KEY_PATHS_VST3, CARLA_DEFAULT_VST3_PATH, list)
  511. del settings
  512. for iPATH in VST3_PATH:
  513. if MACOS and not isWine:
  514. binaries = findMacVSTBundles(iPATH, True)
  515. else:
  516. binaries = findVST3Binaries(iPATH)
  517. for binary in binaries:
  518. if binary not in vst3Binaries:
  519. vst3Binaries.append(binary)
  520. vst3Binaries.sort()
  521. if not self.fContinueChecking:
  522. return vst3Plugins
  523. for i in range(len(vst3Binaries)):
  524. vst3 = vst3Binaries[i]
  525. percent = ( float(i) / len(vst3Binaries) ) * self.fCurPercentValue
  526. self._pluginLook(self.fLastCheckValue + percent, vst3)
  527. plugins = checkPluginVST3(vst3, tool, self.fWineSettings if isWine else None)
  528. if plugins:
  529. vst3Plugins.append(plugins)
  530. if not self.fContinueChecking:
  531. break
  532. self.fLastCheckValue += self.fCurPercentValue
  533. return vst3Plugins
  534. def _checkCLAP(self, tool, isWine=False):
  535. clapBinaries = []
  536. clapPlugins = []
  537. self._pluginLook(self.fLastCheckValue, "CLAP plugins...")
  538. settings = QSafeSettings("falkTX", "Carla2")
  539. CLAP_PATH = settings.value(CARLA_KEY_PATHS_CLAP, CARLA_DEFAULT_CLAP_PATH, list)
  540. del settings
  541. for iPATH in CLAP_PATH:
  542. binaries = findCLAPBinaries(iPATH)
  543. for binary in binaries:
  544. if binary not in clapBinaries:
  545. clapBinaries.append(binary)
  546. clapBinaries.sort()
  547. if not self.fContinueChecking:
  548. return clapPlugins
  549. for i in range(len(clapBinaries)):
  550. clap = clapBinaries[i]
  551. percent = ( float(i) / len(clapBinaries) ) * self.fCurPercentValue
  552. self._pluginLook(self.fLastCheckValue + percent, clap)
  553. plugins = checkPluginCLAP(clap, tool, self.fWineSettings if isWine else None)
  554. if plugins:
  555. clapPlugins.append(plugins)
  556. if not self.fContinueChecking:
  557. break
  558. self.fLastCheckValue += self.fCurPercentValue
  559. return clapPlugins
  560. def _checkAU(self, tool):
  561. auPlugins = []
  562. plugins = checkAllPluginsAU(tool)
  563. if plugins:
  564. auPlugins.append(plugins)
  565. self.fLastCheckValue += self.fCurPercentValue
  566. return auPlugins
  567. def _checkKIT(self, kitPATH, kitExtension):
  568. kitFiles = []
  569. kitPlugins = []
  570. for iPATH in kitPATH:
  571. files = findFilenames(iPATH, kitExtension)
  572. for file_ in files:
  573. if file_ not in kitFiles:
  574. kitFiles.append(file_)
  575. kitFiles.sort()
  576. if not self.fContinueChecking:
  577. return kitPlugins
  578. for i in range(len(kitFiles)):
  579. kit = kitFiles[i]
  580. percent = ( float(i) / len(kitFiles) ) * self.fCurPercentValue
  581. self._pluginLook(self.fLastCheckValue + percent, kit)
  582. if kitExtension == "sf2":
  583. plugins = checkFileSF2(kit, self.fToolNative)
  584. else:
  585. plugins = None
  586. if plugins:
  587. kitPlugins.append(plugins)
  588. if not self.fContinueChecking:
  589. break
  590. self.fLastCheckValue += self.fCurPercentValue
  591. return kitPlugins
  592. def _checkCached(self, isLV2):
  593. if isLV2:
  594. settings = QSafeSettings("falkTX", "Carla2")
  595. PLUG_PATH = splitter.join(settings.value(CARLA_KEY_PATHS_LV2, CARLA_DEFAULT_LV2_PATH, list))
  596. del settings
  597. PLUG_TEXT = "LV2"
  598. PLUG_TYPE = PLUGIN_LV2
  599. else: # AU
  600. PLUG_PATH = ""
  601. PLUG_TEXT = "AU"
  602. PLUG_TYPE = PLUGIN_AU
  603. plugins = []
  604. self._pluginLook(self.fLastCheckValue, f"{PLUG_TEXT} plugins...")
  605. if not isLV2:
  606. gCarla.utils.juce_init()
  607. count = gCarla.utils.get_cached_plugin_count(PLUG_TYPE, PLUG_PATH)
  608. if not self.fContinueChecking:
  609. return plugins
  610. for i in range(count):
  611. descInfo = gCarla.utils.get_cached_plugin_info(PLUG_TYPE, i)
  612. percent = ( float(i) / count ) * self.fCurPercentValue
  613. self._pluginLook(self.fLastCheckValue + percent, descInfo['label'])
  614. if not descInfo['valid']:
  615. continue
  616. plugins.append(checkPluginCached(descInfo, PLUG_TYPE))
  617. if not self.fContinueChecking:
  618. break
  619. if not isLV2:
  620. gCarla.utils.juce_cleanup()
  621. self.fLastCheckValue += self.fCurPercentValue
  622. return plugins
  623. def _checkSfzCached(self):
  624. settings = QSafeSettings("falkTX", "Carla2")
  625. PLUG_PATH = splitter.join(settings.value(CARLA_KEY_PATHS_SFZ, CARLA_DEFAULT_SFZ_PATH, list))
  626. del settings
  627. sfzKits = []
  628. self._pluginLook(self.fLastCheckValue, "SFZ kits...")
  629. count = gCarla.utils.get_cached_plugin_count(PLUGIN_SFZ, PLUG_PATH)
  630. if not self.fContinueChecking:
  631. return sfzKits
  632. for i in range(count):
  633. descInfo = gCarla.utils.get_cached_plugin_info(PLUGIN_SFZ, i)
  634. percent = ( float(i) / count ) * self.fCurPercentValue
  635. self._pluginLook(self.fLastCheckValue + percent, descInfo['label'])
  636. if not descInfo['valid']:
  637. continue
  638. sfzKits.append(checkPluginCached(descInfo, PLUGIN_SFZ))
  639. if not self.fContinueChecking:
  640. break
  641. self.fLastCheckValue += self.fCurPercentValue
  642. return sfzKits
  643. def _checkJsfxCached(self):
  644. settings = QSafeSettings("falkTX", "Carla2")
  645. PLUG_PATH = splitter.join(settings.value(CARLA_KEY_PATHS_JSFX, CARLA_DEFAULT_JSFX_PATH, list))
  646. del settings
  647. jsfxPlugins = []
  648. self._pluginLook(self.fLastCheckValue, "JSFX plugins...")
  649. count = gCarla.utils.get_cached_plugin_count(PLUGIN_JSFX, PLUG_PATH)
  650. if not self.fContinueChecking:
  651. return jsfxPlugins
  652. for i in range(count):
  653. descInfo = gCarla.utils.get_cached_plugin_info(PLUGIN_JSFX, i)
  654. percent = ( float(i) / count ) * self.fCurPercentValue
  655. self._pluginLook(self.fLastCheckValue + percent, descInfo['label'])
  656. if not descInfo['valid']:
  657. continue
  658. jsfxPlugins.append(checkPluginCached(descInfo, PLUGIN_JSFX))
  659. if not self.fContinueChecking:
  660. break
  661. self.fLastCheckValue += self.fCurPercentValue
  662. return jsfxPlugins
  663. def _pluginLook(self, percent, plugin):
  664. self.pluginLook.emit(percent, plugin)
  665. # ---------------------------------------------------------------------------------------------------------------------