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.

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