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.

1696 lines
74KB

  1. #!/usr/bin/env python3
  2. # -*- coding: utf-8 -*-
  3. # Carla settings code
  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 (PyQt5)
  19. from PyQt5.QtCore import pyqtSlot, QT_VERSION, Qt
  20. from PyQt5.QtWidgets import QDialog, QDialogButtonBox, QFileDialog
  21. # ---------------------------------------------------------------------------------------------------------------------
  22. # Imports (Custom)
  23. import ui_carla_settings
  24. import ui_carla_settings_driver
  25. from carla_backend import (
  26. LINUX, MACOS, WINDOWS,
  27. ENGINE_DRIVER_DEVICE_HAS_CONTROL_PANEL,
  28. ENGINE_DRIVER_DEVICE_CAN_TRIPLE_BUFFER,
  29. ENGINE_DRIVER_DEVICE_VARIABLE_BUFFER_SIZE,
  30. ENGINE_DRIVER_DEVICE_VARIABLE_SAMPLE_RATE,
  31. ENGINE_PROCESS_MODE_CONTINUOUS_RACK,
  32. ENGINE_OPTION_FILE_PATH,
  33. ENGINE_OPTION_PLUGIN_PATH,
  34. FILE_AUDIO,
  35. FILE_MIDI,
  36. PLUGIN_LADSPA,
  37. PLUGIN_DSSI,
  38. PLUGIN_LV2,
  39. PLUGIN_VST2,
  40. PLUGIN_VST3,
  41. PLUGIN_SF2,
  42. PLUGIN_SFZ,
  43. PLUGIN_JSFX,
  44. PLUGIN_CLAP,
  45. )
  46. from carla_shared import (
  47. CARLA_KEY_MAIN_PROJECT_FOLDER,
  48. CARLA_KEY_MAIN_USE_PRO_THEME,
  49. CARLA_KEY_MAIN_PRO_THEME_COLOR,
  50. CARLA_KEY_MAIN_REFRESH_INTERVAL,
  51. CARLA_KEY_MAIN_CONFIRM_EXIT,
  52. CARLA_KEY_MAIN_CLASSIC_SKIN,
  53. CARLA_KEY_MAIN_SHOW_LOGS,
  54. CARLA_KEY_MAIN_SYSTEM_ICONS,
  55. CARLA_KEY_MAIN_EXPERIMENTAL,
  56. CARLA_KEY_CANVAS_THEME,
  57. CARLA_KEY_CANVAS_SIZE,
  58. CARLA_KEY_CANVAS_USE_BEZIER_LINES,
  59. CARLA_KEY_CANVAS_AUTO_HIDE_GROUPS,
  60. CARLA_KEY_CANVAS_AUTO_SELECT_ITEMS,
  61. CARLA_KEY_CANVAS_EYE_CANDY,
  62. CARLA_KEY_CANVAS_FANCY_EYE_CANDY,
  63. CARLA_KEY_CANVAS_USE_OPENGL,
  64. CARLA_KEY_CANVAS_ANTIALIASING,
  65. CARLA_KEY_CANVAS_HQ_ANTIALIASING,
  66. CARLA_KEY_CANVAS_INLINE_DISPLAYS,
  67. CARLA_KEY_CANVAS_FULL_REPAINTS,
  68. CARLA_KEY_ENGINE_DRIVER_PREFIX,
  69. CARLA_KEY_ENGINE_AUDIO_DRIVER,
  70. CARLA_KEY_ENGINE_PROCESS_MODE,
  71. CARLA_KEY_ENGINE_FORCE_STEREO,
  72. CARLA_KEY_ENGINE_PREFER_PLUGIN_BRIDGES,
  73. CARLA_KEY_ENGINE_PREFER_UI_BRIDGES,
  74. CARLA_KEY_ENGINE_MANAGE_UIS,
  75. CARLA_KEY_ENGINE_UIS_ALWAYS_ON_TOP,
  76. CARLA_KEY_ENGINE_MAX_PARAMETERS,
  77. CARLA_KEY_ENGINE_RESET_XRUNS,
  78. CARLA_KEY_ENGINE_UI_BRIDGES_TIMEOUT,
  79. CARLA_KEY_OSC_ENABLED,
  80. CARLA_KEY_OSC_TCP_PORT_ENABLED,
  81. CARLA_KEY_OSC_TCP_PORT_NUMBER,
  82. CARLA_KEY_OSC_TCP_PORT_RANDOM,
  83. CARLA_KEY_OSC_UDP_PORT_ENABLED,
  84. CARLA_KEY_OSC_UDP_PORT_NUMBER,
  85. CARLA_KEY_OSC_UDP_PORT_RANDOM,
  86. CARLA_KEY_PATHS_AUDIO,
  87. CARLA_KEY_PATHS_MIDI,
  88. CARLA_KEY_PATHS_LADSPA,
  89. CARLA_KEY_PATHS_DSSI,
  90. CARLA_KEY_PATHS_LV2,
  91. CARLA_KEY_PATHS_VST2,
  92. CARLA_KEY_PATHS_VST3,
  93. CARLA_KEY_PATHS_SF2,
  94. CARLA_KEY_PATHS_SFZ,
  95. CARLA_KEY_PATHS_JSFX,
  96. CARLA_KEY_PATHS_CLAP,
  97. CARLA_KEY_WINE_EXECUTABLE,
  98. CARLA_KEY_WINE_AUTO_PREFIX,
  99. CARLA_KEY_WINE_FALLBACK_PREFIX,
  100. CARLA_KEY_WINE_RT_PRIO_ENABLED,
  101. CARLA_KEY_WINE_BASE_RT_PRIO,
  102. CARLA_KEY_WINE_SERVER_RT_PRIO,
  103. CARLA_KEY_EXPERIMENTAL_PLUGIN_BRIDGES,
  104. CARLA_KEY_EXPERIMENTAL_WINE_BRIDGES,
  105. CARLA_KEY_EXPERIMENTAL_JACK_APPS,
  106. CARLA_KEY_EXPERIMENTAL_EXPORT_LV2,
  107. CARLA_KEY_EXPERIMENTAL_PREVENT_BAD_BEHAVIOUR,
  108. CARLA_KEY_EXPERIMENTAL_LOAD_LIB_GLOBAL,
  109. CARLA_DEFAULT_MAIN_PROJECT_FOLDER,
  110. CARLA_DEFAULT_MAIN_USE_PRO_THEME,
  111. CARLA_DEFAULT_MAIN_PRO_THEME_COLOR,
  112. CARLA_DEFAULT_MAIN_REFRESH_INTERVAL,
  113. CARLA_DEFAULT_MAIN_CONFIRM_EXIT,
  114. CARLA_DEFAULT_MAIN_CLASSIC_SKIN,
  115. CARLA_DEFAULT_MAIN_SHOW_LOGS,
  116. CARLA_DEFAULT_MAIN_SYSTEM_ICONS,
  117. #CARLA_DEFAULT_MAIN_EXPERIMENTAL,
  118. CARLA_DEFAULT_CANVAS_THEME,
  119. CARLA_DEFAULT_CANVAS_SIZE,
  120. CARLA_DEFAULT_CANVAS_USE_BEZIER_LINES,
  121. CARLA_DEFAULT_CANVAS_AUTO_HIDE_GROUPS,
  122. CARLA_DEFAULT_CANVAS_AUTO_SELECT_ITEMS,
  123. CARLA_DEFAULT_CANVAS_EYE_CANDY,
  124. CARLA_DEFAULT_CANVAS_FANCY_EYE_CANDY,
  125. CARLA_DEFAULT_CANVAS_USE_OPENGL,
  126. CARLA_DEFAULT_CANVAS_ANTIALIASING,
  127. CARLA_DEFAULT_CANVAS_HQ_ANTIALIASING,
  128. CARLA_DEFAULT_CANVAS_INLINE_DISPLAYS,
  129. CARLA_DEFAULT_CANVAS_FULL_REPAINTS,
  130. CARLA_DEFAULT_FORCE_STEREO,
  131. CARLA_DEFAULT_PREFER_PLUGIN_BRIDGES,
  132. CARLA_DEFAULT_PREFER_UI_BRIDGES,
  133. CARLA_DEFAULT_MANAGE_UIS,
  134. CARLA_DEFAULT_UIS_ALWAYS_ON_TOP,
  135. CARLA_DEFAULT_MAX_PARAMETERS,
  136. CARLA_DEFAULT_RESET_XRUNS,
  137. CARLA_DEFAULT_UI_BRIDGES_TIMEOUT,
  138. CARLA_DEFAULT_AUDIO_BUFFER_SIZE,
  139. CARLA_DEFAULT_AUDIO_SAMPLE_RATE,
  140. CARLA_DEFAULT_AUDIO_TRIPLE_BUFFER,
  141. CARLA_DEFAULT_AUDIO_DRIVER,
  142. CARLA_DEFAULT_PROCESS_MODE,
  143. CARLA_DEFAULT_OSC_ENABLED,
  144. CARLA_DEFAULT_OSC_TCP_PORT_ENABLED,
  145. CARLA_DEFAULT_OSC_TCP_PORT_NUMBER,
  146. CARLA_DEFAULT_OSC_TCP_PORT_RANDOM,
  147. CARLA_DEFAULT_OSC_UDP_PORT_ENABLED,
  148. CARLA_DEFAULT_OSC_UDP_PORT_NUMBER,
  149. CARLA_DEFAULT_OSC_UDP_PORT_RANDOM,
  150. CARLA_DEFAULT_WINE_EXECUTABLE,
  151. CARLA_DEFAULT_WINE_AUTO_PREFIX,
  152. CARLA_DEFAULT_WINE_FALLBACK_PREFIX,
  153. CARLA_DEFAULT_WINE_RT_PRIO_ENABLED,
  154. CARLA_DEFAULT_WINE_BASE_RT_PRIO,
  155. CARLA_DEFAULT_WINE_SERVER_RT_PRIO,
  156. CARLA_DEFAULT_EXPERIMENTAL_PLUGIN_BRIDGES,
  157. CARLA_DEFAULT_EXPERIMENTAL_WINE_BRIDGES,
  158. CARLA_DEFAULT_EXPERIMENTAL_JACK_APPS,
  159. CARLA_DEFAULT_EXPERIMENTAL_LV2_EXPORT,
  160. CARLA_DEFAULT_EXPERIMENTAL_PREVENT_BAD_BEHAVIOUR,
  161. CARLA_DEFAULT_EXPERIMENTAL_LOAD_LIB_GLOBAL,
  162. CARLA_DEFAULT_FILE_PATH_AUDIO,
  163. CARLA_DEFAULT_FILE_PATH_MIDI,
  164. CARLA_DEFAULT_LADSPA_PATH,
  165. CARLA_DEFAULT_DSSI_PATH,
  166. CARLA_DEFAULT_LV2_PATH,
  167. CARLA_DEFAULT_VST2_PATH,
  168. CARLA_DEFAULT_VST3_PATH,
  169. CARLA_DEFAULT_SF2_PATH,
  170. CARLA_DEFAULT_SFZ_PATH,
  171. CARLA_DEFAULT_JSFX_PATH,
  172. CARLA_DEFAULT_CLAP_PATH,
  173. getAndSetPath,
  174. getIcon,
  175. fontMetricsHorizontalAdvance,
  176. splitter,
  177. )
  178. from patchcanvas.theme import Theme, getThemeName
  179. from utils import QSafeSettings
  180. # ---------------------------------------------------------------------------------------------------------------------
  181. # ...
  182. BUFFER_SIZE_LIST = (16, 32, 64, 128, 256, 512, 1024, 2048, 4096, 8192)
  183. SAMPLE_RATE_LIST = (22050, 32000, 44100, 48000, 88200, 96000, 176400, 192000)
  184. # ---------------------------------------------------------------------------------------------------------------------
  185. # Driver Settings
  186. class DriverSettingsW(QDialog):
  187. AUTOMATIC_OPTION = "(Auto)"
  188. def __init__(self, parent, host, driverIndex, driverName):
  189. QDialog.__init__(self, parent)
  190. self.host = host
  191. self.ui = ui_carla_settings_driver.Ui_DriverSettingsW()
  192. self.ui.setupUi(self)
  193. # -------------------------------------------------------------------------------------------------------------
  194. # Internal stuff
  195. self.fDriverIndex = driverIndex
  196. self.fDriverName = driverName
  197. self.fDeviceNames = host.get_engine_driver_device_names(driverIndex)
  198. self.fBufferSizes = BUFFER_SIZE_LIST
  199. self.fSampleRates = SAMPLE_RATE_LIST
  200. # -------------------------------------------------------------------------------------------------------------
  201. # Set-up GUI
  202. for name in self.fDeviceNames:
  203. self.ui.cb_device.addItem(name)
  204. self.setWindowFlags(self.windowFlags() & ~Qt.WindowContextHelpButtonHint)
  205. if MACOS:
  206. self.setWindowModality(Qt.WindowModal)
  207. # -------------------------------------------------------------------------------------------------------------
  208. # Load settings
  209. self.loadSettings()
  210. # -------------------------------------------------------------------------------------------------------------
  211. # Set-up connections
  212. self.accepted.connect(self.slot_saveSettings)
  213. self.ui.b_panel.clicked.connect(self.slot_showDevicePanel)
  214. self.ui.cb_device.currentIndexChanged.connect(self.slot_updateDeviceInfo)
  215. # -----------------------------------------------------------------------------------------------------------------
  216. def getValues(self):
  217. audioDevice = self.ui.cb_device.currentText()
  218. bufferSize = self.ui.cb_buffersize.currentText()
  219. sampleRate = self.ui.cb_samplerate.currentText()
  220. if bufferSize == self.AUTOMATIC_OPTION:
  221. bufferSize = "0"
  222. if sampleRate == self.AUTOMATIC_OPTION:
  223. sampleRate = "0"
  224. return (audioDevice, int(bufferSize), int(sampleRate))
  225. # -----------------------------------------------------------------------------------------------------------------
  226. def loadSettings(self):
  227. settings = QSafeSettings("falkTX", "Carla2")
  228. args = (CARLA_KEY_ENGINE_DRIVER_PREFIX, self.fDriverName)
  229. audioDevice = settings.value("%s%s/Device" % args, "", str)
  230. audioBufferSize = settings.value("%s%s/BufferSize" % args, CARLA_DEFAULT_AUDIO_BUFFER_SIZE, int)
  231. audioSampleRate = settings.value("%s%s/SampleRate" % args, CARLA_DEFAULT_AUDIO_SAMPLE_RATE, int)
  232. audioTripleBuffer = settings.value("%s%s/TripleBuffer" % args, CARLA_DEFAULT_AUDIO_TRIPLE_BUFFER, bool)
  233. if audioDevice and audioDevice in self.fDeviceNames:
  234. self.ui.cb_device.setCurrentIndex(self.fDeviceNames.index(audioDevice))
  235. else:
  236. self.ui.cb_device.setCurrentIndex(-1)
  237. # fill combo-boxes first
  238. self.slot_updateDeviceInfo()
  239. if audioBufferSize and audioBufferSize in self.fBufferSizes:
  240. self.ui.cb_buffersize.setCurrentIndex(self.fBufferSizes.index(audioBufferSize))
  241. elif self.fBufferSizes == BUFFER_SIZE_LIST:
  242. self.ui.cb_buffersize.setCurrentIndex(BUFFER_SIZE_LIST.index(CARLA_DEFAULT_AUDIO_BUFFER_SIZE))
  243. else:
  244. self.ui.cb_buffersize.setCurrentIndex(int(len(self.fBufferSizes)/2))
  245. if audioSampleRate and audioSampleRate in self.fSampleRates:
  246. self.ui.cb_samplerate.setCurrentIndex(self.fSampleRates.index(audioSampleRate))
  247. elif self.fSampleRates == SAMPLE_RATE_LIST:
  248. self.ui.cb_samplerate.setCurrentIndex(SAMPLE_RATE_LIST.index(CARLA_DEFAULT_AUDIO_SAMPLE_RATE))
  249. else:
  250. self.ui.cb_samplerate.setCurrentIndex(int(len(self.fSampleRates)/2))
  251. self.ui.cb_triple_buffer.setChecked(audioTripleBuffer and self.ui.cb_triple_buffer.isEnabled())
  252. # -----------------------------------------------------------------------------------------------------------------
  253. @pyqtSlot()
  254. def slot_saveSettings(self):
  255. settings = QSafeSettings("falkTX", "Carla2")
  256. bufferSize = self.ui.cb_buffersize.currentText()
  257. sampleRate = self.ui.cb_samplerate.currentText()
  258. if bufferSize == self.AUTOMATIC_OPTION:
  259. bufferSize = "0"
  260. if sampleRate == self.AUTOMATIC_OPTION:
  261. sampleRate = "0"
  262. args = (CARLA_KEY_ENGINE_DRIVER_PREFIX, self.fDriverName)
  263. settings.setValue("%s%s/Device" % args, self.ui.cb_device.currentText())
  264. settings.setValue("%s%s/BufferSize" % args, bufferSize)
  265. settings.setValue("%s%s/SampleRate" % args, sampleRate)
  266. settings.setValue("%s%s/TripleBuffer" % args, self.ui.cb_triple_buffer.isChecked())
  267. # -----------------------------------------------------------------------------------------------------------------
  268. @pyqtSlot()
  269. def slot_showDevicePanel(self):
  270. self.host.show_engine_driver_device_control_panel(self.fDriverIndex, self.ui.cb_device.currentText())
  271. @pyqtSlot()
  272. def slot_updateDeviceInfo(self):
  273. deviceName = self.ui.cb_device.currentText()
  274. oldBufferSize = self.ui.cb_buffersize.currentText()
  275. oldSampleRate = self.ui.cb_samplerate.currentText()
  276. self.ui.cb_buffersize.clear()
  277. self.ui.cb_samplerate.clear()
  278. driverDeviceInfo = self.host.get_engine_driver_device_info(self.fDriverIndex, deviceName)
  279. driverDeviceHints = driverDeviceInfo['hints']
  280. self.fBufferSizes = driverDeviceInfo['bufferSizes']
  281. self.fSampleRates = driverDeviceInfo['sampleRates']
  282. if driverDeviceHints & ENGINE_DRIVER_DEVICE_CAN_TRIPLE_BUFFER:
  283. self.ui.cb_triple_buffer.setEnabled(True)
  284. else:
  285. self.ui.cb_triple_buffer.setEnabled(False)
  286. if driverDeviceHints & ENGINE_DRIVER_DEVICE_HAS_CONTROL_PANEL:
  287. self.ui.b_panel.setEnabled(True)
  288. else:
  289. self.ui.b_panel.setEnabled(False)
  290. if self.fBufferSizes:
  291. match = False
  292. for bsize in self.fBufferSizes:
  293. sbsize = str(bsize)
  294. self.ui.cb_buffersize.addItem(sbsize)
  295. if oldBufferSize == sbsize:
  296. match = True
  297. self.ui.cb_buffersize.setCurrentIndex(self.ui.cb_buffersize.count()-1)
  298. if not match:
  299. if CARLA_DEFAULT_AUDIO_BUFFER_SIZE in self.fBufferSizes:
  300. self.ui.cb_buffersize.setCurrentIndex(self.fBufferSizes.index(CARLA_DEFAULT_AUDIO_BUFFER_SIZE))
  301. else:
  302. self.ui.cb_buffersize.setCurrentIndex(int(len(self.fBufferSizes)/2))
  303. else:
  304. self.ui.cb_buffersize.addItem(self.AUTOMATIC_OPTION)
  305. self.ui.cb_buffersize.setCurrentIndex(0)
  306. if self.fSampleRates:
  307. match = False
  308. for srate in self.fSampleRates:
  309. ssrate = str(int(srate))
  310. self.ui.cb_samplerate.addItem(ssrate)
  311. if oldSampleRate == ssrate:
  312. match = True
  313. self.ui.cb_samplerate.setCurrentIndex(self.ui.cb_samplerate.count()-1)
  314. if not match:
  315. if CARLA_DEFAULT_AUDIO_SAMPLE_RATE in self.fSampleRates:
  316. self.ui.cb_samplerate.setCurrentIndex(self.fSampleRates.index(CARLA_DEFAULT_AUDIO_SAMPLE_RATE))
  317. else:
  318. self.ui.cb_samplerate.setCurrentIndex(int(len(self.fSampleRates)/2))
  319. else:
  320. self.ui.cb_samplerate.addItem(self.AUTOMATIC_OPTION)
  321. self.ui.cb_samplerate.setCurrentIndex(0)
  322. # ---------------------------------------------------------------------------------------------------------------------
  323. # Runtime Driver Settings
  324. class RuntimeDriverSettingsW(QDialog):
  325. def __init__(self, parent, host):
  326. QDialog.__init__(self, parent)
  327. self.host = host
  328. self.ui = ui_carla_settings_driver.Ui_DriverSettingsW()
  329. self.ui.setupUi(self)
  330. driverDeviceInfo = host.get_runtime_engine_driver_device_info()
  331. # -------------------------------------------------------------------------------------------------------------
  332. # Set-up GUI
  333. self.ui.cb_device.clear()
  334. self.ui.cb_buffersize.clear()
  335. self.ui.cb_samplerate.clear()
  336. self.ui.cb_triple_buffer.hide()
  337. self.ui.ico_restart.hide()
  338. self.ui.label_restart.hide()
  339. self.ui.layout_triple_buffer.takeAt(2)
  340. self.ui.layout_triple_buffer.takeAt(1)
  341. self.ui.layout_triple_buffer.takeAt(0)
  342. self.ui.verticalLayout.removeItem(self.ui.layout_triple_buffer)
  343. self.ui.layout_restart.takeAt(3)
  344. self.ui.layout_restart.takeAt(2)
  345. self.ui.layout_restart.takeAt(1)
  346. self.ui.layout_restart.takeAt(0)
  347. self.ui.verticalLayout.removeItem(self.ui.layout_restart)
  348. self.adjustSize()
  349. self.setWindowFlags(self.windowFlags() & ~Qt.WindowContextHelpButtonHint)
  350. if MACOS:
  351. self.setWindowModality(Qt.WindowModal)
  352. # -------------------------------------------------------------------------------------------------------------
  353. # Load runtime settings
  354. if host.is_engine_running():
  355. self.ui.cb_device.addItem(driverDeviceInfo['name'])
  356. self.ui.cb_device.setCurrentIndex(0)
  357. self.ui.cb_device.setEnabled(False)
  358. else:
  359. self.ui.cb_device.addItem(driverDeviceInfo['name'])
  360. self.ui.cb_device.setCurrentIndex(0)
  361. if driverDeviceInfo['bufferSizes']:
  362. for bsize in driverDeviceInfo['bufferSizes']:
  363. sbsize = str(bsize)
  364. self.ui.cb_buffersize.addItem(sbsize)
  365. if driverDeviceInfo['bufferSize'] == bsize:
  366. self.ui.cb_buffersize.setCurrentIndex(self.ui.cb_buffersize.count()-1)
  367. else:
  368. self.ui.cb_buffersize.addItem(DriverSettingsW.AUTOMATIC_OPTION)
  369. self.ui.cb_buffersize.setCurrentIndex(0)
  370. if (driverDeviceInfo['hints'] & ENGINE_DRIVER_DEVICE_VARIABLE_BUFFER_SIZE) == 0x0:
  371. self.ui.cb_buffersize.setEnabled(False)
  372. if driverDeviceInfo['sampleRates']:
  373. for srate in driverDeviceInfo['sampleRates']:
  374. ssrate = str(int(srate))
  375. self.ui.cb_samplerate.addItem(ssrate)
  376. if driverDeviceInfo['sampleRate'] == srate:
  377. self.ui.cb_samplerate.setCurrentIndex(self.ui.cb_samplerate.count()-1)
  378. else:
  379. self.ui.cb_samplerate.addItem(DriverSettingsW.AUTOMATIC_OPTION)
  380. self.ui.cb_samplerate.setCurrentIndex(0)
  381. if (driverDeviceInfo['hints'] & ENGINE_DRIVER_DEVICE_VARIABLE_SAMPLE_RATE) == 0x0:
  382. self.ui.cb_samplerate.setEnabled(False)
  383. if (driverDeviceInfo['hints'] & ENGINE_DRIVER_DEVICE_HAS_CONTROL_PANEL) == 0x0:
  384. self.ui.b_panel.setEnabled(False)
  385. # -------------------------------------------------------------------------------------------------------------
  386. # Set-up connections
  387. self.ui.b_panel.clicked.connect(self.slot_showDevicePanel)
  388. # -----------------------------------------------------------------------------------------------------------------
  389. def getValues(self):
  390. audioDevice = self.ui.cb_device.currentText()
  391. bufferSize = self.ui.cb_buffersize.currentText()
  392. sampleRate = self.ui.cb_samplerate.currentText()
  393. if bufferSize == DriverSettingsW.AUTOMATIC_OPTION:
  394. bufferSize = "0"
  395. if sampleRate == DriverSettingsW.AUTOMATIC_OPTION:
  396. sampleRate = "0"
  397. return (audioDevice, int(bufferSize), int(sampleRate))
  398. # -----------------------------------------------------------------------------------------------------------------
  399. @pyqtSlot()
  400. def slot_showDevicePanel(self):
  401. self.host.show_engine_device_control_panel()
  402. # ---------------------------------------------------------------------------------------------------------------------
  403. # Settings Dialog
  404. class CarlaSettingsW(QDialog):
  405. # Tab indexes
  406. TAB_INDEX_MAIN = 0
  407. TAB_INDEX_CANVAS = 1
  408. TAB_INDEX_ENGINE = 2
  409. TAB_INDEX_OSC = 3
  410. TAB_INDEX_FILEPATHS = 4
  411. TAB_INDEX_PLUGINPATHS = 5
  412. TAB_INDEX_WINE = 6
  413. TAB_INDEX_EXPERIMENTAL = 7
  414. TAB_INDEX_NONE = 8
  415. # File Path indexes
  416. FILEPATH_INDEX_AUDIO = 0
  417. FILEPATH_INDEX_MIDI = 1
  418. # Plugin Path indexes
  419. PLUGINPATH_INDEX_LADSPA = 0
  420. PLUGINPATH_INDEX_DSSI = 1
  421. PLUGINPATH_INDEX_LV2 = 2
  422. PLUGINPATH_INDEX_VST2 = 3
  423. PLUGINPATH_INDEX_VST3 = 4
  424. PLUGINPATH_INDEX_SF2 = 5
  425. PLUGINPATH_INDEX_SFZ = 6
  426. PLUGINPATH_INDEX_JSFX = 7
  427. PLUGINPATH_INDEX_CLAP = 8
  428. # Single and Multiple client mode is only for JACK,
  429. # but we still want to match QComboBox index to backend defines,
  430. # so add +2 pos padding if driverName != "JACK".
  431. PROCESS_MODE_NON_JACK_PADDING = 2
  432. # -----------------------------------------------------------------------------------------------------------------
  433. def __init__(self, parent, host, hasCanvas, hasCanvasGL):
  434. QDialog.__init__(self, parent)
  435. self.host = host
  436. self.ui = ui_carla_settings.Ui_CarlaSettingsW()
  437. self.ui.setupUi(self)
  438. # -------------------------------------------------------------------------------------------------------------
  439. # Set-up GUI
  440. self.ui.lw_page.setFixedWidth(48 + 6*3 +
  441. fontMetricsHorizontalAdvance(self.ui.lw_page.fontMetrics(), " Experimental "))
  442. for i in range(host.get_engine_driver_count()):
  443. self.ui.cb_engine_audio_driver.addItem(host.get_engine_driver_name(i))
  444. for i in range(Theme.THEME_MAX):
  445. self.ui.cb_canvas_theme.addItem(getThemeName(i))
  446. if MACOS:
  447. self.ui.group_main_theme.setEnabled(False)
  448. self.ui.group_main_theme.setVisible(False)
  449. if WINDOWS or host.isControl:
  450. self.ui.ch_main_show_logs.setEnabled(False)
  451. self.ui.ch_main_show_logs.setVisible(False)
  452. if host.isControl:
  453. self.ui.lw_page.hideRow(self.TAB_INDEX_ENGINE)
  454. self.ui.lw_page.hideRow(self.TAB_INDEX_FILEPATHS)
  455. self.ui.lw_page.hideRow(self.TAB_INDEX_PLUGINPATHS)
  456. self.ui.ch_exp_export_lv2.hide()
  457. self.ui.group_experimental_engine.hide()
  458. self.ui.cb_canvas_inline_displays.hide()
  459. elif not hasCanvas:
  460. self.ui.lw_page.hideRow(self.TAB_INDEX_CANVAS)
  461. elif not hasCanvasGL:
  462. self.ui.cb_canvas_use_opengl.setEnabled(False)
  463. self.ui.cb_canvas_render_hq_aa.setEnabled(False)
  464. if host.isPlugin:
  465. self.ui.cb_engine_audio_driver.setEnabled(False)
  466. if host.audioDriverForced is not None:
  467. self.ui.cb_engine_audio_driver.setEnabled(False)
  468. self.ui.tb_engine_driver_config.setEnabled(False)
  469. if host.processModeForced:
  470. self.ui.cb_engine_process_mode_jack.setEnabled(False)
  471. self.ui.cb_engine_process_mode_other.setEnabled(False)
  472. if self.host.processMode == ENGINE_PROCESS_MODE_CONTINUOUS_RACK:
  473. self.ui.ch_engine_force_stereo.setEnabled(False)
  474. if host.isControl or host.isPlugin:
  475. self.ui.ch_main_confirm_exit.hide()
  476. self.ui.ch_exp_load_lib_global.hide()
  477. self.ui.lw_page.hideRow(self.TAB_INDEX_OSC)
  478. self.ui.lw_page.hideRow(self.TAB_INDEX_WINE)
  479. if not LINUX:
  480. self.ui.ch_exp_wine_bridges.setVisible(False)
  481. self.ui.ch_exp_prevent_bad_behaviour.setVisible(False)
  482. self.ui.lw_page.hideRow(self.TAB_INDEX_WINE)
  483. if not MACOS:
  484. self.ui.label_engine_ui_bridges_mac_note.setVisible(False)
  485. if not (LINUX or MACOS):
  486. self.ui.ch_exp_jack_apps.setVisible(False)
  487. # FIXME, not implemented yet
  488. self.ui.ch_engine_uis_always_on_top.hide()
  489. # FIXME broken in some Qt5 versions
  490. self.ui.cb_canvas_eyecandy.setEnabled(QT_VERSION >= 0x50c00)
  491. self.setWindowFlags(self.windowFlags() & ~Qt.WindowContextHelpButtonHint)
  492. if MACOS:
  493. self.setWindowModality(Qt.WindowModal)
  494. # -------------------------------------------------------------------------------------------------------------
  495. # Load settings
  496. self.loadSettings()
  497. # -------------------------------------------------------------------------------------------------------------
  498. # Set-up Icons
  499. if self.ui.ch_main_system_icons.isChecked():
  500. self.ui.b_main_proj_folder_open.setIcon(getIcon('document-open', 16, 'svgz'))
  501. self.ui.b_filepaths_add.setIcon(getIcon('list-add', 16, 'svgz'))
  502. self.ui.b_filepaths_change.setIcon(getIcon('edit-rename', 16, 'svgz'))
  503. self.ui.b_filepaths_remove.setIcon(getIcon('list-remove', 16, 'svgz'))
  504. self.ui.b_paths_add.setIcon(getIcon('list-add', 16, 'svgz'))
  505. self.ui.b_paths_change.setIcon(getIcon('edit-rename', 16, 'svgz'))
  506. self.ui.b_paths_remove.setIcon(getIcon('list-remove', 16, 'svgz'))
  507. # -------------------------------------------------------------------------------------------------------------
  508. # Set-up connections
  509. self.accepted.connect(self.slot_saveSettings)
  510. self.ui.buttonBox.button(QDialogButtonBox.Reset).clicked.connect(self.slot_resetSettings)
  511. self.ui.b_main_proj_folder_open.clicked.connect(self.slot_getAndSetProjectPath)
  512. self.ui.cb_engine_audio_driver.currentIndexChanged.connect(self.slot_engineAudioDriverChanged)
  513. self.ui.tb_engine_driver_config.clicked.connect(self.slot_showAudioDriverSettings)
  514. self.ui.b_paths_add.clicked.connect(self.slot_addPluginPath)
  515. self.ui.b_paths_remove.clicked.connect(self.slot_removePluginPath)
  516. self.ui.b_paths_change.clicked.connect(self.slot_changePluginPath)
  517. self.ui.cb_paths.currentIndexChanged.connect(self.slot_pluginPathTabChanged)
  518. self.ui.lw_ladspa.currentRowChanged.connect(self.slot_pluginPathRowChanged)
  519. self.ui.lw_dssi.currentRowChanged.connect(self.slot_pluginPathRowChanged)
  520. self.ui.lw_lv2.currentRowChanged.connect(self.slot_pluginPathRowChanged)
  521. self.ui.lw_vst.currentRowChanged.connect(self.slot_pluginPathRowChanged)
  522. self.ui.lw_vst3.currentRowChanged.connect(self.slot_pluginPathRowChanged)
  523. self.ui.lw_sf2.currentRowChanged.connect(self.slot_pluginPathRowChanged)
  524. self.ui.lw_sfz.currentRowChanged.connect(self.slot_pluginPathRowChanged)
  525. self.ui.lw_jsfx.currentRowChanged.connect(self.slot_pluginPathRowChanged)
  526. self.ui.lw_clap.currentRowChanged.connect(self.slot_pluginPathRowChanged)
  527. self.ui.b_filepaths_add.clicked.connect(self.slot_addFilePath)
  528. self.ui.b_filepaths_remove.clicked.connect(self.slot_removeFilePath)
  529. self.ui.b_filepaths_change.clicked.connect(self.slot_changeFilePath)
  530. self.ui.cb_filepaths.currentIndexChanged.connect(self.slot_filePathTabChanged)
  531. self.ui.lw_files_audio.currentRowChanged.connect(self.slot_filePathRowChanged)
  532. self.ui.lw_files_midi.currentRowChanged.connect(self.slot_filePathRowChanged)
  533. self.ui.ch_main_experimental.toggled.connect(self.slot_enableExperimental)
  534. self.ui.ch_exp_wine_bridges.toggled.connect(self.slot_enableWineBridges)
  535. self.ui.cb_exp_plugin_bridges.toggled.connect(self.slot_pluginBridgesToggled)
  536. self.ui.cb_canvas_eyecandy.toggled.connect(self.slot_canvasEyeCandyToggled)
  537. #self.ui.cb_canvas_fancy_eyecandy.toggled.connect(self.slot_canvasFancyEyeCandyToggled)
  538. self.ui.cb_canvas_use_opengl.toggled.connect(self.slot_canvasOpenGLToggled)
  539. # -------------------------------------------------------------------------------------------------------------
  540. # Post-connect setup
  541. self.ui.lw_ladspa.setCurrentRow(0)
  542. self.ui.lw_dssi.setCurrentRow(0)
  543. self.ui.lw_lv2.setCurrentRow(0)
  544. self.ui.lw_vst.setCurrentRow(0)
  545. self.ui.lw_vst3.setCurrentRow(0)
  546. self.ui.lw_sf2.setCurrentRow(0)
  547. self.ui.lw_sfz.setCurrentRow(0)
  548. self.ui.lw_jsfx.setCurrentRow(0)
  549. self.ui.lw_clap.setCurrentRow(0)
  550. self.ui.lw_files_audio.setCurrentRow(0)
  551. self.ui.lw_files_midi.setCurrentRow(0)
  552. self.ui.lw_page.setCurrentCell(0, 0)
  553. self.slot_filePathTabChanged(0)
  554. self.slot_pluginPathTabChanged(0)
  555. self.adjustSize()
  556. # -----------------------------------------------------------------------------------------------------------------
  557. def loadSettings(self):
  558. settings = QSafeSettings()
  559. # -------------------------------------------------------------------------------------------------------------
  560. # Main
  561. self.ui.ch_main_show_logs.setChecked(self.host.showLogs)
  562. self.ui.ch_engine_uis_always_on_top.setChecked(self.host.uisAlwaysOnTop)
  563. self.ui.le_main_proj_folder.setText(
  564. settings.value(CARLA_KEY_MAIN_PROJECT_FOLDER, CARLA_DEFAULT_MAIN_PROJECT_FOLDER, str))
  565. self.ui.ch_main_theme_pro.setChecked(self.ui.group_main_theme.isEnabled() and
  566. settings.value(CARLA_KEY_MAIN_USE_PRO_THEME,
  567. CARLA_DEFAULT_MAIN_USE_PRO_THEME, bool))
  568. self.ui.cb_main_theme_color.setCurrentIndex(
  569. self.ui.cb_main_theme_color.findText(settings.value(CARLA_KEY_MAIN_PRO_THEME_COLOR,
  570. CARLA_DEFAULT_MAIN_PRO_THEME_COLOR, str)))
  571. self.ui.sb_main_refresh_interval.setValue(
  572. settings.value(CARLA_KEY_MAIN_REFRESH_INTERVAL, CARLA_DEFAULT_MAIN_REFRESH_INTERVAL, int))
  573. self.ui.ch_main_confirm_exit.setChecked(
  574. settings.value(CARLA_KEY_MAIN_CONFIRM_EXIT, CARLA_DEFAULT_MAIN_CONFIRM_EXIT, bool))
  575. self.ui.cb_main_classic_skin_default.setChecked(
  576. settings.value(CARLA_KEY_MAIN_CLASSIC_SKIN, CARLA_DEFAULT_MAIN_CLASSIC_SKIN, bool))
  577. self.ui.ch_main_system_icons.setChecked(
  578. settings.value(CARLA_KEY_MAIN_SYSTEM_ICONS, CARLA_DEFAULT_MAIN_SYSTEM_ICONS, bool))
  579. # -------------------------------------------------------------------------------------------------------------
  580. # Canvas
  581. self.ui.cb_canvas_theme.setCurrentIndex(
  582. self.ui.cb_canvas_theme.findText(settings.value(CARLA_KEY_CANVAS_THEME, CARLA_DEFAULT_CANVAS_THEME, str)))
  583. self.ui.cb_canvas_size.setCurrentIndex(
  584. self.ui.cb_canvas_size.findText(settings.value(CARLA_KEY_CANVAS_SIZE, CARLA_DEFAULT_CANVAS_SIZE, str)))
  585. self.ui.cb_canvas_bezier_lines.setChecked(
  586. settings.value(CARLA_KEY_CANVAS_USE_BEZIER_LINES, CARLA_DEFAULT_CANVAS_USE_BEZIER_LINES, bool))
  587. self.ui.cb_canvas_hide_groups.setChecked(
  588. settings.value(CARLA_KEY_CANVAS_AUTO_HIDE_GROUPS, CARLA_DEFAULT_CANVAS_AUTO_HIDE_GROUPS, bool))
  589. self.ui.cb_canvas_auto_select.setChecked(
  590. settings.value(CARLA_KEY_CANVAS_AUTO_SELECT_ITEMS, CARLA_DEFAULT_CANVAS_AUTO_SELECT_ITEMS, bool))
  591. if self.ui.cb_canvas_eyecandy.isEnabled():
  592. self.ui.cb_canvas_eyecandy.setChecked(
  593. settings.value(CARLA_KEY_CANVAS_EYE_CANDY, CARLA_DEFAULT_CANVAS_EYE_CANDY, bool))
  594. self.ui.cb_canvas_fancy_eyecandy.setChecked(
  595. settings.value(CARLA_KEY_CANVAS_FANCY_EYE_CANDY, CARLA_DEFAULT_CANVAS_FANCY_EYE_CANDY, bool))
  596. self.ui.cb_canvas_use_opengl.setChecked(self.ui.cb_canvas_use_opengl.isEnabled() and
  597. settings.value(CARLA_KEY_CANVAS_USE_OPENGL,
  598. CARLA_DEFAULT_CANVAS_USE_OPENGL, bool))
  599. self.ui.cb_canvas_render_aa.setCheckState(
  600. settings.value(CARLA_KEY_CANVAS_ANTIALIASING, CARLA_DEFAULT_CANVAS_ANTIALIASING, int))
  601. self.ui.cb_canvas_render_hq_aa.setChecked(self.ui.cb_canvas_render_hq_aa.isEnabled() and
  602. settings.value(CARLA_KEY_CANVAS_HQ_ANTIALIASING,
  603. CARLA_DEFAULT_CANVAS_HQ_ANTIALIASING, bool))
  604. self.ui.cb_canvas_full_repaints.setChecked(
  605. settings.value(CARLA_KEY_CANVAS_FULL_REPAINTS, CARLA_DEFAULT_CANVAS_FULL_REPAINTS, bool))
  606. self.ui.cb_canvas_inline_displays.setChecked(
  607. settings.value(CARLA_KEY_CANVAS_INLINE_DISPLAYS, CARLA_DEFAULT_CANVAS_INLINE_DISPLAYS, bool))
  608. # -------------------------------------------------------------------------------------------------------------
  609. settings = QSafeSettings("falkTX", "Carla2")
  610. # -------------------------------------------------------------------------------------------------------------
  611. # Main
  612. self.ui.ch_main_experimental.setChecked(self.host.experimental)
  613. if not self.host.experimental:
  614. self.ui.lw_page.hideRow(self.TAB_INDEX_EXPERIMENTAL)
  615. self.ui.lw_page.hideRow(self.TAB_INDEX_WINE)
  616. elif not self.host.showWineBridges:
  617. self.ui.lw_page.hideRow(self.TAB_INDEX_WINE)
  618. # -------------------------------------------------------------------------------------------------------------
  619. # Engine
  620. if self.host.isPlugin:
  621. audioDriver = "Plugin"
  622. self.ui.cb_engine_audio_driver.setCurrentIndex(0)
  623. elif self.host.audioDriverForced:
  624. audioDriver = self.host.audioDriverForced
  625. self.ui.cb_engine_audio_driver.setCurrentIndex(0)
  626. else:
  627. audioDriver = settings.value(CARLA_KEY_ENGINE_AUDIO_DRIVER, CARLA_DEFAULT_AUDIO_DRIVER, str)
  628. for i in range(self.ui.cb_engine_audio_driver.count()):
  629. if self.ui.cb_engine_audio_driver.itemText(i) == audioDriver:
  630. self.ui.cb_engine_audio_driver.setCurrentIndex(i)
  631. break
  632. else:
  633. self.ui.cb_engine_audio_driver.setCurrentIndex(-1)
  634. if audioDriver == "JACK":
  635. self.ui.sw_engine_process_mode.setCurrentIndex(0)
  636. else:
  637. self.ui.sw_engine_process_mode.setCurrentIndex(1)
  638. self.ui.tb_engine_driver_config.setEnabled(self.host.audioDriverForced is None and not self.host.isPlugin)
  639. self.ui.cb_engine_process_mode_jack.setCurrentIndex(self.host.nextProcessMode)
  640. if self.host.nextProcessMode >= self.PROCESS_MODE_NON_JACK_PADDING:
  641. self.ui.cb_engine_process_mode_other.setCurrentIndex(self.host.nextProcessMode -
  642. self.PROCESS_MODE_NON_JACK_PADDING)
  643. else:
  644. self.ui.cb_engine_process_mode_other.setCurrentIndex(0)
  645. self.ui.sb_engine_max_params.setValue(self.host.maxParameters)
  646. self.ui.cb_engine_reset_xruns.setChecked(self.host.resetXruns)
  647. self.ui.ch_engine_manage_uis.setChecked(self.host.manageUIs)
  648. self.ui.ch_engine_prefer_ui_bridges.setChecked(self.host.preferUIBridges)
  649. self.ui.sb_engine_ui_bridges_timeout.setValue(self.host.uiBridgesTimeout)
  650. self.ui.ch_engine_force_stereo.setChecked(self.host.forceStereo or
  651. not self.ui.ch_engine_force_stereo.isEnabled())
  652. self.ui.ch_engine_prefer_plugin_bridges.setChecked(self.host.preferPluginBridges)
  653. self.ui.ch_exp_export_lv2.setChecked(self.host.exportLV2)
  654. self.ui.cb_exp_plugin_bridges.setChecked(self.host.showPluginBridges)
  655. self.ui.ch_exp_wine_bridges.setChecked(self.host.showWineBridges)
  656. # -------------------------------------------------------------------------------------------------------------
  657. # OSC
  658. self.ui.ch_osc_enable.setChecked(
  659. settings.value(CARLA_KEY_OSC_ENABLED, CARLA_DEFAULT_OSC_ENABLED, bool))
  660. self.ui.group_osc_tcp_port.setChecked(
  661. settings.value(CARLA_KEY_OSC_TCP_PORT_ENABLED, CARLA_DEFAULT_OSC_TCP_PORT_ENABLED, bool))
  662. self.ui.group_osc_udp_port.setChecked(
  663. settings.value(CARLA_KEY_OSC_UDP_PORT_ENABLED, CARLA_DEFAULT_OSC_UDP_PORT_ENABLED, bool))
  664. self.ui.sb_osc_tcp_port_number.setValue(
  665. settings.value(CARLA_KEY_OSC_TCP_PORT_NUMBER, CARLA_DEFAULT_OSC_TCP_PORT_NUMBER, int))
  666. self.ui.sb_osc_udp_port_number.setValue(
  667. settings.value(CARLA_KEY_OSC_UDP_PORT_NUMBER, CARLA_DEFAULT_OSC_UDP_PORT_NUMBER, int))
  668. if settings.value(CARLA_KEY_OSC_TCP_PORT_RANDOM, CARLA_DEFAULT_OSC_TCP_PORT_RANDOM, bool):
  669. self.ui.rb_osc_tcp_port_specific.setChecked(False)
  670. self.ui.rb_osc_tcp_port_random.setChecked(True)
  671. else:
  672. self.ui.rb_osc_tcp_port_random.setChecked(False)
  673. self.ui.rb_osc_tcp_port_specific.setChecked(True)
  674. if settings.value(CARLA_KEY_OSC_UDP_PORT_RANDOM, CARLA_DEFAULT_OSC_UDP_PORT_RANDOM, bool):
  675. self.ui.rb_osc_udp_port_specific.setChecked(False)
  676. self.ui.rb_osc_udp_port_random.setChecked(True)
  677. else:
  678. self.ui.rb_osc_udp_port_random.setChecked(False)
  679. self.ui.rb_osc_udp_port_specific.setChecked(True)
  680. # -------------------------------------------------------------------------------------------------------------
  681. # File Paths
  682. audioPaths = settings.value(CARLA_KEY_PATHS_AUDIO, CARLA_DEFAULT_FILE_PATH_AUDIO, list)
  683. midiPaths = settings.value(CARLA_KEY_PATHS_MIDI, CARLA_DEFAULT_FILE_PATH_MIDI, list)
  684. audioPaths.sort()
  685. midiPaths.sort()
  686. for audioPath in audioPaths:
  687. if not audioPath:
  688. continue
  689. self.ui.lw_files_audio.addItem(audioPath)
  690. for midiPath in midiPaths:
  691. if not midiPath:
  692. continue
  693. self.ui.lw_files_midi.addItem(midiPath)
  694. # -------------------------------------------------------------------------------------------------------------
  695. # Plugin Paths
  696. ladspas = settings.value(CARLA_KEY_PATHS_LADSPA, CARLA_DEFAULT_LADSPA_PATH, list)
  697. dssis = settings.value(CARLA_KEY_PATHS_DSSI, CARLA_DEFAULT_DSSI_PATH, list)
  698. lv2s = settings.value(CARLA_KEY_PATHS_LV2, CARLA_DEFAULT_LV2_PATH, list)
  699. vst2s = settings.value(CARLA_KEY_PATHS_VST2, CARLA_DEFAULT_VST2_PATH, list)
  700. vst3s = settings.value(CARLA_KEY_PATHS_VST3, CARLA_DEFAULT_VST3_PATH, list)
  701. sf2s = settings.value(CARLA_KEY_PATHS_SF2, CARLA_DEFAULT_SF2_PATH, list)
  702. sfzs = settings.value(CARLA_KEY_PATHS_SFZ, CARLA_DEFAULT_SFZ_PATH, list)
  703. jsfxs = settings.value(CARLA_KEY_PATHS_JSFX, CARLA_DEFAULT_JSFX_PATH, list)
  704. claps = settings.value(CARLA_KEY_PATHS_CLAP, CARLA_DEFAULT_CLAP_PATH, list)
  705. ladspas.sort()
  706. dssis.sort()
  707. lv2s.sort()
  708. vst2s.sort()
  709. vst3s.sort()
  710. sf2s.sort()
  711. sfzs.sort()
  712. jsfxs.sort()
  713. claps.sort()
  714. for ladspa in ladspas:
  715. if not ladspa:
  716. continue
  717. self.ui.lw_ladspa.addItem(ladspa)
  718. for dssi in dssis:
  719. if not dssi:
  720. continue
  721. self.ui.lw_dssi.addItem(dssi)
  722. for lv2 in lv2s:
  723. if not lv2:
  724. continue
  725. self.ui.lw_lv2.addItem(lv2)
  726. for vst2 in vst2s:
  727. if not vst2:
  728. continue
  729. self.ui.lw_vst.addItem(vst2)
  730. for vst3 in vst3s:
  731. if not vst3:
  732. continue
  733. self.ui.lw_vst3.addItem(vst3)
  734. for sf2 in sf2s:
  735. if not sf2:
  736. continue
  737. self.ui.lw_sf2.addItem(sf2)
  738. for sfz in sfzs:
  739. if not sfz:
  740. continue
  741. self.ui.lw_sfz.addItem(sfz)
  742. for jsfx in jsfxs:
  743. if not jsfx:
  744. continue
  745. self.ui.lw_jsfx.addItem(jsfx)
  746. for clap in claps:
  747. if not clap:
  748. continue
  749. self.ui.lw_clap.addItem(clap)
  750. # -------------------------------------------------------------------------------------------------------------
  751. # Wine
  752. self.ui.le_wine_exec.setText(
  753. settings.value(CARLA_KEY_WINE_EXECUTABLE, CARLA_DEFAULT_WINE_EXECUTABLE, str))
  754. self.ui.cb_wine_prefix_detect.setChecked(
  755. settings.value(CARLA_KEY_WINE_AUTO_PREFIX, CARLA_DEFAULT_WINE_AUTO_PREFIX, bool))
  756. self.ui.le_wine_prefix_fallback.setText(
  757. settings.value(CARLA_KEY_WINE_FALLBACK_PREFIX, CARLA_DEFAULT_WINE_FALLBACK_PREFIX, str))
  758. self.ui.group_wine_realtime.setChecked(
  759. settings.value(CARLA_KEY_WINE_RT_PRIO_ENABLED, CARLA_DEFAULT_WINE_RT_PRIO_ENABLED, bool))
  760. self.ui.sb_wine_base_prio.setValue(
  761. settings.value(CARLA_KEY_WINE_BASE_RT_PRIO, CARLA_DEFAULT_WINE_BASE_RT_PRIO, int))
  762. self.ui.sb_wine_server_prio.setValue(
  763. settings.value(CARLA_KEY_WINE_SERVER_RT_PRIO, CARLA_DEFAULT_WINE_SERVER_RT_PRIO, int))
  764. # -------------------------------------------------------------------------------------------------------------
  765. # Experimental
  766. self.ui.ch_exp_jack_apps.setChecked(
  767. settings.value(CARLA_KEY_EXPERIMENTAL_JACK_APPS, CARLA_DEFAULT_EXPERIMENTAL_JACK_APPS, bool))
  768. self.ui.ch_exp_export_lv2.setChecked(
  769. settings.value(CARLA_KEY_EXPERIMENTAL_EXPORT_LV2, CARLA_DEFAULT_EXPERIMENTAL_LV2_EXPORT, bool))
  770. self.ui.ch_exp_load_lib_global.setChecked(
  771. settings.value(CARLA_KEY_EXPERIMENTAL_LOAD_LIB_GLOBAL, CARLA_DEFAULT_EXPERIMENTAL_LOAD_LIB_GLOBAL, bool))
  772. self.ui.ch_exp_prevent_bad_behaviour.setChecked(
  773. settings.value(CARLA_KEY_EXPERIMENTAL_PREVENT_BAD_BEHAVIOUR,
  774. CARLA_DEFAULT_EXPERIMENTAL_PREVENT_BAD_BEHAVIOUR, bool))
  775. # -----------------------------------------------------------------------------------------------------------------
  776. @pyqtSlot()
  777. def slot_saveSettings(self):
  778. settings = QSafeSettings()
  779. self.host.experimental = self.ui.ch_main_experimental.isChecked()
  780. if not self.host.experimental:
  781. self.resetExperimentalSettings()
  782. # -------------------------------------------------------------------------------------------------------------
  783. # Main
  784. settings.setValue(CARLA_KEY_MAIN_PROJECT_FOLDER, self.ui.le_main_proj_folder.text())
  785. settings.setValue(CARLA_KEY_MAIN_CONFIRM_EXIT, self.ui.ch_main_confirm_exit.isChecked())
  786. settings.setValue(CARLA_KEY_MAIN_CLASSIC_SKIN, self.ui.cb_main_classic_skin_default.isChecked())
  787. settings.setValue(CARLA_KEY_MAIN_USE_PRO_THEME, self.ui.ch_main_theme_pro.isChecked())
  788. settings.setValue(CARLA_KEY_MAIN_PRO_THEME_COLOR, self.ui.cb_main_theme_color.currentText())
  789. settings.setValue(CARLA_KEY_MAIN_REFRESH_INTERVAL, self.ui.sb_main_refresh_interval.value())
  790. settings.setValue(CARLA_KEY_MAIN_SYSTEM_ICONS, self.ui.ch_main_system_icons.isChecked())
  791. # -------------------------------------------------------------------------------------------------------------
  792. # Canvas
  793. settings.setValue(CARLA_KEY_CANVAS_THEME, self.ui.cb_canvas_theme.currentText())
  794. settings.setValue(CARLA_KEY_CANVAS_SIZE, self.ui.cb_canvas_size.currentText())
  795. settings.setValue(CARLA_KEY_CANVAS_USE_BEZIER_LINES, self.ui.cb_canvas_bezier_lines.isChecked())
  796. settings.setValue(CARLA_KEY_CANVAS_AUTO_HIDE_GROUPS, self.ui.cb_canvas_hide_groups.isChecked())
  797. settings.setValue(CARLA_KEY_CANVAS_AUTO_SELECT_ITEMS, self.ui.cb_canvas_auto_select.isChecked())
  798. settings.setValue(CARLA_KEY_CANVAS_EYE_CANDY, self.ui.cb_canvas_eyecandy.isChecked())
  799. settings.setValue(CARLA_KEY_CANVAS_FANCY_EYE_CANDY, self.ui.cb_canvas_fancy_eyecandy.isChecked())
  800. settings.setValue(CARLA_KEY_CANVAS_USE_OPENGL, self.ui.cb_canvas_use_opengl.isChecked())
  801. settings.setValue(CARLA_KEY_CANVAS_HQ_ANTIALIASING, self.ui.cb_canvas_render_hq_aa.isChecked())
  802. # NOTE: checkState() 0, 1, 2 match their enum variants
  803. settings.setValue(CARLA_KEY_CANVAS_ANTIALIASING, self.ui.cb_canvas_render_aa.checkState())
  804. settings.setValue(CARLA_KEY_CANVAS_FULL_REPAINTS, self.ui.cb_canvas_full_repaints.isChecked())
  805. settings.setValue(CARLA_KEY_CANVAS_INLINE_DISPLAYS, self.ui.cb_canvas_inline_displays.isChecked())
  806. # -------------------------------------------------------------------------------------------------------------
  807. settings = QSafeSettings("falkTX", "Carla2")
  808. # -------------------------------------------------------------------------------------------------------------
  809. # Main
  810. settings.setValue(CARLA_KEY_MAIN_EXPERIMENTAL, self.host.experimental)
  811. # -------------------------------------------------------------------------------------------------------------
  812. # Engine
  813. audioDriver = self.ui.cb_engine_audio_driver.currentText()
  814. if audioDriver and self.host.audioDriverForced is None and not self.host.isPlugin:
  815. settings.setValue(CARLA_KEY_ENGINE_AUDIO_DRIVER, audioDriver)
  816. if not self.host.processModeForced:
  817. # engine sends callback if processMode really changes
  818. if audioDriver == "JACK":
  819. self.host.nextProcessMode = self.ui.cb_engine_process_mode_jack.currentIndex()
  820. else:
  821. self.host.nextProcessMode = (self.ui.cb_engine_process_mode_other.currentIndex() +
  822. self.PROCESS_MODE_NON_JACK_PADDING)
  823. settings.setValue(CARLA_KEY_ENGINE_PROCESS_MODE, self.host.nextProcessMode)
  824. self.host.exportLV2 = self.ui.ch_exp_export_lv2.isChecked()
  825. self.host.forceStereo = self.ui.ch_engine_force_stereo.isChecked()
  826. self.host.resetXruns = self.ui.cb_engine_reset_xruns.isChecked()
  827. self.host.maxParameters = self.ui.sb_engine_max_params.value()
  828. self.host.manageUIs = self.ui.ch_engine_manage_uis.isChecked()
  829. self.host.preferPluginBridges = self.ui.ch_engine_prefer_plugin_bridges.isChecked()
  830. self.host.preferUIBridges = self.ui.ch_engine_prefer_ui_bridges.isChecked()
  831. self.host.showLogs = self.ui.ch_main_show_logs.isChecked()
  832. self.host.showPluginBridges = self.ui.cb_exp_plugin_bridges.isChecked()
  833. self.host.showWineBridges = self.ui.ch_exp_wine_bridges.isChecked()
  834. self.host.uiBridgesTimeout = self.ui.sb_engine_ui_bridges_timeout.value()
  835. self.host.uisAlwaysOnTop = self.ui.ch_engine_uis_always_on_top.isChecked()
  836. if self.ui.ch_engine_force_stereo.isEnabled():
  837. settings.setValue(CARLA_KEY_ENGINE_FORCE_STEREO, self.host.forceStereo)
  838. settings.setValue(CARLA_KEY_MAIN_SHOW_LOGS, self.host.showLogs)
  839. settings.setValue(CARLA_KEY_ENGINE_MAX_PARAMETERS, self.host.maxParameters)
  840. settings.setValue(CARLA_KEY_ENGINE_RESET_XRUNS, self.host.resetXruns)
  841. settings.setValue(CARLA_KEY_ENGINE_MANAGE_UIS, self.host.manageUIs)
  842. settings.setValue(CARLA_KEY_ENGINE_PREFER_PLUGIN_BRIDGES, self.host.preferPluginBridges)
  843. settings.setValue(CARLA_KEY_ENGINE_PREFER_UI_BRIDGES, self.host.preferUIBridges)
  844. settings.setValue(CARLA_KEY_ENGINE_UI_BRIDGES_TIMEOUT, self.host.uiBridgesTimeout)
  845. settings.setValue(CARLA_KEY_ENGINE_UIS_ALWAYS_ON_TOP, self.host.uisAlwaysOnTop)
  846. settings.setValue(CARLA_KEY_EXPERIMENTAL_EXPORT_LV2, self.host.exportLV2)
  847. settings.setValue(CARLA_KEY_EXPERIMENTAL_PLUGIN_BRIDGES, self.host.showPluginBridges)
  848. settings.setValue(CARLA_KEY_EXPERIMENTAL_WINE_BRIDGES, self.host.showWineBridges)
  849. # -------------------------------------------------------------------------------------------------------------
  850. # OSC
  851. settings.setValue(CARLA_KEY_OSC_ENABLED, self.ui.ch_osc_enable.isChecked())
  852. settings.setValue(CARLA_KEY_OSC_TCP_PORT_ENABLED, self.ui.group_osc_tcp_port.isChecked())
  853. settings.setValue(CARLA_KEY_OSC_UDP_PORT_ENABLED, self.ui.group_osc_udp_port.isChecked())
  854. settings.setValue(CARLA_KEY_OSC_TCP_PORT_RANDOM, self.ui.rb_osc_tcp_port_random.isChecked())
  855. settings.setValue(CARLA_KEY_OSC_UDP_PORT_RANDOM, self.ui.rb_osc_udp_port_random.isChecked())
  856. settings.setValue(CARLA_KEY_OSC_TCP_PORT_NUMBER, self.ui.sb_osc_tcp_port_number.value())
  857. settings.setValue(CARLA_KEY_OSC_UDP_PORT_NUMBER, self.ui.sb_osc_udp_port_number.value())
  858. # -------------------------------------------------------------------------------------------------------------
  859. # File Paths
  860. audioPaths = []
  861. midiPaths = []
  862. for i in range(self.ui.lw_files_audio.count()):
  863. audioPaths.append(self.ui.lw_files_audio.item(i).text())
  864. for i in range(self.ui.lw_files_midi.count()):
  865. midiPaths.append(self.ui.lw_files_midi.item(i).text())
  866. self.host.set_engine_option(ENGINE_OPTION_FILE_PATH, FILE_AUDIO, splitter.join(audioPaths))
  867. self.host.set_engine_option(ENGINE_OPTION_FILE_PATH, FILE_MIDI, splitter.join(midiPaths))
  868. settings.setValue(CARLA_KEY_PATHS_AUDIO, audioPaths)
  869. settings.setValue(CARLA_KEY_PATHS_MIDI, midiPaths)
  870. # -------------------------------------------------------------------------------------------------------------
  871. # Plugin Paths
  872. ladspas = []
  873. dssis = []
  874. lv2s = []
  875. vst2s = []
  876. vst3s = []
  877. sf2s = []
  878. sfzs = []
  879. jsfxs = []
  880. claps = []
  881. for i in range(self.ui.lw_ladspa.count()):
  882. ladspas.append(self.ui.lw_ladspa.item(i).text())
  883. for i in range(self.ui.lw_dssi.count()):
  884. dssis.append(self.ui.lw_dssi.item(i).text())
  885. for i in range(self.ui.lw_lv2.count()):
  886. lv2s.append(self.ui.lw_lv2.item(i).text())
  887. for i in range(self.ui.lw_vst.count()):
  888. vst2s.append(self.ui.lw_vst.item(i).text())
  889. for i in range(self.ui.lw_vst3.count()):
  890. vst3s.append(self.ui.lw_vst3.item(i).text())
  891. for i in range(self.ui.lw_sf2.count()):
  892. sf2s.append(self.ui.lw_sf2.item(i).text())
  893. for i in range(self.ui.lw_sfz.count()):
  894. sfzs.append(self.ui.lw_sfz.item(i).text())
  895. for i in range(self.ui.lw_jsfx.count()):
  896. jsfxs.append(self.ui.lw_jsfx.item(i).text())
  897. for i in range(self.ui.lw_clap.count()):
  898. claps.append(self.ui.lw_clap.item(i).text())
  899. self.host.set_engine_option(ENGINE_OPTION_PLUGIN_PATH, PLUGIN_LADSPA, splitter.join(ladspas))
  900. self.host.set_engine_option(ENGINE_OPTION_PLUGIN_PATH, PLUGIN_DSSI, splitter.join(dssis))
  901. self.host.set_engine_option(ENGINE_OPTION_PLUGIN_PATH, PLUGIN_LV2, splitter.join(lv2s))
  902. self.host.set_engine_option(ENGINE_OPTION_PLUGIN_PATH, PLUGIN_VST2, splitter.join(vst2s))
  903. self.host.set_engine_option(ENGINE_OPTION_PLUGIN_PATH, PLUGIN_VST3, splitter.join(vst3s))
  904. self.host.set_engine_option(ENGINE_OPTION_PLUGIN_PATH, PLUGIN_SF2, splitter.join(sf2s))
  905. self.host.set_engine_option(ENGINE_OPTION_PLUGIN_PATH, PLUGIN_SFZ, splitter.join(sfzs))
  906. self.host.set_engine_option(ENGINE_OPTION_PLUGIN_PATH, PLUGIN_JSFX, splitter.join(jsfxs))
  907. self.host.set_engine_option(ENGINE_OPTION_PLUGIN_PATH, PLUGIN_CLAP, splitter.join(claps))
  908. settings.setValue(CARLA_KEY_PATHS_LADSPA, ladspas)
  909. settings.setValue(CARLA_KEY_PATHS_DSSI, dssis)
  910. settings.setValue(CARLA_KEY_PATHS_LV2, lv2s)
  911. settings.setValue(CARLA_KEY_PATHS_VST2, vst2s)
  912. settings.setValue(CARLA_KEY_PATHS_VST3, vst3s)
  913. settings.setValue(CARLA_KEY_PATHS_SF2, sf2s)
  914. settings.setValue(CARLA_KEY_PATHS_SFZ, sfzs)
  915. settings.setValue(CARLA_KEY_PATHS_JSFX, jsfxs)
  916. settings.setValue(CARLA_KEY_PATHS_CLAP, claps)
  917. # -------------------------------------------------------------------------------------------------------------
  918. # Wine
  919. settings.setValue(CARLA_KEY_WINE_EXECUTABLE, self.ui.le_wine_exec.text())
  920. settings.setValue(CARLA_KEY_WINE_AUTO_PREFIX, self.ui.cb_wine_prefix_detect.isChecked())
  921. settings.setValue(CARLA_KEY_WINE_FALLBACK_PREFIX, self.ui.le_wine_prefix_fallback.text())
  922. settings.setValue(CARLA_KEY_WINE_RT_PRIO_ENABLED, self.ui.group_wine_realtime.isChecked())
  923. settings.setValue(CARLA_KEY_WINE_BASE_RT_PRIO, self.ui.sb_wine_base_prio.value())
  924. settings.setValue(CARLA_KEY_WINE_SERVER_RT_PRIO, self.ui.sb_wine_server_prio.value())
  925. # -------------------------------------------------------------------------------------------------------------
  926. # Experimental
  927. settings.setValue(CARLA_KEY_EXPERIMENTAL_JACK_APPS, self.ui.ch_exp_jack_apps.isChecked())
  928. settings.setValue(CARLA_KEY_EXPERIMENTAL_LOAD_LIB_GLOBAL, self.ui.ch_exp_load_lib_global.isChecked())
  929. settings.setValue(CARLA_KEY_EXPERIMENTAL_PREVENT_BAD_BEHAVIOUR,
  930. self.ui.ch_exp_prevent_bad_behaviour.isChecked())
  931. # -----------------------------------------------------------------------------------------------------------------
  932. @pyqtSlot()
  933. def slot_resetSettings(self):
  934. currentRow = self.ui.lw_page.currentRow()
  935. # -------------------------------------------------------------------------------------------------------------
  936. # Main
  937. if currentRow == self.TAB_INDEX_MAIN:
  938. self.ui.le_main_proj_folder.setText(CARLA_DEFAULT_MAIN_PROJECT_FOLDER)
  939. self.ui.ch_main_theme_pro.setChecked(CARLA_DEFAULT_MAIN_USE_PRO_THEME and
  940. self.ui.group_main_theme.isEnabled())
  941. self.ui.cb_main_theme_color.setCurrentIndex(
  942. self.ui.cb_main_theme_color.findText(CARLA_DEFAULT_MAIN_PRO_THEME_COLOR))
  943. self.ui.sb_main_refresh_interval.setValue(CARLA_DEFAULT_MAIN_REFRESH_INTERVAL)
  944. self.ui.ch_main_confirm_exit.setChecked(CARLA_DEFAULT_MAIN_CONFIRM_EXIT)
  945. self.ui.cb_main_classic_skin_default(CARLA_DEFAULT_MAIN_CLASSIC_SKIN)
  946. self.ui.ch_main_show_logs.setChecked(CARLA_DEFAULT_MAIN_SHOW_LOGS)
  947. # -------------------------------------------------------------------------------------------------------------
  948. # Canvas
  949. elif currentRow == self.TAB_INDEX_CANVAS:
  950. self.ui.cb_canvas_theme.setCurrentIndex(self.ui.cb_canvas_theme.findText(CARLA_DEFAULT_CANVAS_THEME))
  951. self.ui.cb_canvas_size.setCurrentIndex(self.ui.cb_canvas_size.findText(CARLA_DEFAULT_CANVAS_SIZE))
  952. self.ui.cb_canvas_bezier_lines.setChecked(CARLA_DEFAULT_CANVAS_USE_BEZIER_LINES)
  953. self.ui.cb_canvas_hide_groups.setChecked(CARLA_DEFAULT_CANVAS_AUTO_HIDE_GROUPS)
  954. self.ui.cb_canvas_auto_select.setChecked(CARLA_DEFAULT_CANVAS_AUTO_SELECT_ITEMS)
  955. self.ui.cb_canvas_eyecandy.setChecked(CARLA_DEFAULT_CANVAS_EYE_CANDY and self.ui.cb_canvas_eyecandy.isEnabled())
  956. self.ui.cb_canvas_render_aa.setCheckState(Qt.PartiallyChecked) # CARLA_DEFAULT_CANVAS_ANTIALIASING
  957. self.ui.cb_canvas_full_repaints.setChecked(CARLA_DEFAULT_CANVAS_FULL_REPAINTS)
  958. # -------------------------------------------------------------------------------------------------------------
  959. # Engine
  960. elif currentRow == self.TAB_INDEX_ENGINE:
  961. if not self.host.isPlugin:
  962. self.ui.cb_engine_audio_driver.setCurrentIndex(0)
  963. if not self.host.processModeForced:
  964. if self.ui.cb_engine_audio_driver.currentText() == "JACK":
  965. self.ui.cb_engine_process_mode_jack.setCurrentIndex(CARLA_DEFAULT_PROCESS_MODE)
  966. self.ui.sw_engine_process_mode.setCurrentIndex(0) # show all modes
  967. else:
  968. self.ui.cb_engine_process_mode_other.setCurrentIndex(CARLA_DEFAULT_PROCESS_MODE -
  969. self.PROCESS_MODE_NON_JACK_PADDING)
  970. self.ui.sw_engine_process_mode.setCurrentIndex(1) # hide single+multi client modes
  971. self.ui.sb_engine_max_params.setValue(CARLA_DEFAULT_MAX_PARAMETERS)
  972. self.ui.cb_engine_reset_xruns.setChecked(CARLA_DEFAULT_RESET_XRUNS)
  973. self.ui.ch_engine_uis_always_on_top.setChecked(CARLA_DEFAULT_UIS_ALWAYS_ON_TOP)
  974. self.ui.ch_engine_prefer_ui_bridges.setChecked(CARLA_DEFAULT_PREFER_UI_BRIDGES)
  975. self.ui.sb_engine_ui_bridges_timeout.setValue(CARLA_DEFAULT_UI_BRIDGES_TIMEOUT)
  976. self.ui.ch_engine_manage_uis.setChecked(CARLA_DEFAULT_MANAGE_UIS)
  977. # -------------------------------------------------------------------------------------------------------------
  978. # OSC
  979. elif currentRow == self.TAB_INDEX_OSC:
  980. self.ui.ch_osc_enable.setChecked(CARLA_DEFAULT_OSC_ENABLED)
  981. self.ui.group_osc_tcp_port.setChecked(CARLA_DEFAULT_OSC_TCP_PORT_ENABLED)
  982. self.ui.group_osc_udp_port.setChecked(CARLA_DEFAULT_OSC_UDP_PORT_ENABLED)
  983. self.ui.sb_osc_tcp_port_number.setValue(CARLA_DEFAULT_OSC_TCP_PORT_NUMBER)
  984. self.ui.sb_osc_udp_port_number.setValue(CARLA_DEFAULT_OSC_UDP_PORT_NUMBER)
  985. if CARLA_DEFAULT_OSC_TCP_PORT_RANDOM:
  986. self.ui.rb_osc_tcp_port_specific.setChecked(False)
  987. self.ui.rb_osc_tcp_port_random.setChecked(True)
  988. else:
  989. self.ui.rb_osc_tcp_port_random.setChecked(False)
  990. self.ui.rb_osc_tcp_port_specific.setChecked(True)
  991. if CARLA_DEFAULT_OSC_UDP_PORT_RANDOM:
  992. self.ui.rb_osc_udp_port_specific.setChecked(False)
  993. self.ui.rb_osc_udp_port_random.setChecked(True)
  994. else:
  995. self.ui.rb_osc_udp_port_random.setChecked(False)
  996. self.ui.rb_osc_udp_port_specific.setChecked(True)
  997. # -------------------------------------------------------------------------------------------------------------
  998. # Plugin Paths
  999. elif currentRow == self.TAB_INDEX_FILEPATHS:
  1000. curIndex = self.ui.tw_filepaths.currentIndex()
  1001. if curIndex == self.FILEPATH_INDEX_AUDIO:
  1002. self.ui.lw_files_audio.clear()
  1003. elif curIndex == self.FILEPATH_INDEX_MIDI:
  1004. self.ui.lw_files_midi.clear()
  1005. # -------------------------------------------------------------------------------------------------------------
  1006. # Plugin Paths
  1007. elif currentRow == self.TAB_INDEX_PLUGINPATHS:
  1008. curIndex = self.ui.tw_paths.currentIndex()
  1009. if curIndex == self.PLUGINPATH_INDEX_LADSPA:
  1010. paths = CARLA_DEFAULT_LADSPA_PATH
  1011. paths.sort()
  1012. self.ui.lw_ladspa.clear()
  1013. for path in paths:
  1014. if not path:
  1015. continue
  1016. self.ui.lw_ladspa.addItem(path)
  1017. elif curIndex == self.PLUGINPATH_INDEX_DSSI:
  1018. paths = CARLA_DEFAULT_DSSI_PATH
  1019. paths.sort()
  1020. self.ui.lw_dssi.clear()
  1021. for path in paths:
  1022. if not path:
  1023. continue
  1024. self.ui.lw_dssi.addItem(path)
  1025. elif curIndex == self.PLUGINPATH_INDEX_LV2:
  1026. paths = CARLA_DEFAULT_LV2_PATH
  1027. paths.sort()
  1028. self.ui.lw_lv2.clear()
  1029. for path in paths:
  1030. if not path:
  1031. continue
  1032. self.ui.lw_lv2.addItem(path)
  1033. elif curIndex == self.PLUGINPATH_INDEX_VST2:
  1034. paths = CARLA_DEFAULT_VST2_PATH
  1035. paths.sort()
  1036. self.ui.lw_vst.clear()
  1037. for path in paths:
  1038. if not path:
  1039. continue
  1040. self.ui.lw_vst.addItem(path)
  1041. elif curIndex == self.PLUGINPATH_INDEX_VST3:
  1042. paths = CARLA_DEFAULT_VST3_PATH
  1043. paths.sort()
  1044. self.ui.lw_vst3.clear()
  1045. for path in paths:
  1046. if not path:
  1047. continue
  1048. self.ui.lw_vst3.addItem(path)
  1049. elif curIndex == self.PLUGINPATH_INDEX_SF2:
  1050. paths = CARLA_DEFAULT_SF2_PATH
  1051. paths.sort()
  1052. self.ui.lw_sf2.clear()
  1053. for path in paths:
  1054. if not path:
  1055. continue
  1056. self.ui.lw_sf2.addItem(path)
  1057. elif curIndex == self.PLUGINPATH_INDEX_SFZ:
  1058. paths = CARLA_DEFAULT_SFZ_PATH
  1059. paths.sort()
  1060. self.ui.lw_sfz.clear()
  1061. for path in paths:
  1062. if not path:
  1063. continue
  1064. self.ui.lw_sfz.addItem(path)
  1065. elif curIndex == self.PLUGINPATH_INDEX_JSFX:
  1066. paths = CARLA_DEFAULT_JSFX_PATH
  1067. paths.sort()
  1068. self.ui.lw_jsfx.clear()
  1069. for path in paths:
  1070. if not path:
  1071. continue
  1072. self.ui.lw_jsfx.addItem(path)
  1073. elif curIndex == self.PLUGINPATH_INDEX_CLAP:
  1074. paths = CARLA_DEFAULT_CLAP_PATH
  1075. paths.sort()
  1076. self.ui.lw_clap.clear()
  1077. for path in paths:
  1078. if not path:
  1079. continue
  1080. self.ui.lw_clap.addItem(path)
  1081. # -------------------------------------------------------------------------------------------------------------
  1082. # Wine
  1083. elif currentRow == self.TAB_INDEX_WINE:
  1084. self.ui.le_wine_exec.setText(CARLA_DEFAULT_WINE_EXECUTABLE)
  1085. self.ui.cb_wine_prefix_detect.setChecked(CARLA_DEFAULT_WINE_AUTO_PREFIX)
  1086. self.ui.le_wine_prefix_fallback.setText(CARLA_DEFAULT_WINE_FALLBACK_PREFIX)
  1087. self.ui.group_wine_realtime.setChecked(CARLA_DEFAULT_WINE_RT_PRIO_ENABLED)
  1088. self.ui.sb_wine_base_prio.setValue(CARLA_DEFAULT_WINE_BASE_RT_PRIO)
  1089. self.ui.sb_wine_server_prio.setValue(CARLA_DEFAULT_WINE_SERVER_RT_PRIO)
  1090. # -------------------------------------------------------------------------------------------------------------
  1091. # Experimental
  1092. elif currentRow == self.TAB_INDEX_EXPERIMENTAL:
  1093. self.resetExperimentalSettings()
  1094. def resetExperimentalSettings(self):
  1095. # Forever experimental
  1096. self.ui.cb_exp_plugin_bridges.setChecked(CARLA_DEFAULT_EXPERIMENTAL_PLUGIN_BRIDGES)
  1097. self.ui.ch_exp_wine_bridges.setChecked(CARLA_DEFAULT_EXPERIMENTAL_WINE_BRIDGES)
  1098. self.ui.ch_exp_jack_apps.setChecked(CARLA_DEFAULT_EXPERIMENTAL_JACK_APPS)
  1099. self.ui.ch_exp_export_lv2.setChecked(CARLA_DEFAULT_EXPERIMENTAL_LV2_EXPORT)
  1100. self.ui.ch_exp_load_lib_global.setChecked(CARLA_DEFAULT_EXPERIMENTAL_LOAD_LIB_GLOBAL)
  1101. self.ui.ch_exp_prevent_bad_behaviour.setChecked(CARLA_DEFAULT_EXPERIMENTAL_PREVENT_BAD_BEHAVIOUR)
  1102. # Temporary, until stable
  1103. self.ui.ch_main_system_icons.setChecked(CARLA_DEFAULT_MAIN_SYSTEM_ICONS)
  1104. self.ui.cb_canvas_fancy_eyecandy.setChecked(CARLA_DEFAULT_CANVAS_FANCY_EYE_CANDY)
  1105. self.ui.cb_canvas_use_opengl.setChecked(CARLA_DEFAULT_CANVAS_USE_OPENGL and
  1106. self.ui.cb_canvas_use_opengl.isEnabled())
  1107. self.ui.cb_canvas_render_hq_aa.setChecked(CARLA_DEFAULT_CANVAS_HQ_ANTIALIASING and
  1108. self.ui.cb_canvas_render_hq_aa.isEnabled())
  1109. self.ui.cb_canvas_inline_displays.setChecked(CARLA_DEFAULT_CANVAS_INLINE_DISPLAYS)
  1110. self.ui.ch_engine_force_stereo.setChecked(CARLA_DEFAULT_FORCE_STEREO)
  1111. self.ui.ch_engine_prefer_plugin_bridges.setChecked(CARLA_DEFAULT_PREFER_PLUGIN_BRIDGES)
  1112. # -----------------------------------------------------------------------------------------------------------------
  1113. @pyqtSlot(bool)
  1114. def slot_enableExperimental(self, toggled):
  1115. if toggled:
  1116. self.ui.lw_page.showRow(self.TAB_INDEX_EXPERIMENTAL)
  1117. if self.ui.ch_exp_wine_bridges.isChecked() and not self.host.isControl:
  1118. self.ui.lw_page.showRow(self.TAB_INDEX_WINE)
  1119. else:
  1120. self.ui.lw_page.hideRow(self.TAB_INDEX_EXPERIMENTAL)
  1121. self.ui.lw_page.hideRow(self.TAB_INDEX_WINE)
  1122. @pyqtSlot(bool)
  1123. def slot_enableWineBridges(self, toggled):
  1124. if toggled and not self.host.isControl:
  1125. self.ui.lw_page.showRow(self.TAB_INDEX_WINE)
  1126. else:
  1127. self.ui.lw_page.hideRow(self.TAB_INDEX_WINE)
  1128. @pyqtSlot(bool)
  1129. def slot_pluginBridgesToggled(self, toggled):
  1130. if not toggled:
  1131. self.ui.ch_exp_wine_bridges.setChecked(False)
  1132. self.ui.ch_engine_prefer_plugin_bridges.setChecked(False)
  1133. self.ui.lw_page.hideRow(self.TAB_INDEX_WINE)
  1134. @pyqtSlot(bool)
  1135. def slot_canvasEyeCandyToggled(self, toggled):
  1136. if not toggled:
  1137. # disable fancy eyecandy too
  1138. self.ui.cb_canvas_fancy_eyecandy.setChecked(False)
  1139. @pyqtSlot(bool)
  1140. def slot_canvasFancyEyeCandyToggled(self, toggled):
  1141. if toggled:
  1142. # make sure normal eyecandy is enabled too
  1143. self.ui.cb_canvas_eyecandy.setChecked(True)
  1144. @pyqtSlot(bool)
  1145. def slot_canvasOpenGLToggled(self, toggled):
  1146. if not toggled:
  1147. # uncheck GL specific option
  1148. self.ui.cb_canvas_render_hq_aa.setChecked(False)
  1149. # -----------------------------------------------------------------------------------------------------------------
  1150. @pyqtSlot()
  1151. def slot_getAndSetProjectPath(self):
  1152. # FIXME
  1153. getAndSetPath(self, self.ui.le_main_proj_folder)
  1154. # -----------------------------------------------------------------------------------------------------------------
  1155. @pyqtSlot()
  1156. def slot_engineAudioDriverChanged(self):
  1157. if self.ui.cb_engine_audio_driver.currentText() == "JACK":
  1158. self.ui.sw_engine_process_mode.setCurrentIndex(0)
  1159. else:
  1160. self.ui.sw_engine_process_mode.setCurrentIndex(1)
  1161. @pyqtSlot()
  1162. def slot_showAudioDriverSettings(self):
  1163. driverIndex = self.ui.cb_engine_audio_driver.currentIndex()
  1164. driverName = self.ui.cb_engine_audio_driver.currentText()
  1165. DriverSettingsW(self, self.host, driverIndex, driverName).exec_()
  1166. # -----------------------------------------------------------------------------------------------------------------
  1167. @pyqtSlot()
  1168. def slot_addPluginPath(self):
  1169. newPath = QFileDialog.getExistingDirectory(self, self.tr("Add Path"), "", QFileDialog.ShowDirsOnly)
  1170. if not newPath:
  1171. return
  1172. curIndex = self.ui.tw_paths.currentIndex()
  1173. if curIndex == self.PLUGINPATH_INDEX_LADSPA:
  1174. self.ui.lw_ladspa.addItem(newPath)
  1175. elif curIndex == self.PLUGINPATH_INDEX_DSSI:
  1176. self.ui.lw_dssi.addItem(newPath)
  1177. elif curIndex == self.PLUGINPATH_INDEX_LV2:
  1178. self.ui.lw_lv2.addItem(newPath)
  1179. elif curIndex == self.PLUGINPATH_INDEX_VST2:
  1180. self.ui.lw_vst.addItem(newPath)
  1181. elif curIndex == self.PLUGINPATH_INDEX_VST3:
  1182. self.ui.lw_vst3.addItem(newPath)
  1183. elif curIndex == self.PLUGINPATH_INDEX_SF2:
  1184. self.ui.lw_sf2.addItem(newPath)
  1185. elif curIndex == self.PLUGINPATH_INDEX_SFZ:
  1186. self.ui.lw_sfz.addItem(newPath)
  1187. elif curIndex == self.PLUGINPATH_INDEX_JSFX:
  1188. self.ui.lw_jsfx.addItem(newPath)
  1189. elif curIndex == self.PLUGINPATH_INDEX_CLAP:
  1190. self.ui.lw_clap.addItem(newPath)
  1191. @pyqtSlot()
  1192. def slot_removePluginPath(self):
  1193. curIndex = self.ui.tw_paths.currentIndex()
  1194. if curIndex == self.PLUGINPATH_INDEX_LADSPA:
  1195. self.ui.lw_ladspa.takeItem(self.ui.lw_ladspa.currentRow())
  1196. elif curIndex == self.PLUGINPATH_INDEX_DSSI:
  1197. self.ui.lw_dssi.takeItem(self.ui.lw_dssi.currentRow())
  1198. elif curIndex == self.PLUGINPATH_INDEX_LV2:
  1199. self.ui.lw_lv2.takeItem(self.ui.lw_lv2.currentRow())
  1200. elif curIndex == self.PLUGINPATH_INDEX_VST2:
  1201. self.ui.lw_vst.takeItem(self.ui.lw_vst.currentRow())
  1202. elif curIndex == self.PLUGINPATH_INDEX_VST3:
  1203. self.ui.lw_vst3.takeItem(self.ui.lw_vst3.currentRow())
  1204. elif curIndex == self.PLUGINPATH_INDEX_SF2:
  1205. self.ui.lw_sf2.takeItem(self.ui.lw_sf2.currentRow())
  1206. elif curIndex == self.PLUGINPATH_INDEX_SFZ:
  1207. self.ui.lw_sfz.takeItem(self.ui.lw_sfz.currentRow())
  1208. elif curIndex == self.PLUGINPATH_INDEX_JSFX:
  1209. self.ui.lw_jsfx.takeItem(self.ui.lw_jsfx.currentRow())
  1210. elif curIndex == self.PLUGINPATH_INDEX_CLAP:
  1211. self.ui.lw_clap.takeItem(self.ui.lw_clap.currentRow())
  1212. @pyqtSlot()
  1213. def slot_changePluginPath(self):
  1214. curIndex = self.ui.tw_paths.currentIndex()
  1215. if curIndex == self.PLUGINPATH_INDEX_LADSPA:
  1216. currentPath = self.ui.lw_ladspa.currentItem().text()
  1217. elif curIndex == self.PLUGINPATH_INDEX_DSSI:
  1218. currentPath = self.ui.lw_dssi.currentItem().text()
  1219. elif curIndex == self.PLUGINPATH_INDEX_LV2:
  1220. currentPath = self.ui.lw_lv2.currentItem().text()
  1221. elif curIndex == self.PLUGINPATH_INDEX_VST2:
  1222. currentPath = self.ui.lw_vst.currentItem().text()
  1223. elif curIndex == self.PLUGINPATH_INDEX_VST3:
  1224. currentPath = self.ui.lw_vst3.currentItem().text()
  1225. elif curIndex == self.PLUGINPATH_INDEX_SF2:
  1226. currentPath = self.ui.lw_sf2.currentItem().text()
  1227. elif curIndex == self.PLUGINPATH_INDEX_SFZ:
  1228. currentPath = self.ui.lw_sfz.currentItem().text()
  1229. elif curIndex == self.PLUGINPATH_INDEX_JSFX:
  1230. currentPath = self.ui.lw_jsfx.currentItem().text()
  1231. elif curIndex == self.PLUGINPATH_INDEX_CLAP:
  1232. currentPath = self.ui.lw_clap.currentItem().text()
  1233. else:
  1234. currentPath = ""
  1235. newPath = QFileDialog.getExistingDirectory(self, self.tr("Add Path"), currentPath, QFileDialog.ShowDirsOnly)
  1236. if not newPath:
  1237. return
  1238. if curIndex == self.PLUGINPATH_INDEX_LADSPA:
  1239. self.ui.lw_ladspa.currentItem().setText(newPath)
  1240. elif curIndex == self.PLUGINPATH_INDEX_DSSI:
  1241. self.ui.lw_dssi.currentItem().setText(newPath)
  1242. elif curIndex == self.PLUGINPATH_INDEX_LV2:
  1243. self.ui.lw_lv2.currentItem().setText(newPath)
  1244. elif curIndex == self.PLUGINPATH_INDEX_VST2:
  1245. self.ui.lw_vst.currentItem().setText(newPath)
  1246. elif curIndex == self.PLUGINPATH_INDEX_VST3:
  1247. self.ui.lw_vst3.currentItem().setText(newPath)
  1248. elif curIndex == self.PLUGINPATH_INDEX_SF2:
  1249. self.ui.lw_sf2.currentItem().setText(newPath)
  1250. elif curIndex == self.PLUGINPATH_INDEX_SFZ:
  1251. self.ui.lw_sfz.currentItem().setText(newPath)
  1252. elif curIndex == self.PLUGINPATH_INDEX_JSFX:
  1253. self.ui.lw_jsfx.currentItem().setText(newPath)
  1254. elif curIndex == self.PLUGINPATH_INDEX_CLAP:
  1255. self.ui.lw_clap.currentItem().setText(newPath)
  1256. # -----------------------------------------------------------------------------------------------------------------
  1257. @pyqtSlot(int)
  1258. def slot_pluginPathTabChanged(self, index):
  1259. if index == self.PLUGINPATH_INDEX_LADSPA:
  1260. row = self.ui.lw_ladspa.currentRow()
  1261. elif index == self.PLUGINPATH_INDEX_DSSI:
  1262. row = self.ui.lw_dssi.currentRow()
  1263. elif index == self.PLUGINPATH_INDEX_LV2:
  1264. row = self.ui.lw_lv2.currentRow()
  1265. elif index == self.PLUGINPATH_INDEX_VST2:
  1266. row = self.ui.lw_vst.currentRow()
  1267. elif index == self.PLUGINPATH_INDEX_VST3:
  1268. row = self.ui.lw_vst3.currentRow()
  1269. elif index == self.PLUGINPATH_INDEX_SF2:
  1270. row = self.ui.lw_sf2.currentRow()
  1271. elif index == self.PLUGINPATH_INDEX_SFZ:
  1272. row = self.ui.lw_sfz.currentRow()
  1273. elif index == self.PLUGINPATH_INDEX_JSFX:
  1274. row = self.ui.lw_jsfx.currentRow()
  1275. elif index == self.PLUGINPATH_INDEX_CLAP:
  1276. row = self.ui.lw_clap.currentRow()
  1277. else:
  1278. row = -1
  1279. self.slot_pluginPathRowChanged(row)
  1280. @pyqtSlot(int)
  1281. def slot_pluginPathRowChanged(self, row):
  1282. check = bool(row >= 0)
  1283. self.ui.b_paths_remove.setEnabled(check)
  1284. self.ui.b_paths_change.setEnabled(check)
  1285. # -----------------------------------------------------------------------------------------------------------------
  1286. @pyqtSlot()
  1287. def slot_addFilePath(self):
  1288. newPath = QFileDialog.getExistingDirectory(self, self.tr("Add Path"), "", QFileDialog.ShowDirsOnly)
  1289. if not newPath:
  1290. return
  1291. curIndex = self.ui.tw_filepaths.currentIndex()
  1292. if curIndex == self.FILEPATH_INDEX_AUDIO:
  1293. self.ui.lw_files_audio.addItem(newPath)
  1294. elif curIndex == self.FILEPATH_INDEX_MIDI:
  1295. self.ui.lw_files_midi.addItem(newPath)
  1296. @pyqtSlot()
  1297. def slot_removeFilePath(self):
  1298. curIndex = self.ui.tw_filepaths.currentIndex()
  1299. if curIndex == self.FILEPATH_INDEX_AUDIO:
  1300. self.ui.lw_files_audio.takeItem(self.ui.lw_files_audio.currentRow())
  1301. elif curIndex == self.FILEPATH_INDEX_MIDI:
  1302. self.ui.lw_files_midi.takeItem(self.ui.lw_files_midi.currentRow())
  1303. @pyqtSlot()
  1304. def slot_changeFilePath(self):
  1305. curIndex = self.ui.tw_filepaths.currentIndex()
  1306. if curIndex == self.FILEPATH_INDEX_AUDIO:
  1307. currentPath = self.ui.lw_files_audio.currentItem().text()
  1308. elif curIndex == self.FILEPATH_INDEX_MIDI:
  1309. currentPath = self.ui.lw_files_midi.currentItem().text()
  1310. else:
  1311. currentPath = ""
  1312. newPath = QFileDialog.getExistingDirectory(self, self.tr("Add Path"), currentPath, QFileDialog.ShowDirsOnly)
  1313. if not newPath:
  1314. return
  1315. if curIndex == self.FILEPATH_INDEX_AUDIO:
  1316. self.ui.lw_files_audio.currentItem().setText(newPath)
  1317. elif curIndex == self.FILEPATH_INDEX_MIDI:
  1318. self.ui.lw_files_midi.currentItem().setText(newPath)
  1319. # -----------------------------------------------------------------------------------------------------------------
  1320. @pyqtSlot(int)
  1321. def slot_filePathTabChanged(self, index):
  1322. if index == self.FILEPATH_INDEX_AUDIO:
  1323. row = self.ui.lw_files_audio.currentRow()
  1324. elif index == self.FILEPATH_INDEX_MIDI:
  1325. row = self.ui.lw_files_midi.currentRow()
  1326. else:
  1327. row = -1
  1328. self.slot_filePathRowChanged(row)
  1329. @pyqtSlot(int)
  1330. def slot_filePathRowChanged(self, row):
  1331. check = bool(row >= 0)
  1332. self.ui.b_filepaths_remove.setEnabled(check)
  1333. self.ui.b_filepaths_change.setEnabled(check)
  1334. # ---------------------------------------------------------------------------------------------------------------------
  1335. # Main
  1336. if __name__ == '__main__':
  1337. from carla_app import CarlaApplication
  1338. from carla_host import initHost as _initHost, loadHostSettings as _loadHostSettings
  1339. # pylint: disable=ungrouped-imports
  1340. from carla_shared import handleInitialCommandLineArguments
  1341. # pylint: enable=ungrouped-imports
  1342. initName, libPrefix = handleInitialCommandLineArguments(__file__ if "__file__" in dir() else None)
  1343. _app = CarlaApplication("Carla2-Settings", libPrefix)
  1344. _host = _initHost("Carla2-Settings", libPrefix, False, False, False)
  1345. _loadHostSettings(_host)
  1346. _gui = CarlaSettingsW(None, _host, True, True)
  1347. _gui.show()
  1348. _app.exit_exec()
  1349. # ---------------------------------------------------------------------------------------------------------------------