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.

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