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.

1381 lines
64KB

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