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.

1376 lines
63KB

  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. elif not hasCanvas:
  294. self.ui.lw_page.hideRow(self.TAB_INDEX_CANVAS)
  295. elif not hasCanvasGL:
  296. self.ui.cb_canvas_use_opengl.setEnabled(False)
  297. self.ui.cb_canvas_render_hq_aa.setEnabled(False)
  298. if host.isPlugin:
  299. self.ui.cb_engine_audio_driver.setEnabled(False)
  300. if host.audioDriverForced is not None:
  301. self.ui.cb_engine_audio_driver.setEnabled(False)
  302. self.ui.tb_engine_driver_config.setEnabled(False)
  303. if host.processModeForced:
  304. self.ui.cb_engine_process_mode_jack.setEnabled(False)
  305. self.ui.cb_engine_process_mode_other.setEnabled(False)
  306. if self.host.processMode == ENGINE_PROCESS_MODE_CONTINUOUS_RACK:
  307. self.ui.ch_engine_force_stereo.setEnabled(False)
  308. if host.isControl or host.isPlugin:
  309. self.ui.ch_main_confirm_exit.hide()
  310. self.ui.ch_exp_load_lib_global.hide()
  311. self.ui.lw_page.hideRow(self.TAB_INDEX_OSC)
  312. self.ui.lw_page.hideRow(self.TAB_INDEX_WINE)
  313. if not LINUX:
  314. self.ui.ch_exp_wine_bridges.setVisible(False)
  315. self.ui.ch_exp_jack_apps.setVisible(False)
  316. self.ui.ch_exp_prevent_bad_behaviour.setVisible(False)
  317. self.ui.lw_page.hideRow(self.TAB_INDEX_WINE)
  318. if not MACOS:
  319. self.ui.label_engine_ui_bridges_mac_note.setVisible(False)
  320. # FIXME, not implemented yet
  321. self.ui.ch_engine_uis_always_on_top.hide()
  322. self.setWindowFlags(self.windowFlags() & ~Qt.WindowContextHelpButtonHint)
  323. # ----------------------------------------------------------------------------------------------------
  324. # Load settings
  325. self.loadSettings()
  326. # ----------------------------------------------------------------------------------------------------
  327. # Set-up connections
  328. self.accepted.connect(self.slot_saveSettings)
  329. self.ui.buttonBox.button(QDialogButtonBox.Reset).clicked.connect(self.slot_resetSettings)
  330. self.ui.b_main_proj_folder_open.clicked.connect(self.slot_getAndSetProjectPath)
  331. self.ui.cb_engine_audio_driver.currentIndexChanged.connect(self.slot_engineAudioDriverChanged)
  332. self.ui.tb_engine_driver_config.clicked.connect(self.slot_showAudioDriverSettings)
  333. self.ui.b_paths_add.clicked.connect(self.slot_addPluginPath)
  334. self.ui.b_paths_remove.clicked.connect(self.slot_removePluginPath)
  335. self.ui.b_paths_change.clicked.connect(self.slot_changePluginPath)
  336. self.ui.cb_paths.currentIndexChanged.connect(self.slot_pluginPathTabChanged)
  337. self.ui.lw_ladspa.currentRowChanged.connect(self.slot_pluginPathRowChanged)
  338. self.ui.lw_dssi.currentRowChanged.connect(self.slot_pluginPathRowChanged)
  339. self.ui.lw_lv2.currentRowChanged.connect(self.slot_pluginPathRowChanged)
  340. self.ui.lw_vst.currentRowChanged.connect(self.slot_pluginPathRowChanged)
  341. self.ui.lw_vst3.currentRowChanged.connect(self.slot_pluginPathRowChanged)
  342. self.ui.lw_sf2.currentRowChanged.connect(self.slot_pluginPathRowChanged)
  343. self.ui.lw_sfz.currentRowChanged.connect(self.slot_pluginPathRowChanged)
  344. self.ui.b_filepaths_add.clicked.connect(self.slot_addFilePath)
  345. self.ui.b_filepaths_remove.clicked.connect(self.slot_removeFilePath)
  346. self.ui.b_filepaths_change.clicked.connect(self.slot_changeFilePath)
  347. self.ui.cb_filepaths.currentIndexChanged.connect(self.slot_filePathTabChanged)
  348. self.ui.lw_files_audio.currentRowChanged.connect(self.slot_filePathRowChanged)
  349. self.ui.lw_files_midi.currentRowChanged.connect(self.slot_filePathRowChanged)
  350. self.ui.ch_main_experimental.toggled.connect(self.slot_enableExperimental)
  351. self.ui.ch_exp_wine_bridges.toggled.connect(self.slot_enableWineBridges)
  352. self.ui.cb_exp_plugin_bridges.toggled.connect(self.slot_pluginBridgesToggled)
  353. self.ui.cb_canvas_eyecandy.toggled.connect(self.slot_canvasEyeCandyToggled)
  354. self.ui.cb_canvas_fancy_eyecandy.toggled.connect(self.slot_canvasFancyEyeCandyToggled)
  355. self.ui.cb_canvas_use_opengl.toggled.connect(self.slot_canvasOpenGLToggled)
  356. # ----------------------------------------------------------------------------------------------------
  357. # Post-connect setup
  358. self.ui.lw_ladspa.setCurrentRow(0)
  359. self.ui.lw_dssi.setCurrentRow(0)
  360. self.ui.lw_lv2.setCurrentRow(0)
  361. self.ui.lw_vst.setCurrentRow(0)
  362. self.ui.lw_vst3.setCurrentRow(0)
  363. self.ui.lw_sf2.setCurrentRow(0)
  364. self.ui.lw_sfz.setCurrentRow(0)
  365. self.ui.lw_files_audio.setCurrentRow(0)
  366. self.ui.lw_files_midi.setCurrentRow(0)
  367. self.ui.lw_page.setCurrentCell(0, 0)
  368. self.slot_filePathTabChanged(0)
  369. self.slot_pluginPathTabChanged(0)
  370. self.adjustSize()
  371. # --------------------------------------------------------------------------------------------------------
  372. def loadSettings(self):
  373. settings = QSafeSettings()
  374. # ----------------------------------------------------------------------------------------------------
  375. # Main
  376. self.ui.ch_main_show_logs.setChecked(self.host.showLogs)
  377. self.ui.ch_engine_uis_always_on_top.setChecked(self.host.uisAlwaysOnTop)
  378. self.ui.le_main_proj_folder.setText(settings.value(CARLA_KEY_MAIN_PROJECT_FOLDER, CARLA_DEFAULT_MAIN_PROJECT_FOLDER, str))
  379. 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())
  380. 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)))
  381. self.ui.sb_main_refresh_interval.setValue(settings.value(CARLA_KEY_MAIN_REFRESH_INTERVAL, CARLA_DEFAULT_MAIN_REFRESH_INTERVAL, int))
  382. self.ui.ch_main_confirm_exit.setChecked(settings.value(CARLA_KEY_MAIN_CONFIRM_EXIT, CARLA_DEFAULT_MAIN_CONFIRM_EXIT, bool))
  383. # ----------------------------------------------------------------------------------------------------
  384. # Canvas
  385. self.ui.cb_canvas_theme.setCurrentIndex(self.ui.cb_canvas_theme.findText(settings.value(CARLA_KEY_CANVAS_THEME, CARLA_DEFAULT_CANVAS_THEME, str)))
  386. self.ui.cb_canvas_size.setCurrentIndex(self.ui.cb_canvas_size.findText(settings.value(CARLA_KEY_CANVAS_SIZE, CARLA_DEFAULT_CANVAS_SIZE, str)))
  387. self.ui.cb_canvas_bezier_lines.setChecked(settings.value(CARLA_KEY_CANVAS_USE_BEZIER_LINES, CARLA_DEFAULT_CANVAS_USE_BEZIER_LINES, bool))
  388. self.ui.cb_canvas_hide_groups.setChecked(settings.value(CARLA_KEY_CANVAS_AUTO_HIDE_GROUPS, CARLA_DEFAULT_CANVAS_AUTO_HIDE_GROUPS, bool))
  389. self.ui.cb_canvas_auto_select.setChecked(settings.value(CARLA_KEY_CANVAS_AUTO_SELECT_ITEMS, CARLA_DEFAULT_CANVAS_AUTO_SELECT_ITEMS, bool))
  390. self.ui.cb_canvas_eyecandy.setChecked(settings.value(CARLA_KEY_CANVAS_EYE_CANDY, CARLA_DEFAULT_CANVAS_EYE_CANDY, bool))
  391. self.ui.cb_canvas_fancy_eyecandy.setChecked(settings.value(CARLA_KEY_CANVAS_FANCY_EYE_CANDY, CARLA_DEFAULT_CANVAS_FANCY_EYE_CANDY, bool))
  392. 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())
  393. self.ui.cb_canvas_render_aa.setCheckState(settings.value(CARLA_KEY_CANVAS_ANTIALIASING, CARLA_DEFAULT_CANVAS_ANTIALIASING, int))
  394. 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())
  395. self.ui.cb_canvas_full_repaints.setChecked(settings.value(CARLA_KEY_CANVAS_FULL_REPAINTS, CARLA_DEFAULT_CANVAS_FULL_REPAINTS, bool))
  396. self.ui.cb_canvas_inline_displays.setChecked(settings.value(CARLA_KEY_CANVAS_INLINE_DISPLAYS, CARLA_DEFAULT_CANVAS_INLINE_DISPLAYS, bool))
  397. # ----------------------------------------------------------------------------------------------------
  398. settings = QSafeSettings("falkTX", "Carla2")
  399. # ----------------------------------------------------------------------------------------------------
  400. # Main
  401. self.ui.ch_main_experimental.setChecked(self.host.experimental)
  402. if not self.host.experimental:
  403. self.ui.lw_page.hideRow(self.TAB_INDEX_EXPERIMENTAL)
  404. self.ui.lw_page.hideRow(self.TAB_INDEX_WINE)
  405. elif not self.host.showWineBridges:
  406. self.ui.lw_page.hideRow(self.TAB_INDEX_WINE)
  407. # ----------------------------------------------------------------------------------------------------
  408. # Engine
  409. if self.host.isPlugin:
  410. audioDriver = "Plugin"
  411. self.ui.cb_engine_audio_driver.setCurrentIndex(0)
  412. elif self.host.audioDriverForced:
  413. audioDriver = self.host.audioDriverForced
  414. self.ui.cb_engine_audio_driver.setCurrentIndex(0)
  415. else:
  416. audioDriver = settings.value(CARLA_KEY_ENGINE_AUDIO_DRIVER, CARLA_DEFAULT_AUDIO_DRIVER, str)
  417. for i in range(self.ui.cb_engine_audio_driver.count()):
  418. if self.ui.cb_engine_audio_driver.itemText(i) == audioDriver:
  419. self.ui.cb_engine_audio_driver.setCurrentIndex(i)
  420. break
  421. else:
  422. self.ui.cb_engine_audio_driver.setCurrentIndex(-1)
  423. if audioDriver == "JACK":
  424. self.ui.sw_engine_process_mode.setCurrentIndex(0)
  425. else:
  426. self.ui.sw_engine_process_mode.setCurrentIndex(1)
  427. self.ui.tb_engine_driver_config.setEnabled(self.host.audioDriverForced is None and not self.host.isPlugin)
  428. self.ui.cb_engine_process_mode_jack.setCurrentIndex(self.host.nextProcessMode)
  429. if self.host.nextProcessMode >= self.PROCESS_MODE_NON_JACK_PADDING:
  430. self.ui.cb_engine_process_mode_other.setCurrentIndex(self.host.nextProcessMode-self.PROCESS_MODE_NON_JACK_PADDING)
  431. else:
  432. self.ui.cb_engine_process_mode_other.setCurrentIndex(0)
  433. self.ui.sb_engine_max_params.setValue(self.host.maxParameters)
  434. self.ui.ch_engine_manage_uis.setChecked(self.host.manageUIs)
  435. self.ui.ch_engine_prefer_ui_bridges.setChecked(self.host.preferUIBridges)
  436. self.ui.sb_engine_ui_bridges_timeout.setValue(self.host.uiBridgesTimeout)
  437. self.ui.ch_engine_force_stereo.setChecked(self.host.forceStereo or not self.ui.ch_engine_force_stereo.isEnabled())
  438. self.ui.ch_engine_prefer_plugin_bridges.setChecked(self.host.preferPluginBridges)
  439. self.ui.ch_exp_export_lv2.setChecked(self.host.exportLV2)
  440. self.ui.cb_exp_plugin_bridges.setChecked(self.host.showPluginBridges)
  441. self.ui.ch_exp_wine_bridges.setChecked(self.host.showWineBridges)
  442. # ----------------------------------------------------------------------------------------------------
  443. # OSC
  444. self.ui.ch_osc_enable.setChecked(settings.value(CARLA_KEY_OSC_ENABLED,
  445. CARLA_DEFAULT_OSC_ENABLED,
  446. bool))
  447. self.ui.group_osc_tcp_port.setChecked(settings.value(CARLA_KEY_OSC_TCP_PORT_ENABLED,
  448. CARLA_DEFAULT_OSC_TCP_PORT_ENABLED,
  449. bool))
  450. self.ui.group_osc_udp_port.setChecked(settings.value(CARLA_KEY_OSC_UDP_PORT_ENABLED,
  451. CARLA_DEFAULT_OSC_UDP_PORT_ENABLED,
  452. bool))
  453. self.ui.sb_osc_tcp_port_number.setValue(settings.value(CARLA_KEY_OSC_TCP_PORT_NUMBER,
  454. CARLA_DEFAULT_OSC_TCP_PORT_NUMBER,
  455. int))
  456. self.ui.sb_osc_udp_port_number.setValue(settings.value(CARLA_KEY_OSC_UDP_PORT_NUMBER,
  457. CARLA_DEFAULT_OSC_UDP_PORT_NUMBER,
  458. int))
  459. if settings.value(CARLA_KEY_OSC_TCP_PORT_RANDOM, CARLA_DEFAULT_OSC_TCP_PORT_RANDOM, bool):
  460. self.ui.rb_osc_tcp_port_specific.setChecked(False)
  461. self.ui.rb_osc_tcp_port_random.setChecked(True)
  462. else:
  463. self.ui.rb_osc_tcp_port_random.setChecked(False)
  464. self.ui.rb_osc_tcp_port_specific.setChecked(True)
  465. if settings.value(CARLA_KEY_OSC_UDP_PORT_RANDOM, CARLA_DEFAULT_OSC_UDP_PORT_RANDOM, bool):
  466. self.ui.rb_osc_udp_port_specific.setChecked(False)
  467. self.ui.rb_osc_udp_port_random.setChecked(True)
  468. else:
  469. self.ui.rb_osc_udp_port_random.setChecked(False)
  470. self.ui.rb_osc_udp_port_specific.setChecked(True)
  471. # ----------------------------------------------------------------------------------------------------
  472. # File Paths
  473. audioPaths = settings.value(CARLA_KEY_PATHS_AUDIO, CARLA_DEFAULT_FILE_PATH_AUDIO, list)
  474. midiPaths = settings.value(CARLA_KEY_PATHS_MIDI, CARLA_DEFAULT_FILE_PATH_MIDI, list)
  475. audioPaths.sort()
  476. midiPaths.sort()
  477. for audioPath in audioPaths:
  478. if not audioPath: continue
  479. self.ui.lw_files_audio.addItem(audioPath)
  480. for midiPath in midiPaths:
  481. if not midiPath: continue
  482. self.ui.lw_files_midi.addItem(midiPath)
  483. # ----------------------------------------------------------------------------------------------------
  484. # Plugin Paths
  485. ladspas = settings.value(CARLA_KEY_PATHS_LADSPA, CARLA_DEFAULT_LADSPA_PATH, list)
  486. dssis = settings.value(CARLA_KEY_PATHS_DSSI, CARLA_DEFAULT_DSSI_PATH, list)
  487. lv2s = settings.value(CARLA_KEY_PATHS_LV2, CARLA_DEFAULT_LV2_PATH, list)
  488. vst2s = settings.value(CARLA_KEY_PATHS_VST2, CARLA_DEFAULT_VST2_PATH, list)
  489. vst3s = settings.value(CARLA_KEY_PATHS_VST3, CARLA_DEFAULT_VST3_PATH, list)
  490. sf2s = settings.value(CARLA_KEY_PATHS_SF2, CARLA_DEFAULT_SF2_PATH, list)
  491. sfzs = settings.value(CARLA_KEY_PATHS_SFZ, CARLA_DEFAULT_SFZ_PATH, list)
  492. ladspas.sort()
  493. dssis.sort()
  494. lv2s.sort()
  495. vst2s.sort()
  496. vst3s.sort()
  497. sf2s.sort()
  498. sfzs.sort()
  499. for ladspa in ladspas:
  500. if not ladspa: continue
  501. self.ui.lw_ladspa.addItem(ladspa)
  502. for dssi in dssis:
  503. if not dssi: continue
  504. self.ui.lw_dssi.addItem(dssi)
  505. for lv2 in lv2s:
  506. if not lv2: continue
  507. self.ui.lw_lv2.addItem(lv2)
  508. for vst2 in vst2s:
  509. if not vst2: continue
  510. self.ui.lw_vst.addItem(vst2)
  511. for vst3 in vst3s:
  512. if not vst3: continue
  513. self.ui.lw_vst3.addItem(vst3)
  514. for sf2 in sf2s:
  515. if not sf2: continue
  516. self.ui.lw_sf2.addItem(sf2)
  517. for sfz in sfzs:
  518. if not sfz: continue
  519. self.ui.lw_sfz.addItem(sfz)
  520. # ----------------------------------------------------------------------------------------------------
  521. # Wine
  522. self.ui.le_wine_exec.setText(settings.value(CARLA_KEY_WINE_EXECUTABLE,
  523. CARLA_DEFAULT_WINE_EXECUTABLE,
  524. str))
  525. self.ui.cb_wine_prefix_detect.setChecked(settings.value(CARLA_KEY_WINE_AUTO_PREFIX,
  526. CARLA_DEFAULT_WINE_AUTO_PREFIX,
  527. bool))
  528. self.ui.le_wine_prefix_fallback.setText(settings.value(CARLA_KEY_WINE_FALLBACK_PREFIX,
  529. CARLA_DEFAULT_WINE_FALLBACK_PREFIX,
  530. str))
  531. self.ui.group_wine_realtime.setChecked(settings.value(CARLA_KEY_WINE_RT_PRIO_ENABLED,
  532. CARLA_DEFAULT_WINE_RT_PRIO_ENABLED,
  533. bool))
  534. self.ui.sb_wine_base_prio.setValue(settings.value(CARLA_KEY_WINE_BASE_RT_PRIO,
  535. CARLA_DEFAULT_WINE_BASE_RT_PRIO,
  536. int))
  537. self.ui.sb_wine_server_prio.setValue(settings.value(CARLA_KEY_WINE_SERVER_RT_PRIO,
  538. CARLA_DEFAULT_WINE_SERVER_RT_PRIO,
  539. int))
  540. # ----------------------------------------------------------------------------------------------------
  541. # Experimental
  542. self.ui.ch_exp_jack_apps.setChecked(settings.value(CARLA_KEY_EXPERIMENTAL_JACK_APPS,
  543. CARLA_DEFAULT_EXPERIMENTAL_JACK_APPS,
  544. bool))
  545. self.ui.ch_exp_export_lv2.setChecked(settings.value(CARLA_KEY_EXPERIMENTAL_EXPORT_LV2,
  546. CARLA_DEFAULT_EXPERIMENTAL_LV2_EXPORT,
  547. bool))
  548. self.ui.ch_exp_load_lib_global.setChecked(settings.value(CARLA_KEY_EXPERIMENTAL_LOAD_LIB_GLOBAL,
  549. CARLA_DEFAULT_EXPERIMENTAL_LOAD_LIB_GLOBAL,
  550. bool))
  551. self.ui.ch_exp_prevent_bad_behaviour.setChecked(settings.value(CARLA_KEY_EXPERIMENTAL_PREVENT_BAD_BEHAVIOUR,
  552. CARLA_DEFAULT_EXPERIMENTAL_PREVENT_BAD_BEHAVIOUR,
  553. bool))
  554. # --------------------------------------------------------------------------------------------------------
  555. @pyqtSlot()
  556. def slot_saveSettings(self):
  557. settings = QSafeSettings()
  558. self.host.experimental = self.ui.ch_main_experimental.isChecked()
  559. if not self.host.experimental:
  560. self.resetExperimentalSettings()
  561. # ----------------------------------------------------------------------------------------------------
  562. # Main
  563. settings.setValue(CARLA_KEY_MAIN_PROJECT_FOLDER, self.ui.le_main_proj_folder.text())
  564. settings.setValue(CARLA_KEY_MAIN_CONFIRM_EXIT, self.ui.ch_main_confirm_exit.isChecked())
  565. settings.setValue(CARLA_KEY_MAIN_USE_PRO_THEME, self.ui.ch_main_theme_pro.isChecked())
  566. settings.setValue(CARLA_KEY_MAIN_PRO_THEME_COLOR, self.ui.cb_main_theme_color.currentText())
  567. settings.setValue(CARLA_KEY_MAIN_REFRESH_INTERVAL, self.ui.sb_main_refresh_interval.value())
  568. # ----------------------------------------------------------------------------------------------------
  569. # Canvas
  570. settings.setValue(CARLA_KEY_CANVAS_THEME, self.ui.cb_canvas_theme.currentText())
  571. settings.setValue(CARLA_KEY_CANVAS_SIZE, self.ui.cb_canvas_size.currentText())
  572. settings.setValue(CARLA_KEY_CANVAS_USE_BEZIER_LINES, self.ui.cb_canvas_bezier_lines.isChecked())
  573. settings.setValue(CARLA_KEY_CANVAS_AUTO_HIDE_GROUPS, self.ui.cb_canvas_hide_groups.isChecked())
  574. settings.setValue(CARLA_KEY_CANVAS_AUTO_SELECT_ITEMS, self.ui.cb_canvas_auto_select.isChecked())
  575. settings.setValue(CARLA_KEY_CANVAS_EYE_CANDY, self.ui.cb_canvas_eyecandy.isChecked())
  576. settings.setValue(CARLA_KEY_CANVAS_FANCY_EYE_CANDY, self.ui.cb_canvas_fancy_eyecandy.isChecked())
  577. settings.setValue(CARLA_KEY_CANVAS_USE_OPENGL, self.ui.cb_canvas_use_opengl.isChecked())
  578. settings.setValue(CARLA_KEY_CANVAS_HQ_ANTIALIASING, self.ui.cb_canvas_render_hq_aa.isChecked())
  579. settings.setValue(CARLA_KEY_CANVAS_ANTIALIASING, self.ui.cb_canvas_render_aa.checkState()) # 0, 1, 2 match their enum variants
  580. settings.setValue(CARLA_KEY_CANVAS_FULL_REPAINTS, self.ui.cb_canvas_full_repaints.isChecked())
  581. settings.setValue(CARLA_KEY_CANVAS_INLINE_DISPLAYS, self.ui.cb_canvas_inline_displays.isChecked())
  582. # ----------------------------------------------------------------------------------------------------
  583. settings = QSafeSettings("falkTX", "Carla2")
  584. # ----------------------------------------------------------------------------------------------------
  585. # Main
  586. settings.setValue(CARLA_KEY_MAIN_EXPERIMENTAL, self.host.experimental)
  587. # ----------------------------------------------------------------------------------------------------
  588. # Engine
  589. audioDriver = self.ui.cb_engine_audio_driver.currentText()
  590. if audioDriver and self.host.audioDriverForced is None and not self.host.isPlugin:
  591. settings.setValue(CARLA_KEY_ENGINE_AUDIO_DRIVER, audioDriver)
  592. if not self.host.processModeForced:
  593. # engine sends callback if processMode really changes
  594. if audioDriver == "JACK":
  595. self.host.nextProcessMode = self.ui.cb_engine_process_mode_jack.currentIndex()
  596. else:
  597. self.host.nextProcessMode = self.ui.cb_engine_process_mode_other.currentIndex() + self.PROCESS_MODE_NON_JACK_PADDING
  598. settings.setValue(CARLA_KEY_ENGINE_PROCESS_MODE, self.host.nextProcessMode)
  599. self.host.exportLV2 = self.ui.ch_exp_export_lv2.isChecked()
  600. self.host.forceStereo = self.ui.ch_engine_force_stereo.isChecked()
  601. self.host.maxParameters = self.ui.sb_engine_max_params.value()
  602. self.host.manageUIs = self.ui.ch_engine_manage_uis.isChecked()
  603. self.host.preferPluginBridges = self.ui.ch_engine_prefer_plugin_bridges.isChecked()
  604. self.host.preferUIBridges = self.ui.ch_engine_prefer_ui_bridges.isChecked()
  605. self.host.showLogs = self.ui.ch_main_show_logs.isChecked()
  606. self.host.showPluginBridges = self.ui.cb_exp_plugin_bridges.isChecked()
  607. self.host.showWineBridges = self.ui.ch_exp_wine_bridges.isChecked()
  608. self.host.uiBridgesTimeout = self.ui.sb_engine_ui_bridges_timeout.value()
  609. self.host.uisAlwaysOnTop = self.ui.ch_engine_uis_always_on_top.isChecked()
  610. if self.ui.ch_engine_force_stereo.isEnabled():
  611. settings.setValue(CARLA_KEY_ENGINE_FORCE_STEREO, self.host.forceStereo)
  612. settings.setValue(CARLA_KEY_MAIN_SHOW_LOGS, self.host.showLogs)
  613. settings.setValue(CARLA_KEY_ENGINE_MAX_PARAMETERS, self.host.maxParameters)
  614. settings.setValue(CARLA_KEY_ENGINE_MANAGE_UIS, self.host.manageUIs)
  615. settings.setValue(CARLA_KEY_ENGINE_PREFER_PLUGIN_BRIDGES, self.host.preferPluginBridges)
  616. settings.setValue(CARLA_KEY_ENGINE_PREFER_UI_BRIDGES, self.host.preferUIBridges)
  617. settings.setValue(CARLA_KEY_ENGINE_UI_BRIDGES_TIMEOUT, self.host.uiBridgesTimeout)
  618. settings.setValue(CARLA_KEY_ENGINE_UIS_ALWAYS_ON_TOP, self.host.uisAlwaysOnTop)
  619. settings.setValue(CARLA_KEY_EXPERIMENTAL_EXPORT_LV2, self.host.exportLV2)
  620. settings.setValue(CARLA_KEY_EXPERIMENTAL_PLUGIN_BRIDGES, self.host.showPluginBridges)
  621. settings.setValue(CARLA_KEY_EXPERIMENTAL_WINE_BRIDGES, self.host.showWineBridges)
  622. # ----------------------------------------------------------------------------------------------------
  623. # OSC
  624. settings.setValue(CARLA_KEY_OSC_ENABLED, self.ui.ch_osc_enable.isChecked())
  625. settings.setValue(CARLA_KEY_OSC_TCP_PORT_ENABLED, self.ui.group_osc_tcp_port.isChecked())
  626. settings.setValue(CARLA_KEY_OSC_UDP_PORT_ENABLED, self.ui.group_osc_udp_port.isChecked())
  627. settings.setValue(CARLA_KEY_OSC_TCP_PORT_RANDOM, self.ui.rb_osc_tcp_port_random.isChecked())
  628. settings.setValue(CARLA_KEY_OSC_UDP_PORT_RANDOM, self.ui.rb_osc_udp_port_random.isChecked())
  629. settings.setValue(CARLA_KEY_OSC_TCP_PORT_NUMBER, self.ui.sb_osc_tcp_port_number.value())
  630. settings.setValue(CARLA_KEY_OSC_UDP_PORT_NUMBER, self.ui.sb_osc_udp_port_number.value())
  631. # ----------------------------------------------------------------------------------------------------
  632. # File Paths
  633. audioPaths = []
  634. midiPaths = []
  635. for i in range(self.ui.lw_files_audio.count()):
  636. audioPaths.append(self.ui.lw_files_audio.item(i).text())
  637. for i in range(self.ui.lw_files_midi.count()):
  638. midiPaths.append(self.ui.lw_files_midi.item(i).text())
  639. self.host.set_engine_option(ENGINE_OPTION_FILE_PATH, FILE_AUDIO, splitter.join(audioPaths))
  640. self.host.set_engine_option(ENGINE_OPTION_FILE_PATH, FILE_MIDI, splitter.join(midiPaths))
  641. settings.setValue(CARLA_KEY_PATHS_AUDIO, audioPaths)
  642. settings.setValue(CARLA_KEY_PATHS_MIDI, midiPaths)
  643. # ----------------------------------------------------------------------------------------------------
  644. # Plugin Paths
  645. ladspas = []
  646. dssis = []
  647. lv2s = []
  648. vst2s = []
  649. vst3s = []
  650. sf2s = []
  651. sfzs = []
  652. for i in range(self.ui.lw_ladspa.count()):
  653. ladspas.append(self.ui.lw_ladspa.item(i).text())
  654. for i in range(self.ui.lw_dssi.count()):
  655. dssis.append(self.ui.lw_dssi.item(i).text())
  656. for i in range(self.ui.lw_lv2.count()):
  657. lv2s.append(self.ui.lw_lv2.item(i).text())
  658. for i in range(self.ui.lw_vst.count()):
  659. vst2s.append(self.ui.lw_vst.item(i).text())
  660. for i in range(self.ui.lw_vst3.count()):
  661. vst3s.append(self.ui.lw_vst3.item(i).text())
  662. for i in range(self.ui.lw_sf2.count()):
  663. sf2s.append(self.ui.lw_sf2.item(i).text())
  664. for i in range(self.ui.lw_sfz.count()):
  665. sfzs.append(self.ui.lw_sfz.item(i).text())
  666. self.host.set_engine_option(ENGINE_OPTION_PLUGIN_PATH, PLUGIN_LADSPA, splitter.join(ladspas))
  667. self.host.set_engine_option(ENGINE_OPTION_PLUGIN_PATH, PLUGIN_DSSI, splitter.join(dssis))
  668. self.host.set_engine_option(ENGINE_OPTION_PLUGIN_PATH, PLUGIN_LV2, splitter.join(lv2s))
  669. self.host.set_engine_option(ENGINE_OPTION_PLUGIN_PATH, PLUGIN_VST2, splitter.join(vst2s))
  670. self.host.set_engine_option(ENGINE_OPTION_PLUGIN_PATH, PLUGIN_VST3, splitter.join(vst3s))
  671. self.host.set_engine_option(ENGINE_OPTION_PLUGIN_PATH, PLUGIN_SF2, splitter.join(sf2s))
  672. self.host.set_engine_option(ENGINE_OPTION_PLUGIN_PATH, PLUGIN_SFZ, splitter.join(sfzs))
  673. settings.setValue(CARLA_KEY_PATHS_LADSPA, ladspas)
  674. settings.setValue(CARLA_KEY_PATHS_DSSI, dssis)
  675. settings.setValue(CARLA_KEY_PATHS_LV2, lv2s)
  676. settings.setValue(CARLA_KEY_PATHS_VST2, vst2s)
  677. settings.setValue(CARLA_KEY_PATHS_VST3, vst3s)
  678. settings.setValue(CARLA_KEY_PATHS_SF2, sf2s)
  679. settings.setValue(CARLA_KEY_PATHS_SFZ, sfzs)
  680. # ----------------------------------------------------------------------------------------------------
  681. # Wine
  682. settings.setValue(CARLA_KEY_WINE_EXECUTABLE, self.ui.le_wine_exec.text())
  683. settings.setValue(CARLA_KEY_WINE_AUTO_PREFIX, self.ui.cb_wine_prefix_detect.isChecked())
  684. settings.setValue(CARLA_KEY_WINE_FALLBACK_PREFIX, self.ui.le_wine_prefix_fallback.text())
  685. settings.setValue(CARLA_KEY_WINE_RT_PRIO_ENABLED, self.ui.group_wine_realtime.isChecked())
  686. settings.setValue(CARLA_KEY_WINE_BASE_RT_PRIO, self.ui.sb_wine_base_prio.value())
  687. settings.setValue(CARLA_KEY_WINE_SERVER_RT_PRIO, self.ui.sb_wine_server_prio.value())
  688. # ----------------------------------------------------------------------------------------------------
  689. # Experimental
  690. settings.setValue(CARLA_KEY_EXPERIMENTAL_JACK_APPS, self.ui.ch_exp_jack_apps.isChecked())
  691. settings.setValue(CARLA_KEY_EXPERIMENTAL_LOAD_LIB_GLOBAL, self.ui.ch_exp_load_lib_global.isChecked())
  692. settings.setValue(CARLA_KEY_EXPERIMENTAL_PREVENT_BAD_BEHAVIOUR, self.ui.ch_exp_prevent_bad_behaviour.isChecked())
  693. # --------------------------------------------------------------------------------------------------------
  694. @pyqtSlot()
  695. def slot_resetSettings(self):
  696. currentRow = self.ui.lw_page.currentRow()
  697. # ----------------------------------------------------------------------------------------------------
  698. # Main
  699. if currentRow == self.TAB_INDEX_MAIN:
  700. self.ui.le_main_proj_folder.setText(CARLA_DEFAULT_MAIN_PROJECT_FOLDER)
  701. self.ui.ch_main_theme_pro.setChecked(CARLA_DEFAULT_MAIN_USE_PRO_THEME and self.ui.group_main_theme.isEnabled())
  702. self.ui.cb_main_theme_color.setCurrentIndex(self.ui.cb_main_theme_color.findText(CARLA_DEFAULT_MAIN_PRO_THEME_COLOR))
  703. self.ui.sb_main_refresh_interval.setValue(CARLA_DEFAULT_MAIN_REFRESH_INTERVAL)
  704. self.ui.ch_main_confirm_exit.setChecked(CARLA_DEFAULT_MAIN_CONFIRM_EXIT)
  705. self.ui.ch_main_show_logs.setChecked(CARLA_DEFAULT_MAIN_SHOW_LOGS)
  706. # ----------------------------------------------------------------------------------------------------
  707. # Canvas
  708. elif currentRow == self.TAB_INDEX_CANVAS:
  709. self.ui.cb_canvas_theme.setCurrentIndex(self.ui.cb_canvas_theme.findText(CARLA_DEFAULT_CANVAS_THEME))
  710. self.ui.cb_canvas_size.setCurrentIndex(self.ui.cb_canvas_size.findText(CARLA_DEFAULT_CANVAS_SIZE))
  711. self.ui.cb_canvas_bezier_lines.setChecked(CARLA_DEFAULT_CANVAS_USE_BEZIER_LINES)
  712. self.ui.cb_canvas_hide_groups.setChecked(CARLA_DEFAULT_CANVAS_AUTO_HIDE_GROUPS)
  713. self.ui.cb_canvas_auto_select.setChecked(CARLA_DEFAULT_CANVAS_AUTO_SELECT_ITEMS)
  714. self.ui.cb_canvas_eyecandy.setChecked(CARLA_DEFAULT_CANVAS_EYE_CANDY)
  715. self.ui.cb_canvas_render_aa.setCheckState(Qt.PartiallyChecked) # CARLA_DEFAULT_CANVAS_ANTIALIASING
  716. self.ui.cb_canvas_full_repaints.setChecked(CARLA_DEFAULT_CANVAS_FULL_REPAINTS)
  717. # ----------------------------------------------------------------------------------------------------
  718. # Engine
  719. elif currentRow == self.TAB_INDEX_ENGINE:
  720. if not self.host.isPlugin:
  721. self.ui.cb_engine_audio_driver.setCurrentIndex(0)
  722. if not self.host.processModeForced:
  723. if self.ui.cb_engine_audio_driver.currentText() == "JACK":
  724. self.ui.cb_engine_process_mode_jack.setCurrentIndex(CARLA_DEFAULT_PROCESS_MODE)
  725. self.ui.sw_engine_process_mode.setCurrentIndex(0) # show all modes
  726. else:
  727. self.ui.cb_engine_process_mode_other.setCurrentIndex(CARLA_DEFAULT_PROCESS_MODE-self.PROCESS_MODE_NON_JACK_PADDING)
  728. self.ui.sw_engine_process_mode.setCurrentIndex(1) # hide single+multi client modes
  729. self.ui.sb_engine_max_params.setValue(CARLA_DEFAULT_MAX_PARAMETERS)
  730. self.ui.ch_engine_uis_always_on_top.setChecked(CARLA_DEFAULT_UIS_ALWAYS_ON_TOP)
  731. self.ui.ch_engine_prefer_ui_bridges.setChecked(CARLA_DEFAULT_PREFER_UI_BRIDGES)
  732. self.ui.sb_engine_ui_bridges_timeout.setValue(CARLA_DEFAULT_UI_BRIDGES_TIMEOUT)
  733. self.ui.ch_engine_manage_uis.setChecked(CARLA_DEFAULT_MANAGE_UIS)
  734. # ----------------------------------------------------------------------------------------------------
  735. # OSC
  736. elif currentRow == self.TAB_INDEX_OSC:
  737. self.ui.ch_osc_enable.setChecked(CARLA_DEFAULT_OSC_ENABLED)
  738. self.ui.group_osc_tcp_port.setChecked(CARLA_DEFAULT_OSC_TCP_PORT_ENABLED)
  739. self.ui.group_osc_udp_port.setChecked(CARLA_DEFAULT_OSC_UDP_PORT_ENABLED)
  740. self.ui.sb_osc_tcp_port_number.setValue(CARLA_DEFAULT_OSC_TCP_PORT_NUMBER)
  741. self.ui.sb_osc_udp_port_number.setValue(CARLA_DEFAULT_OSC_UDP_PORT_NUMBER)
  742. if CARLA_DEFAULT_OSC_TCP_PORT_RANDOM:
  743. self.ui.rb_osc_tcp_port_specific.setChecked(False)
  744. self.ui.rb_osc_tcp_port_random.setChecked(True)
  745. else:
  746. self.ui.rb_osc_tcp_port_random.setChecked(False)
  747. self.ui.rb_osc_tcp_port_specific.setChecked(True)
  748. if CARLA_DEFAULT_OSC_UDP_PORT_RANDOM:
  749. self.ui.rb_osc_udp_port_specific.setChecked(False)
  750. self.ui.rb_osc_udp_port_random.setChecked(True)
  751. else:
  752. self.ui.rb_osc_udp_port_random.setChecked(False)
  753. self.ui.rb_osc_udp_port_specific.setChecked(True)
  754. # ----------------------------------------------------------------------------------------------------
  755. # Plugin Paths
  756. elif currentRow == self.TAB_INDEX_FILEPATHS:
  757. curIndex = self.ui.tw_filepaths.currentIndex()
  758. if curIndex == self.FILEPATH_INDEX_AUDIO:
  759. self.ui.lw_files_audio.clear()
  760. elif curIndex == self.FILEPATH_INDEX_MIDI:
  761. self.ui.lw_files_midi.clear()
  762. # ----------------------------------------------------------------------------------------------------
  763. # Plugin Paths
  764. elif currentRow == self.TAB_INDEX_PLUGINPATHS:
  765. curIndex = self.ui.tw_paths.currentIndex()
  766. if curIndex == self.PLUGINPATH_INDEX_LADSPA:
  767. paths = CARLA_DEFAULT_LADSPA_PATH
  768. paths.sort()
  769. self.ui.lw_ladspa.clear()
  770. for path in paths:
  771. if not path: continue
  772. self.ui.lw_ladspa.addItem(path)
  773. elif curIndex == self.PLUGINPATH_INDEX_DSSI:
  774. paths = CARLA_DEFAULT_DSSI_PATH
  775. paths.sort()
  776. self.ui.lw_dssi.clear()
  777. for path in paths:
  778. if not path: continue
  779. self.ui.lw_dssi.addItem(path)
  780. elif curIndex == self.PLUGINPATH_INDEX_LV2:
  781. paths = CARLA_DEFAULT_LV2_PATH
  782. paths.sort()
  783. self.ui.lw_lv2.clear()
  784. for path in paths:
  785. if not path: continue
  786. self.ui.lw_lv2.addItem(path)
  787. elif curIndex == self.PLUGINPATH_INDEX_VST2:
  788. paths = CARLA_DEFAULT_VST2_PATH
  789. paths.sort()
  790. self.ui.lw_vst.clear()
  791. for path in paths:
  792. if not path: continue
  793. self.ui.lw_vst.addItem(path)
  794. elif curIndex == self.PLUGINPATH_INDEX_VST3:
  795. paths = CARLA_DEFAULT_VST3_PATH
  796. paths.sort()
  797. self.ui.lw_vst3.clear()
  798. for path in paths:
  799. if not path: continue
  800. self.ui.lw_vst3.addItem(path)
  801. elif curIndex == self.PLUGINPATH_INDEX_SF2:
  802. paths = CARLA_DEFAULT_SF2_PATH
  803. paths.sort()
  804. self.ui.lw_sf2.clear()
  805. for path in paths:
  806. if not path: continue
  807. self.ui.lw_sf2.addItem(path)
  808. elif curIndex == self.PLUGINPATH_INDEX_SFZ:
  809. paths = CARLA_DEFAULT_SFZ_PATH
  810. paths.sort()
  811. self.ui.lw_sfz.clear()
  812. for path in paths:
  813. if not path: continue
  814. self.ui.lw_sfz.addItem(path)
  815. # ----------------------------------------------------------------------------------------------------
  816. # Wine
  817. elif currentRow == self.TAB_INDEX_WINE:
  818. self.ui.le_wine_exec.setText(CARLA_DEFAULT_WINE_EXECUTABLE)
  819. self.ui.cb_wine_prefix_detect.setChecked(CARLA_DEFAULT_WINE_AUTO_PREFIX)
  820. self.ui.le_wine_prefix_fallback.setText(CARLA_DEFAULT_WINE_FALLBACK_PREFIX)
  821. self.ui.group_wine_realtime.setChecked(CARLA_DEFAULT_WINE_RT_PRIO_ENABLED)
  822. self.ui.sb_wine_base_prio.setValue(CARLA_DEFAULT_WINE_BASE_RT_PRIO)
  823. self.ui.sb_wine_server_prio.setValue(CARLA_DEFAULT_WINE_SERVER_RT_PRIO)
  824. # ----------------------------------------------------------------------------------------------------
  825. # Experimental
  826. elif currentRow == self.TAB_INDEX_EXPERIMENTAL:
  827. self.resetExperimentalSettings()
  828. def resetExperimentalSettings(self):
  829. # Forever experimental
  830. self.ui.cb_exp_plugin_bridges.setChecked(CARLA_DEFAULT_EXPERIMENTAL_PLUGIN_BRIDGES)
  831. self.ui.ch_exp_wine_bridges.setChecked(CARLA_DEFAULT_EXPERIMENTAL_WINE_BRIDGES)
  832. self.ui.ch_exp_jack_apps.setChecked(CARLA_DEFAULT_EXPERIMENTAL_JACK_APPS)
  833. self.ui.ch_exp_export_lv2.setChecked(CARLA_DEFAULT_EXPERIMENTAL_LV2_EXPORT)
  834. self.ui.ch_exp_load_lib_global.setChecked(CARLA_DEFAULT_EXPERIMENTAL_LOAD_LIB_GLOBAL)
  835. self.ui.ch_exp_prevent_bad_behaviour.setChecked(CARLA_DEFAULT_EXPERIMENTAL_PREVENT_BAD_BEHAVIOUR)
  836. # Temporary, until stable
  837. self.ui.cb_canvas_fancy_eyecandy.setChecked(CARLA_DEFAULT_CANVAS_FANCY_EYE_CANDY)
  838. self.ui.cb_canvas_use_opengl.setChecked(CARLA_DEFAULT_CANVAS_USE_OPENGL and self.ui.cb_canvas_use_opengl.isEnabled())
  839. self.ui.cb_canvas_render_hq_aa.setChecked(CARLA_DEFAULT_CANVAS_HQ_ANTIALIASING and self.ui.cb_canvas_render_hq_aa.isEnabled())
  840. self.ui.cb_canvas_inline_displays.setChecked(CARLA_DEFAULT_CANVAS_INLINE_DISPLAYS)
  841. self.ui.ch_engine_force_stereo.setChecked(CARLA_DEFAULT_FORCE_STEREO)
  842. self.ui.ch_engine_prefer_plugin_bridges.setChecked(CARLA_DEFAULT_PREFER_PLUGIN_BRIDGES)
  843. # --------------------------------------------------------------------------------------------------------
  844. @pyqtSlot(bool)
  845. def slot_enableExperimental(self, toggled):
  846. if toggled:
  847. self.ui.lw_page.showRow(self.TAB_INDEX_EXPERIMENTAL)
  848. if self.ui.ch_exp_wine_bridges.isChecked() and not self.host.isControl:
  849. self.ui.lw_page.showRow(self.TAB_INDEX_WINE)
  850. else:
  851. self.ui.lw_page.hideRow(self.TAB_INDEX_EXPERIMENTAL)
  852. self.ui.lw_page.hideRow(self.TAB_INDEX_WINE)
  853. @pyqtSlot(bool)
  854. def slot_enableWineBridges(self, toggled):
  855. if toggled and not self.host.isControl:
  856. self.ui.lw_page.showRow(self.TAB_INDEX_WINE)
  857. else:
  858. self.ui.lw_page.hideRow(self.TAB_INDEX_WINE)
  859. @pyqtSlot(bool)
  860. def slot_pluginBridgesToggled(self, toggled):
  861. if not toggled:
  862. self.ui.ch_exp_wine_bridges.setChecked(False)
  863. self.ui.ch_engine_prefer_plugin_bridges.setChecked(False)
  864. self.ui.lw_page.hideRow(self.TAB_INDEX_WINE)
  865. @pyqtSlot(bool)
  866. def slot_canvasEyeCandyToggled(self, toggled):
  867. if not toggled:
  868. # disable fancy eyecandy too
  869. self.ui.cb_canvas_fancy_eyecandy.setChecked(False)
  870. @pyqtSlot(bool)
  871. def slot_canvasFancyEyeCandyToggled(self, toggled):
  872. if toggled:
  873. # make sure normal eyecandy is enabled too
  874. self.ui.cb_canvas_eyecandy.setChecked(True)
  875. @pyqtSlot(bool)
  876. def slot_canvasOpenGLToggled(self, toggled):
  877. if not toggled:
  878. # uncheck GL specific option
  879. self.ui.cb_canvas_render_hq_aa.setChecked(False)
  880. # --------------------------------------------------------------------------------------------------------
  881. @pyqtSlot()
  882. def slot_getAndSetProjectPath(self):
  883. # FIXME
  884. getAndSetPath(self, self.ui.le_main_proj_folder)
  885. # --------------------------------------------------------------------------------------------------------
  886. @pyqtSlot()
  887. def slot_engineAudioDriverChanged(self):
  888. if self.ui.cb_engine_audio_driver.currentText() == "JACK":
  889. self.ui.sw_engine_process_mode.setCurrentIndex(0)
  890. else:
  891. self.ui.sw_engine_process_mode.setCurrentIndex(1)
  892. @pyqtSlot()
  893. def slot_showAudioDriverSettings(self):
  894. driverIndex = self.ui.cb_engine_audio_driver.currentIndex()
  895. driverName = self.ui.cb_engine_audio_driver.currentText()
  896. DriverSettingsW(self, self.host, driverIndex, driverName).exec_()
  897. # --------------------------------------------------------------------------------------------------------
  898. @pyqtSlot()
  899. def slot_addPluginPath(self):
  900. newPath = QFileDialog.getExistingDirectory(self, self.tr("Add Path"), "", QFileDialog.ShowDirsOnly)
  901. if not newPath:
  902. return
  903. curIndex = self.ui.tw_paths.currentIndex()
  904. if curIndex == self.PLUGINPATH_INDEX_LADSPA:
  905. self.ui.lw_ladspa.addItem(newPath)
  906. elif curIndex == self.PLUGINPATH_INDEX_DSSI:
  907. self.ui.lw_dssi.addItem(newPath)
  908. elif curIndex == self.PLUGINPATH_INDEX_LV2:
  909. self.ui.lw_lv2.addItem(newPath)
  910. elif curIndex == self.PLUGINPATH_INDEX_VST2:
  911. self.ui.lw_vst.addItem(newPath)
  912. elif curIndex == self.PLUGINPATH_INDEX_VST3:
  913. self.ui.lw_vst3.addItem(newPath)
  914. elif curIndex == self.PLUGINPATH_INDEX_SF2:
  915. self.ui.lw_sf2.addItem(newPath)
  916. elif curIndex == self.PLUGINPATH_INDEX_SFZ:
  917. self.ui.lw_sfz.addItem(newPath)
  918. @pyqtSlot()
  919. def slot_removePluginPath(self):
  920. curIndex = self.ui.tw_paths.currentIndex()
  921. if curIndex == self.PLUGINPATH_INDEX_LADSPA:
  922. self.ui.lw_ladspa.takeItem(self.ui.lw_ladspa.currentRow())
  923. elif curIndex == self.PLUGINPATH_INDEX_DSSI:
  924. self.ui.lw_dssi.takeItem(self.ui.lw_dssi.currentRow())
  925. elif curIndex == self.PLUGINPATH_INDEX_LV2:
  926. self.ui.lw_lv2.takeItem(self.ui.lw_lv2.currentRow())
  927. elif curIndex == self.PLUGINPATH_INDEX_VST2:
  928. self.ui.lw_vst.takeItem(self.ui.lw_vst.currentRow())
  929. elif curIndex == self.PLUGINPATH_INDEX_VST3:
  930. self.ui.lw_vst3.takeItem(self.ui.lw_vst3.currentRow())
  931. elif curIndex == self.PLUGINPATH_INDEX_SF2:
  932. self.ui.lw_sf2.takeItem(self.ui.lw_sf2.currentRow())
  933. elif curIndex == self.PLUGINPATH_INDEX_SFZ:
  934. self.ui.lw_sfz.takeItem(self.ui.lw_sfz.currentRow())
  935. @pyqtSlot()
  936. def slot_changePluginPath(self):
  937. curIndex = self.ui.tw_paths.currentIndex()
  938. if curIndex == self.PLUGINPATH_INDEX_LADSPA:
  939. currentPath = self.ui.lw_ladspa.currentItem().text()
  940. elif curIndex == self.PLUGINPATH_INDEX_DSSI:
  941. currentPath = self.ui.lw_dssi.currentItem().text()
  942. elif curIndex == self.PLUGINPATH_INDEX_LV2:
  943. currentPath = self.ui.lw_lv2.currentItem().text()
  944. elif curIndex == self.PLUGINPATH_INDEX_VST2:
  945. currentPath = self.ui.lw_vst.currentItem().text()
  946. elif curIndex == self.PLUGINPATH_INDEX_VST3:
  947. currentPath = self.ui.lw_vst3.currentItem().text()
  948. elif curIndex == self.PLUGINPATH_INDEX_SF2:
  949. currentPath = self.ui.lw_sf2.currentItem().text()
  950. elif curIndex == self.PLUGINPATH_INDEX_SFZ:
  951. currentPath = self.ui.lw_sfz.currentItem().text()
  952. else:
  953. currentPath = ""
  954. newPath = QFileDialog.getExistingDirectory(self, self.tr("Add Path"), currentPath, QFileDialog.ShowDirsOnly)
  955. if not newPath:
  956. return
  957. if curIndex == self.PLUGINPATH_INDEX_LADSPA:
  958. self.ui.lw_ladspa.currentItem().setText(newPath)
  959. elif curIndex == self.PLUGINPATH_INDEX_DSSI:
  960. self.ui.lw_dssi.currentItem().setText(newPath)
  961. elif curIndex == self.PLUGINPATH_INDEX_LV2:
  962. self.ui.lw_lv2.currentItem().setText(newPath)
  963. elif curIndex == self.PLUGINPATH_INDEX_VST2:
  964. self.ui.lw_vst.currentItem().setText(newPath)
  965. elif curIndex == self.PLUGINPATH_INDEX_VST3:
  966. self.ui.lw_vst3.currentItem().setText(newPath)
  967. elif curIndex == self.PLUGINPATH_INDEX_SF2:
  968. self.ui.lw_sf2.currentItem().setText(newPath)
  969. elif curIndex == self.PLUGINPATH_INDEX_SFZ:
  970. self.ui.lw_sfz.currentItem().setText(newPath)
  971. # --------------------------------------------------------------------------------------------------------
  972. @pyqtSlot(int)
  973. def slot_pluginPathTabChanged(self, index):
  974. if index == self.PLUGINPATH_INDEX_LADSPA:
  975. row = self.ui.lw_ladspa.currentRow()
  976. elif index == self.PLUGINPATH_INDEX_DSSI:
  977. row = self.ui.lw_dssi.currentRow()
  978. elif index == self.PLUGINPATH_INDEX_LV2:
  979. row = self.ui.lw_lv2.currentRow()
  980. elif index == self.PLUGINPATH_INDEX_VST2:
  981. row = self.ui.lw_vst.currentRow()
  982. elif index == self.PLUGINPATH_INDEX_VST3:
  983. row = self.ui.lw_vst3.currentRow()
  984. elif index == self.PLUGINPATH_INDEX_SF2:
  985. row = self.ui.lw_sf2.currentRow()
  986. elif index == self.PLUGINPATH_INDEX_SFZ:
  987. row = self.ui.lw_sfz.currentRow()
  988. else:
  989. row = -1
  990. self.slot_pluginPathRowChanged(row)
  991. @pyqtSlot(int)
  992. def slot_pluginPathRowChanged(self, row):
  993. check = bool(row >= 0)
  994. self.ui.b_paths_remove.setEnabled(check)
  995. self.ui.b_paths_change.setEnabled(check)
  996. # --------------------------------------------------------------------------------------------------------
  997. @pyqtSlot()
  998. def slot_addFilePath(self):
  999. newPath = QFileDialog.getExistingDirectory(self, self.tr("Add Path"), "", QFileDialog.ShowDirsOnly)
  1000. if not newPath:
  1001. return
  1002. curIndex = self.ui.tw_filepaths.currentIndex()
  1003. if curIndex == self.FILEPATH_INDEX_AUDIO:
  1004. self.ui.lw_files_audio.addItem(newPath)
  1005. elif curIndex == self.FILEPATH_INDEX_MIDI:
  1006. self.ui.lw_files_midi.addItem(newPath)
  1007. @pyqtSlot()
  1008. def slot_removeFilePath(self):
  1009. curIndex = self.ui.tw_filepaths.currentIndex()
  1010. if curIndex == self.FILEPATH_INDEX_AUDIO:
  1011. self.ui.lw_files_audio.takeItem(self.ui.lw_files_audio.currentRow())
  1012. elif curIndex == self.FILEPATH_INDEX_MIDI:
  1013. self.ui.lw_files_midi.takeItem(self.ui.lw_files_midi.currentRow())
  1014. @pyqtSlot()
  1015. def slot_changeFilePath(self):
  1016. curIndex = self.ui.tw_filepaths.currentIndex()
  1017. if curIndex == self.FILEPATH_INDEX_AUDIO:
  1018. currentPath = self.ui.lw_files_audio.currentItem().text()
  1019. elif curIndex == self.FILEPATH_INDEX_MIDI:
  1020. currentPath = self.ui.lw_files_midi.currentItem().text()
  1021. else:
  1022. currentPath = ""
  1023. newPath = QFileDialog.getExistingDirectory(self, self.tr("Add Path"), currentPath, QFileDialog.ShowDirsOnly)
  1024. if not newPath:
  1025. return
  1026. if curIndex == self.FILEPATH_INDEX_AUDIO:
  1027. self.ui.lw_files_audio.currentItem().setText(newPath)
  1028. elif curIndex == self.FILEPATH_INDEX_MIDI:
  1029. self.ui.lw_files_midi.currentItem().setText(newPath)
  1030. # --------------------------------------------------------------------------------------------------------
  1031. @pyqtSlot(int)
  1032. def slot_filePathTabChanged(self, index):
  1033. if index == self.FILEPATH_INDEX_AUDIO:
  1034. row = self.ui.lw_files_audio.currentRow()
  1035. elif index == self.FILEPATH_INDEX_MIDI:
  1036. row = self.ui.lw_files_midi.currentRow()
  1037. else:
  1038. row = -1
  1039. self.slot_filePathRowChanged(row)
  1040. @pyqtSlot(int)
  1041. def slot_filePathRowChanged(self, row):
  1042. check = bool(row >= 0)
  1043. self.ui.b_filepaths_remove.setEnabled(check)
  1044. self.ui.b_filepaths_change.setEnabled(check)
  1045. # --------------------------------------------------------------------------------------------------------
  1046. def done(self, r):
  1047. QDialog.done(self, r)
  1048. self.close()
  1049. # ------------------------------------------------------------------------------------------------------------
  1050. # Main
  1051. if __name__ == '__main__':
  1052. from carla_app import CarlaApplication
  1053. from carla_host import initHost, loadHostSettings
  1054. initName, libPrefix = handleInitialCommandLineArguments(__file__ if "__file__" in dir() else None)
  1055. app = CarlaApplication("Carla2-Settings", libPrefix)
  1056. host = initHost("Carla2-Settings", libPrefix, False, False, False)
  1057. loadHostSettings(host)
  1058. gui = CarlaSettingsW(None, host, True, True)
  1059. gui.show()
  1060. app.exit_exec()
  1061. # ------------------------------------------------------------------------------------------------------------