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.

1569 lines
69KB

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