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.

1624 lines
71KB

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