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.

1012 lines
48KB

  1. #!/usr/bin/env python3
  2. # -*- coding: utf-8 -*-
  3. # Carla settings code
  4. # Copyright (C) 2011-2018 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 (Config)
  19. from carla_config import *
  20. # ------------------------------------------------------------------------------------------------------------
  21. # Imports (Global)
  22. if config_UseQt5:
  23. from PyQt5.QtCore import pyqtSlot, QByteArray, QDir, QSettings
  24. from PyQt5.QtGui import QColor, QCursor, QFontMetrics, QPainter, QPainterPath
  25. from PyQt5.QtWidgets import QDialog, QDialogButtonBox, QFrame, QInputDialog, QLineEdit, QMenu, QVBoxLayout, QWidget
  26. else:
  27. from PyQt4.QtCore import pyqtSlot, QByteArray, QDir, QSettings
  28. from PyQt4.QtGui import QColor, QCursor, QFontMetrics, QPainter, QPainterPath
  29. from PyQt4.QtGui import QDialog, QDialogButtonBox, QFrame, QInputDialog, QLineEdit, QMenu, QVBoxLayout, QWidget
  30. # ------------------------------------------------------------------------------------------------------------
  31. # Imports (Custom)
  32. import ui_carla_settings
  33. import ui_carla_settings_driver
  34. from carla_shared import *
  35. from patchcanvas_theme import *
  36. # ------------------------------------------------------------------------------------------------------------
  37. # ...
  38. BUFFER_SIZE_LIST = (16, 32, 64, 128, 256, 512, 1024, 2048, 4096, 8192)
  39. SAMPLE_RATE_LIST = (22050, 32000, 44100, 48000, 88200, 96000, 176400, 192000)
  40. # ------------------------------------------------------------------------------------------------------------
  41. # Driver Settings
  42. class DriverSettingsW(QDialog):
  43. AUTOMATIC_OPTION = "(Auto)"
  44. def __init__(self, parent, host, driverIndex, driverName):
  45. QDialog.__init__(self, parent)
  46. self.host = host
  47. self.ui = ui_carla_settings_driver.Ui_DriverSettingsW()
  48. self.ui.setupUi(self)
  49. if False:
  50. # kdevelop likes this :)
  51. host = CarlaHostNull()
  52. self.host = host
  53. # ----------------------------------------------------------------------------------------------------
  54. # Internal stuff
  55. self.fDriverIndex = driverIndex
  56. self.fDriverName = driverName
  57. self.fDeviceNames = host.get_engine_driver_device_names(driverIndex)
  58. self.fBufferSizes = BUFFER_SIZE_LIST
  59. self.fSampleRates = SAMPLE_RATE_LIST
  60. # ----------------------------------------------------------------------------------------------------
  61. # Set-up GUI
  62. for name in self.fDeviceNames:
  63. self.ui.cb_device.addItem(name)
  64. # ----------------------------------------------------------------------------------------------------
  65. # Load settings
  66. self.loadSettings()
  67. # ----------------------------------------------------------------------------------------------------
  68. # Set-up connections
  69. self.accepted.connect(self.slot_saveSettings)
  70. self.ui.cb_device.currentIndexChanged.connect(self.slot_updateDeviceInfo)
  71. # ----------------------------------------------------------------------------------------------------
  72. def loadSettings(self):
  73. settings = QSettings("falkTX", "Carla2")
  74. audioDevice = settings.value("%s%s/Device" % (CARLA_KEY_ENGINE_DRIVER_PREFIX, self.fDriverName), "", type=str)
  75. audioBufferSize = settings.value("%s%s/BufferSize" % (CARLA_KEY_ENGINE_DRIVER_PREFIX, self.fDriverName), CARLA_DEFAULT_AUDIO_BUFFER_SIZE, type=int)
  76. audioSampleRate = settings.value("%s%s/SampleRate" % (CARLA_KEY_ENGINE_DRIVER_PREFIX, self.fDriverName), CARLA_DEFAULT_AUDIO_SAMPLE_RATE, type=int)
  77. audioTripleBuffer = settings.value("%s%s/TripleBuffer" % (CARLA_KEY_ENGINE_DRIVER_PREFIX, self.fDriverName), CARLA_DEFAULT_AUDIO_TRIPLE_BUFFER, type=bool)
  78. if audioDevice and audioDevice in self.fDeviceNames:
  79. self.ui.cb_device.setCurrentIndex(self.fDeviceNames.index(audioDevice))
  80. else:
  81. self.ui.cb_device.setCurrentIndex(-1)
  82. # fill combo-boxes first
  83. self.slot_updateDeviceInfo()
  84. if audioBufferSize and audioBufferSize in self.fBufferSizes:
  85. self.ui.cb_buffersize.setCurrentIndex(self.fBufferSizes.index(audioBufferSize))
  86. elif self.fBufferSizes == BUFFER_SIZE_LIST:
  87. self.ui.cb_buffersize.setCurrentIndex(BUFFER_SIZE_LIST.index(CARLA_DEFAULT_AUDIO_BUFFER_SIZE))
  88. else:
  89. self.ui.cb_buffersize.setCurrentIndex(len(self.fBufferSizes)/2)
  90. if audioSampleRate and audioSampleRate in self.fSampleRates:
  91. self.ui.cb_samplerate.setCurrentIndex(self.fSampleRates.index(audioSampleRate))
  92. elif self.fSampleRates == SAMPLE_RATE_LIST:
  93. self.ui.cb_samplerate.setCurrentIndex(SAMPLE_RATE_LIST.index(CARLA_DEFAULT_AUDIO_SAMPLE_RATE))
  94. else:
  95. self.ui.cb_samplerate.setCurrentIndex(len(self.fSampleRates)/2)
  96. self.ui.cb_triple_buffer.setChecked(audioTripleBuffer and self.ui.cb_triple_buffer.isEnabled())
  97. # --------------------------------------------------------------------------------------------------------
  98. @pyqtSlot()
  99. def slot_saveSettings(self):
  100. settings = QSettings("falkTX", "Carla2")
  101. bufferSize = self.ui.cb_buffersize.currentText()
  102. sampleRate = self.ui.cb_samplerate.currentText()
  103. if bufferSize == self.AUTOMATIC_OPTION:
  104. bufferSize = "0"
  105. if sampleRate == self.AUTOMATIC_OPTION:
  106. sampleRate = "0"
  107. settings.setValue("%s%s/Device" % (CARLA_KEY_ENGINE_DRIVER_PREFIX, self.fDriverName), self.ui.cb_device.currentText())
  108. settings.setValue("%s%s/BufferSize" % (CARLA_KEY_ENGINE_DRIVER_PREFIX, self.fDriverName), bufferSize)
  109. settings.setValue("%s%s/SampleRate" % (CARLA_KEY_ENGINE_DRIVER_PREFIX, self.fDriverName), sampleRate)
  110. settings.setValue("%s%s/TripleBuffer" % (CARLA_KEY_ENGINE_DRIVER_PREFIX, self.fDriverName), self.ui.cb_triple_buffer.isChecked())
  111. # --------------------------------------------------------------------------------------------------------
  112. @pyqtSlot()
  113. def slot_updateDeviceInfo(self):
  114. deviceName = self.ui.cb_device.currentText()
  115. oldBufferSize = self.ui.cb_buffersize.currentText()
  116. oldSampleRate = self.ui.cb_samplerate.currentText()
  117. self.ui.cb_buffersize.clear()
  118. self.ui.cb_samplerate.clear()
  119. driverDeviceInfo = self.host.get_engine_driver_device_info(self.fDriverIndex, deviceName)
  120. driverDeviceHints = driverDeviceInfo['hints']
  121. self.fBufferSizes = driverDeviceInfo['bufferSizes']
  122. self.fSampleRates = driverDeviceInfo['sampleRates']
  123. if driverDeviceHints & ENGINE_DRIVER_DEVICE_CAN_TRIPLE_BUFFER:
  124. self.ui.cb_triple_buffer.setEnabled(True)
  125. else:
  126. self.ui.cb_triple_buffer.setEnabled(False)
  127. if len(self.fBufferSizes) > 0:
  128. for bsize in self.fBufferSizes:
  129. sbsize = str(bsize)
  130. self.ui.cb_buffersize.addItem(sbsize)
  131. if oldBufferSize == sbsize:
  132. self.ui.cb_buffersize.setCurrentIndex(self.ui.cb_buffersize.count()-1)
  133. else:
  134. self.ui.cb_buffersize.addItem(self.AUTOMATIC_OPTION)
  135. self.ui.cb_buffersize.setCurrentIndex(0)
  136. if len(self.fSampleRates) > 0:
  137. for srate in self.fSampleRates:
  138. ssrate = str(int(srate))
  139. self.ui.cb_samplerate.addItem(ssrate)
  140. if oldSampleRate == ssrate:
  141. self.ui.cb_samplerate.setCurrentIndex(self.ui.cb_samplerate.count()-1)
  142. else:
  143. self.ui.cb_samplerate.addItem(self.AUTOMATIC_OPTION)
  144. self.ui.cb_samplerate.setCurrentIndex(0)
  145. # --------------------------------------------------------------------------------------------------------
  146. def done(self, r):
  147. QDialog.done(self, r)
  148. self.close()
  149. # ------------------------------------------------------------------------------------------------------------
  150. # Settings Dialog
  151. class CarlaSettingsW(QDialog):
  152. # Tab indexes
  153. TAB_INDEX_MAIN = 0
  154. TAB_INDEX_CANVAS = 1
  155. TAB_INDEX_ENGINE = 2
  156. TAB_INDEX_PATHS = 3
  157. TAB_INDEX_WINE = 4
  158. TAB_INDEX_EXPERIMENTAL = 5
  159. TAB_INDEX_NONE = 6
  160. # Path indexes
  161. PATH_INDEX_LADSPA = 0
  162. PATH_INDEX_DSSI = 1
  163. PATH_INDEX_LV2 = 2
  164. PATH_INDEX_VST2 = 3
  165. PATH_INDEX_SF2 = 4
  166. PATH_INDEX_SFZ = 5
  167. # Single and Multiple client mode is only for JACK,
  168. # but we still want to match QComboBox index to backend defines,
  169. # so add +2 pos padding if driverName != "JACK".
  170. PROCESS_MODE_NON_JACK_PADDING = 2
  171. # --------------------------------------------------------------------------------------------------------
  172. def __init__(self, parent, host, hasCanvas, hasCanvasGL):
  173. QDialog.__init__(self, parent)
  174. self.host = host
  175. self.ui = ui_carla_settings.Ui_CarlaSettingsW()
  176. self.ui.setupUi(self)
  177. if False:
  178. # kdevelop likes this :)
  179. host = CarlaHostNull()
  180. self.host = host
  181. # ----------------------------------------------------------------------------------------------------
  182. # Set-up GUI
  183. self.ui.lw_page.setFixedWidth(48 + 6*3 + QFontMetrics(self.ui.lw_page.font()).width(" Experimental "))
  184. for i in range(host.get_engine_driver_count()):
  185. self.ui.cb_engine_audio_driver.addItem(host.get_engine_driver_name(i))
  186. for i in range(Theme.THEME_MAX):
  187. self.ui.cb_canvas_theme.addItem(getThemeName(i))
  188. if MACOS or (WINDOWS and not config_UseQt5):
  189. self.ui.group_main_theme.setEnabled(False)
  190. self.ui.group_main_theme.setVisible(False)
  191. if WINDOWS or host.isControl:
  192. self.ui.ch_main_show_logs.setEnabled(False)
  193. self.ui.ch_main_show_logs.setVisible(False)
  194. if host.isControl:
  195. self.ui.lw_page.hideRow(self.TAB_INDEX_CANVAS)
  196. self.ui.lw_page.hideRow(self.TAB_INDEX_ENGINE)
  197. self.ui.lw_page.hideRow(self.TAB_INDEX_PATHS)
  198. self.ui.lw_page.hideRow(self.TAB_INDEX_EXPERIMENTAL)
  199. self.ui.ch_main_experimental.setEnabled(False)
  200. self.ui.group_main_experimental.setEnabled(False)
  201. self.ui.group_main_experimental.setVisible(False)
  202. elif not hasCanvas:
  203. self.ui.lw_page.hideRow(self.TAB_INDEX_CANVAS)
  204. elif not hasCanvasGL:
  205. self.ui.cb_canvas_use_opengl.setEnabled(False)
  206. self.ui.cb_canvas_render_hq_aa.setEnabled(False)
  207. if host.isPlugin:
  208. self.ui.cb_engine_audio_driver.setEnabled(False)
  209. if host.audioDriverForced is not None:
  210. self.ui.cb_engine_audio_driver.setEnabled(False)
  211. self.ui.tb_engine_driver_config.setEnabled(False)
  212. if host.processModeForced:
  213. self.ui.cb_engine_process_mode_jack.setEnabled(False)
  214. self.ui.cb_engine_process_mode_other.setEnabled(False)
  215. if self.host.processMode == ENGINE_PROCESS_MODE_CONTINUOUS_RACK:
  216. self.ui.ch_engine_force_stereo.setEnabled(False)
  217. if host.isControl or host.isPlugin:
  218. self.ui.ch_main_confirm_exit.hide()
  219. self.ui.ch_exp_load_lib_global.hide()
  220. self.ui.lw_page.hideRow(self.TAB_INDEX_WINE)
  221. if not LINUX:
  222. self.ui.ch_exp_wine_bridges.setVisible(False)
  223. self.ui.ch_exp_jack_apps.setVisible(False)
  224. self.ui.ch_exp_prevent_bad_behaviour.setVisible(False)
  225. self.ui.lw_page.hideRow(self.TAB_INDEX_WINE)
  226. # FIXME, not implemented yet
  227. self.ui.ch_engine_uis_always_on_top.hide()
  228. # ----------------------------------------------------------------------------------------------------
  229. # Load settings
  230. self.loadSettings()
  231. # ----------------------------------------------------------------------------------------------------
  232. # Set-up connections
  233. self.accepted.connect(self.slot_saveSettings)
  234. self.ui.buttonBox.button(QDialogButtonBox.Reset).clicked.connect(self.slot_resetSettings)
  235. self.ui.b_main_proj_folder_open.clicked.connect(self.slot_getAndSetProjectPath)
  236. self.ui.cb_engine_audio_driver.currentIndexChanged.connect(self.slot_engineAudioDriverChanged)
  237. self.ui.tb_engine_driver_config.clicked.connect(self.slot_showAudioDriverSettings)
  238. self.ui.b_paths_add.clicked.connect(self.slot_addPluginPath)
  239. self.ui.b_paths_remove.clicked.connect(self.slot_removePluginPath)
  240. self.ui.b_paths_change.clicked.connect(self.slot_changePluginPath)
  241. self.ui.cb_paths.currentIndexChanged.connect(self.slot_pluginPathTabChanged)
  242. self.ui.lw_ladspa.currentRowChanged.connect(self.slot_pluginPathRowChanged)
  243. self.ui.lw_dssi.currentRowChanged.connect(self.slot_pluginPathRowChanged)
  244. self.ui.lw_lv2.currentRowChanged.connect(self.slot_pluginPathRowChanged)
  245. self.ui.lw_vst.currentRowChanged.connect(self.slot_pluginPathRowChanged)
  246. self.ui.lw_sf2.currentRowChanged.connect(self.slot_pluginPathRowChanged)
  247. self.ui.lw_sfz.currentRowChanged.connect(self.slot_pluginPathRowChanged)
  248. self.ui.ch_main_experimental.toggled.connect(self.slot_enableExperimental)
  249. self.ui.ch_exp_wine_bridges.toggled.connect(self.slot_enableWineBridges)
  250. self.ui.cb_exp_plugin_bridges.toggled.connect(self.slot_pluginBridgesToggled)
  251. self.ui.cb_canvas_eyecandy.toggled.connect(self.slot_canvasEyeCandyToggled)
  252. self.ui.cb_canvas_fancy_eyecandy.toggled.connect(self.slot_canvasFancyEyeCandyToggled)
  253. self.ui.cb_canvas_use_opengl.toggled.connect(self.slot_canvasOpenGLToggled)
  254. # ----------------------------------------------------------------------------------------------------
  255. # Post-connect setup
  256. self.ui.lw_ladspa.setCurrentRow(0)
  257. self.ui.lw_dssi.setCurrentRow(0)
  258. self.ui.lw_lv2.setCurrentRow(0)
  259. self.ui.lw_vst.setCurrentRow(0)
  260. self.ui.lw_sf2.setCurrentRow(0)
  261. self.ui.lw_sfz.setCurrentRow(0)
  262. self.ui.lw_page.setCurrentCell(0, 0)
  263. self.adjustSize()
  264. # --------------------------------------------------------------------------------------------------------
  265. def loadSettings(self):
  266. settings = QSettings()
  267. # ----------------------------------------------------------------------------------------------------
  268. # Main
  269. self.ui.ch_main_show_logs.setChecked(self.host.showLogs)
  270. self.ui.ch_engine_uis_always_on_top.setChecked(self.host.uisAlwaysOnTop)
  271. self.ui.le_main_proj_folder.setText(settings.value(CARLA_KEY_MAIN_PROJECT_FOLDER, CARLA_DEFAULT_MAIN_PROJECT_FOLDER, type=str))
  272. self.ui.ch_main_theme_pro.setChecked(settings.value(CARLA_KEY_MAIN_USE_PRO_THEME, CARLA_DEFAULT_MAIN_USE_PRO_THEME, type=bool) and self.ui.group_main_theme.isEnabled())
  273. 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, type=str)))
  274. self.ui.sb_main_refresh_interval.setValue(settings.value(CARLA_KEY_MAIN_REFRESH_INTERVAL, CARLA_DEFAULT_MAIN_REFRESH_INTERVAL, type=int))
  275. self.ui.ch_main_confirm_exit.setChecked(settings.value(CARLA_KEY_MAIN_CONFIRM_EXIT, CARLA_DEFAULT_MAIN_CONFIRM_EXIT, type=bool))
  276. self.ui.ch_main_use_custom_skins.setChecked(settings.value(CARLA_KEY_MAIN_USE_CUSTOM_SKINS, CARLA_DEFAULT_MAIN_USE_CUSTOM_SKINS, type=bool))
  277. # ----------------------------------------------------------------------------------------------------
  278. # Canvas
  279. self.ui.cb_canvas_theme.setCurrentIndex(self.ui.cb_canvas_theme.findText(settings.value(CARLA_KEY_CANVAS_THEME, CARLA_DEFAULT_CANVAS_THEME, type=str)))
  280. self.ui.cb_canvas_size.setCurrentIndex(self.ui.cb_canvas_size.findText(settings.value(CARLA_KEY_CANVAS_SIZE, CARLA_DEFAULT_CANVAS_SIZE, type=str)))
  281. self.ui.cb_canvas_bezier_lines.setChecked(settings.value(CARLA_KEY_CANVAS_USE_BEZIER_LINES, CARLA_DEFAULT_CANVAS_USE_BEZIER_LINES, type=bool))
  282. self.ui.cb_canvas_hide_groups.setChecked(settings.value(CARLA_KEY_CANVAS_AUTO_HIDE_GROUPS, CARLA_DEFAULT_CANVAS_AUTO_HIDE_GROUPS, type=bool))
  283. self.ui.cb_canvas_auto_select.setChecked(settings.value(CARLA_KEY_CANVAS_AUTO_SELECT_ITEMS, CARLA_DEFAULT_CANVAS_AUTO_SELECT_ITEMS, type=bool))
  284. self.ui.cb_canvas_eyecandy.setChecked(settings.value(CARLA_KEY_CANVAS_EYE_CANDY, CARLA_DEFAULT_CANVAS_EYE_CANDY, type=bool))
  285. self.ui.cb_canvas_fancy_eyecandy.setChecked(settings.value(CARLA_KEY_CANVAS_FANCY_EYE_CANDY, CARLA_DEFAULT_CANVAS_FANCY_EYE_CANDY, type=bool))
  286. self.ui.cb_canvas_use_opengl.setChecked(settings.value(CARLA_KEY_CANVAS_USE_OPENGL, CARLA_DEFAULT_CANVAS_USE_OPENGL, type=bool) and self.ui.cb_canvas_use_opengl.isEnabled())
  287. self.ui.cb_canvas_render_aa.setCheckState(settings.value(CARLA_KEY_CANVAS_ANTIALIASING, CARLA_DEFAULT_CANVAS_ANTIALIASING, type=int))
  288. self.ui.cb_canvas_render_hq_aa.setChecked(settings.value(CARLA_KEY_CANVAS_HQ_ANTIALIASING, CARLA_DEFAULT_CANVAS_HQ_ANTIALIASING, type=bool) and self.ui.cb_canvas_render_hq_aa.isEnabled())
  289. # ----------------------------------------------------------------------------------------------------
  290. settings = QSettings("falkTX", "Carla2")
  291. # ----------------------------------------------------------------------------------------------------
  292. # Main
  293. if not self.host.isControl:
  294. self.ui.ch_main_experimental.setChecked(self.host.experimental)
  295. if not self.host.experimental:
  296. self.ui.lw_page.hideRow(self.TAB_INDEX_EXPERIMENTAL)
  297. self.ui.lw_page.hideRow(self.TAB_INDEX_WINE)
  298. elif not self.host.showWineBridges:
  299. self.ui.lw_page.hideRow(self.TAB_INDEX_WINE)
  300. # ----------------------------------------------------------------------------------------------------
  301. # Engine
  302. if self.host.isPlugin:
  303. audioDriver = "Plugin"
  304. self.ui.cb_engine_audio_driver.setCurrentIndex(0)
  305. elif self.host.audioDriverForced:
  306. audioDriver = self.host.audioDriverForced
  307. self.ui.cb_engine_audio_driver.setCurrentIndex(0)
  308. else:
  309. audioDriver = settings.value(CARLA_KEY_ENGINE_AUDIO_DRIVER, CARLA_DEFAULT_AUDIO_DRIVER, type=str)
  310. for i in range(self.ui.cb_engine_audio_driver.count()):
  311. if self.ui.cb_engine_audio_driver.itemText(i) == audioDriver:
  312. self.ui.cb_engine_audio_driver.setCurrentIndex(i)
  313. break
  314. else:
  315. self.ui.cb_engine_audio_driver.setCurrentIndex(-1)
  316. if audioDriver == "JACK":
  317. self.ui.sw_engine_process_mode.setCurrentIndex(0)
  318. else:
  319. self.ui.sw_engine_process_mode.setCurrentIndex(1)
  320. self.ui.tb_engine_driver_config.setEnabled(self.host.audioDriverForced is None and not self.host.isPlugin)
  321. self.ui.cb_engine_process_mode_jack.setCurrentIndex(self.host.nextProcessMode)
  322. if self.host.nextProcessMode >= self.PROCESS_MODE_NON_JACK_PADDING:
  323. self.ui.cb_engine_process_mode_other.setCurrentIndex(self.host.nextProcessMode-self.PROCESS_MODE_NON_JACK_PADDING)
  324. else:
  325. self.ui.cb_engine_process_mode_other.setCurrentIndex(0)
  326. self.ui.sb_engine_max_params.setValue(self.host.maxParameters)
  327. self.ui.ch_engine_manage_uis.setChecked(self.host.manageUIs)
  328. self.ui.ch_engine_prefer_ui_bridges.setChecked(self.host.preferUIBridges)
  329. self.ui.sb_engine_ui_bridges_timeout.setValue(self.host.uiBridgesTimeout)
  330. self.ui.ch_engine_force_stereo.setChecked(self.host.forceStereo or not self.ui.ch_engine_force_stereo.isEnabled())
  331. self.ui.ch_engine_prefer_plugin_bridges.setChecked(self.host.preferPluginBridges)
  332. self.ui.ch_exp_export_lv2.setChecked(self.host.exportLV2)
  333. self.ui.cb_exp_plugin_bridges.setChecked(self.host.showPluginBridges)
  334. self.ui.ch_exp_wine_bridges.setChecked(self.host.showWineBridges)
  335. # ----------------------------------------------------------------------------------------------------
  336. # Paths
  337. ladspas = toList(settings.value(CARLA_KEY_PATHS_LADSPA, CARLA_DEFAULT_LADSPA_PATH))
  338. dssis = toList(settings.value(CARLA_KEY_PATHS_DSSI, CARLA_DEFAULT_DSSI_PATH))
  339. lv2s = toList(settings.value(CARLA_KEY_PATHS_LV2, CARLA_DEFAULT_LV2_PATH))
  340. vst2s = toList(settings.value(CARLA_KEY_PATHS_VST2, CARLA_DEFAULT_VST2_PATH))
  341. sf2s = toList(settings.value(CARLA_KEY_PATHS_SF2, CARLA_DEFAULT_SF2_PATH))
  342. sfzs = toList(settings.value(CARLA_KEY_PATHS_SFZ, CARLA_DEFAULT_SFZ_PATH))
  343. ladspas.sort()
  344. dssis.sort()
  345. lv2s.sort()
  346. vst2s.sort()
  347. sf2s.sort()
  348. sfzs.sort()
  349. for ladspa in ladspas:
  350. if not ladspa: continue
  351. self.ui.lw_ladspa.addItem(ladspa)
  352. for dssi in dssis:
  353. if not dssi: continue
  354. self.ui.lw_dssi.addItem(dssi)
  355. for lv2 in lv2s:
  356. if not lv2: continue
  357. self.ui.lw_lv2.addItem(lv2)
  358. for vst2 in vst2s:
  359. if not vst2: continue
  360. self.ui.lw_vst.addItem(vst2)
  361. for sf2 in sf2s:
  362. if not sf2: continue
  363. self.ui.lw_sf2.addItem(sf2)
  364. for sfz in sfzs:
  365. if not sfz: continue
  366. self.ui.lw_sfz.addItem(sfz)
  367. # ----------------------------------------------------------------------------------------------------
  368. # Wine
  369. self.ui.le_wine_exec.setText(settings.value(CARLA_KEY_WINE_EXECUTABLE,
  370. CARLA_DEFAULT_WINE_EXECUTABLE,
  371. type=str))
  372. self.ui.cb_wine_prefix_detect.setChecked(settings.value(CARLA_KEY_WINE_AUTO_PREFIX,
  373. CARLA_DEFAULT_WINE_AUTO_PREFIX,
  374. type=bool))
  375. self.ui.le_wine_prefix_fallback.setText(settings.value(CARLA_KEY_WINE_FALLBACK_PREFIX,
  376. CARLA_DEFAULT_WINE_FALLBACK_PREFIX,
  377. type=str))
  378. self.ui.group_wine_realtime.setChecked(settings.value(CARLA_KEY_WINE_RT_PRIO_ENABLED,
  379. CARLA_DEFAULT_WINE_RT_PRIO_ENABLED,
  380. type=bool))
  381. self.ui.sb_wine_base_prio.setValue(settings.value(CARLA_KEY_WINE_BASE_RT_PRIO,
  382. CARLA_DEFAULT_WINE_BASE_RT_PRIO,
  383. type=int))
  384. self.ui.sb_wine_server_prio.setValue(settings.value(CARLA_KEY_WINE_SERVER_RT_PRIO,
  385. CARLA_DEFAULT_WINE_SERVER_RT_PRIO,
  386. type=int))
  387. # ----------------------------------------------------------------------------------------------------
  388. # Experimental
  389. self.ui.ch_exp_jack_apps.setChecked(settings.value(CARLA_KEY_EXPERIMENTAL_JACK_APPS,
  390. CARLA_DEFAULT_EXPERIMENTAL_JACK_APPS,
  391. type=bool))
  392. self.ui.ch_exp_export_lv2.setChecked(settings.value(CARLA_KEY_EXPERIMENTAL_EXPORT_LV2,
  393. CARLA_DEFAULT_EXPERIMENTAL_LV2_EXPORT,
  394. type=bool))
  395. self.ui.ch_exp_load_lib_global.setChecked(settings.value(CARLA_KEY_EXPERIMENTAL_LOAD_LIB_GLOBAL,
  396. CARLA_DEFAULT_EXPERIMENTAL_LOAD_LIB_GLOBAL,
  397. type=bool))
  398. self.ui.ch_exp_prevent_bad_behaviour.setChecked(settings.value(CARLA_KEY_EXPERIMENTAL_PREVENT_BAD_BEHAVIOUR,
  399. CARLA_DEFAULT_EXPERIMENTAL_PREVENT_BAD_BEHAVIOUR,
  400. type=bool))
  401. # --------------------------------------------------------------------------------------------------------
  402. @pyqtSlot()
  403. def slot_saveSettings(self):
  404. settings = QSettings()
  405. self.host.experimental = self.ui.ch_main_experimental.isChecked()
  406. if not self.host.experimental:
  407. self.resetExperimentalSettings()
  408. # ----------------------------------------------------------------------------------------------------
  409. # Main
  410. settings.setValue(CARLA_KEY_MAIN_PROJECT_FOLDER, self.ui.le_main_proj_folder.text())
  411. settings.setValue(CARLA_KEY_MAIN_CONFIRM_EXIT, self.ui.ch_main_confirm_exit.isChecked())
  412. settings.setValue(CARLA_KEY_MAIN_USE_PRO_THEME, self.ui.ch_main_theme_pro.isChecked())
  413. settings.setValue(CARLA_KEY_MAIN_PRO_THEME_COLOR, self.ui.cb_main_theme_color.currentText())
  414. settings.setValue(CARLA_KEY_MAIN_REFRESH_INTERVAL, self.ui.sb_main_refresh_interval.value())
  415. settings.setValue(CARLA_KEY_MAIN_USE_CUSTOM_SKINS, self.ui.ch_main_use_custom_skins.isChecked())
  416. # ----------------------------------------------------------------------------------------------------
  417. # Canvas
  418. settings.setValue(CARLA_KEY_CANVAS_THEME, self.ui.cb_canvas_theme.currentText())
  419. settings.setValue(CARLA_KEY_CANVAS_SIZE, self.ui.cb_canvas_size.currentText())
  420. settings.setValue(CARLA_KEY_CANVAS_USE_BEZIER_LINES, self.ui.cb_canvas_bezier_lines.isChecked())
  421. settings.setValue(CARLA_KEY_CANVAS_AUTO_HIDE_GROUPS, self.ui.cb_canvas_hide_groups.isChecked())
  422. settings.setValue(CARLA_KEY_CANVAS_AUTO_SELECT_ITEMS, self.ui.cb_canvas_auto_select.isChecked())
  423. settings.setValue(CARLA_KEY_CANVAS_EYE_CANDY, self.ui.cb_canvas_eyecandy.isChecked())
  424. settings.setValue(CARLA_KEY_CANVAS_FANCY_EYE_CANDY, self.ui.cb_canvas_fancy_eyecandy.isChecked())
  425. settings.setValue(CARLA_KEY_CANVAS_USE_OPENGL, self.ui.cb_canvas_use_opengl.isChecked())
  426. settings.setValue(CARLA_KEY_CANVAS_HQ_ANTIALIASING, self.ui.cb_canvas_render_hq_aa.isChecked())
  427. settings.setValue(CARLA_KEY_CANVAS_ANTIALIASING, self.ui.cb_canvas_render_aa.checkState()) # 0, 1, 2 match their enum variants
  428. # ----------------------------------------------------------------------------------------------------
  429. settings = QSettings("falkTX", "Carla2")
  430. # ----------------------------------------------------------------------------------------------------
  431. # Main
  432. settings.setValue(CARLA_KEY_MAIN_EXPERIMENTAL, self.host.experimental)
  433. # ----------------------------------------------------------------------------------------------------
  434. # Engine
  435. audioDriver = self.ui.cb_engine_audio_driver.currentText()
  436. if audioDriver and self.host.audioDriverForced is None and not self.host.isPlugin:
  437. settings.setValue(CARLA_KEY_ENGINE_AUDIO_DRIVER, audioDriver)
  438. if not self.host.processModeForced:
  439. # engine sends callback if processMode really changes
  440. if audioDriver == "JACK":
  441. self.host.nextProcessMode = self.ui.cb_engine_process_mode_jack.currentIndex()
  442. else:
  443. self.host.nextProcessMode = self.ui.cb_engine_process_mode_other.currentIndex() + self.PROCESS_MODE_NON_JACK_PADDING
  444. settings.setValue(CARLA_KEY_ENGINE_PROCESS_MODE, self.host.nextProcessMode)
  445. self.host.exportLV2 = self.ui.ch_exp_export_lv2.isChecked()
  446. self.host.forceStereo = self.ui.ch_engine_force_stereo.isChecked()
  447. self.host.maxParameters = self.ui.sb_engine_max_params.value()
  448. self.host.manageUIs = self.ui.ch_engine_manage_uis.isChecked()
  449. self.host.preferPluginBridges = self.ui.ch_engine_prefer_plugin_bridges.isChecked()
  450. self.host.preferUIBridges = self.ui.ch_engine_prefer_ui_bridges.isChecked()
  451. self.host.showLogs = self.ui.ch_main_show_logs.isChecked()
  452. self.host.showPluginBridges = self.ui.cb_exp_plugin_bridges.isChecked()
  453. self.host.showWineBridges = self.ui.ch_exp_wine_bridges.isChecked()
  454. self.host.uiBridgesTimeout = self.ui.sb_engine_ui_bridges_timeout.value()
  455. self.host.uisAlwaysOnTop = self.ui.ch_engine_uis_always_on_top.isChecked()
  456. if self.ui.ch_engine_force_stereo.isEnabled():
  457. settings.setValue(CARLA_KEY_ENGINE_FORCE_STEREO, self.host.forceStereo)
  458. settings.setValue(CARLA_KEY_MAIN_SHOW_LOGS, self.host.showLogs)
  459. settings.setValue(CARLA_KEY_ENGINE_MAX_PARAMETERS, self.host.maxParameters)
  460. settings.setValue(CARLA_KEY_ENGINE_MANAGE_UIS, self.host.manageUIs)
  461. settings.setValue(CARLA_KEY_ENGINE_PREFER_PLUGIN_BRIDGES, self.host.preferPluginBridges)
  462. settings.setValue(CARLA_KEY_ENGINE_PREFER_UI_BRIDGES, self.host.preferUIBridges)
  463. settings.setValue(CARLA_KEY_ENGINE_UI_BRIDGES_TIMEOUT, self.host.uiBridgesTimeout)
  464. settings.setValue(CARLA_KEY_ENGINE_UIS_ALWAYS_ON_TOP, self.host.uisAlwaysOnTop)
  465. settings.setValue(CARLA_KEY_EXPERIMENTAL_EXPORT_LV2, self.host.exportLV2)
  466. settings.setValue(CARLA_KEY_EXPERIMENTAL_PLUGIN_BRIDGES, self.host.showPluginBridges)
  467. settings.setValue(CARLA_KEY_EXPERIMENTAL_WINE_BRIDGES, self.host.showWineBridges)
  468. # ----------------------------------------------------------------------------------------------------
  469. # Paths
  470. ladspas = []
  471. dssis = []
  472. lv2s = []
  473. vst2s = []
  474. sf2s = []
  475. sfzs = []
  476. for i in range(self.ui.lw_ladspa.count()):
  477. ladspas.append(self.ui.lw_ladspa.item(i).text())
  478. for i in range(self.ui.lw_dssi.count()):
  479. dssis.append(self.ui.lw_dssi.item(i).text())
  480. for i in range(self.ui.lw_lv2.count()):
  481. lv2s.append(self.ui.lw_lv2.item(i).text())
  482. for i in range(self.ui.lw_vst.count()):
  483. vst2s.append(self.ui.lw_vst.item(i).text())
  484. for i in range(self.ui.lw_sf2.count()):
  485. sf2s.append(self.ui.lw_sf2.item(i).text())
  486. for i in range(self.ui.lw_sfz.count()):
  487. sfzs.append(self.ui.lw_sfz.item(i).text())
  488. self.host.set_engine_option(ENGINE_OPTION_PLUGIN_PATH, PLUGIN_LADSPA, splitter.join(ladspas))
  489. self.host.set_engine_option(ENGINE_OPTION_PLUGIN_PATH, PLUGIN_DSSI, splitter.join(dssis))
  490. self.host.set_engine_option(ENGINE_OPTION_PLUGIN_PATH, PLUGIN_LV2, splitter.join(lv2s))
  491. self.host.set_engine_option(ENGINE_OPTION_PLUGIN_PATH, PLUGIN_VST2, splitter.join(vst2s))
  492. self.host.set_engine_option(ENGINE_OPTION_PLUGIN_PATH, PLUGIN_SF2, splitter.join(sf2s))
  493. self.host.set_engine_option(ENGINE_OPTION_PLUGIN_PATH, PLUGIN_SFZ, splitter.join(sfzs))
  494. settings.setValue(CARLA_KEY_PATHS_LADSPA, ladspas)
  495. settings.setValue(CARLA_KEY_PATHS_DSSI, dssis)
  496. settings.setValue(CARLA_KEY_PATHS_LV2, lv2s)
  497. settings.setValue(CARLA_KEY_PATHS_VST2, vst2s)
  498. settings.setValue(CARLA_KEY_PATHS_SF2, sf2s)
  499. settings.setValue(CARLA_KEY_PATHS_SFZ, sfzs)
  500. # ----------------------------------------------------------------------------------------------------
  501. # Wine
  502. settings.setValue(CARLA_KEY_WINE_EXECUTABLE, self.ui.le_wine_exec.text())
  503. settings.setValue(CARLA_KEY_WINE_AUTO_PREFIX, self.ui.cb_wine_prefix_detect.isChecked())
  504. settings.setValue(CARLA_KEY_WINE_FALLBACK_PREFIX, self.ui.le_wine_prefix_fallback.text())
  505. settings.setValue(CARLA_KEY_WINE_RT_PRIO_ENABLED, self.ui.group_wine_realtime.isChecked())
  506. settings.setValue(CARLA_KEY_WINE_BASE_RT_PRIO, self.ui.sb_wine_base_prio.value())
  507. settings.setValue(CARLA_KEY_WINE_SERVER_RT_PRIO, self.ui.sb_wine_server_prio.value())
  508. # ----------------------------------------------------------------------------------------------------
  509. # Experimental
  510. settings.setValue(CARLA_KEY_EXPERIMENTAL_JACK_APPS, self.ui.ch_exp_jack_apps.isChecked())
  511. settings.setValue(CARLA_KEY_EXPERIMENTAL_LOAD_LIB_GLOBAL, self.ui.ch_exp_load_lib_global.isChecked())
  512. settings.setValue(CARLA_KEY_EXPERIMENTAL_PREVENT_BAD_BEHAVIOUR, self.ui.ch_exp_prevent_bad_behaviour.isChecked())
  513. # --------------------------------------------------------------------------------------------------------
  514. @pyqtSlot()
  515. def slot_resetSettings(self):
  516. # ----------------------------------------------------------------------------------------------------
  517. # Main
  518. if self.ui.lw_page.currentRow() == self.TAB_INDEX_MAIN:
  519. self.ui.le_main_proj_folder.setText(CARLA_DEFAULT_MAIN_PROJECT_FOLDER)
  520. self.ui.ch_main_theme_pro.setChecked(CARLA_DEFAULT_MAIN_USE_PRO_THEME and self.ui.group_main_theme.isEnabled())
  521. self.ui.cb_main_theme_color.setCurrentIndex(self.ui.cb_main_theme_color.findText(CARLA_DEFAULT_MAIN_PRO_THEME_COLOR))
  522. self.ui.sb_main_refresh_interval.setValue(CARLA_DEFAULT_MAIN_REFRESH_INTERVAL)
  523. self.ui.ch_main_confirm_exit.setChecked(CARLA_DEFAULT_MAIN_CONFIRM_EXIT)
  524. self.ui.ch_main_use_custom_skins.setChecked(CARLA_DEFAULT_MAIN_USE_CUSTOM_SKINS)
  525. self.ui.ch_main_show_logs.setChecked(CARLA_DEFAULT_MAIN_SHOW_LOGS)
  526. # ----------------------------------------------------------------------------------------------------
  527. # Canvas
  528. elif self.ui.lw_page.currentRow() == self.TAB_INDEX_CANVAS:
  529. self.ui.cb_canvas_theme.setCurrentIndex(self.ui.cb_canvas_theme.findText(CARLA_DEFAULT_CANVAS_THEME))
  530. self.ui.cb_canvas_size.setCurrentIndex(self.ui.cb_canvas_size.findText(CARLA_DEFAULT_CANVAS_SIZE))
  531. self.ui.cb_canvas_bezier_lines.setChecked(CARLA_DEFAULT_CANVAS_USE_BEZIER_LINES)
  532. self.ui.cb_canvas_hide_groups.setChecked(CARLA_DEFAULT_CANVAS_AUTO_HIDE_GROUPS)
  533. self.ui.cb_canvas_auto_select.setChecked(CARLA_DEFAULT_CANVAS_AUTO_SELECT_ITEMS)
  534. self.ui.cb_canvas_eyecandy.setChecked(CARLA_DEFAULT_CANVAS_EYE_CANDY)
  535. self.ui.cb_canvas_render_aa.setCheckState(Qt.PartiallyChecked) # CARLA_DEFAULT_CANVAS_ANTIALIASING
  536. # ----------------------------------------------------------------------------------------------------
  537. # Engine
  538. elif self.ui.lw_page.currentRow() == self.TAB_INDEX_ENGINE:
  539. if not self.host.isPlugin:
  540. self.ui.cb_engine_audio_driver.setCurrentIndex(0)
  541. if not self.host.processModeForced:
  542. if self.ui.cb_engine_audio_driver.currentText() == "JACK":
  543. self.ui.cb_engine_process_mode_jack.setCurrentIndex(CARLA_DEFAULT_PROCESS_MODE)
  544. self.ui.sw_engine_process_mode.setCurrentIndex(0) # show all modes
  545. else:
  546. self.ui.cb_engine_process_mode_other.setCurrentIndex(CARLA_DEFAULT_PROCESS_MODE-self.PROCESS_MODE_NON_JACK_PADDING)
  547. self.ui.sw_engine_process_mode.setCurrentIndex(1) # hide single+multi client modes
  548. self.ui.sb_engine_max_params.setValue(CARLA_DEFAULT_MAX_PARAMETERS)
  549. self.ui.ch_engine_uis_always_on_top.setChecked(CARLA_DEFAULT_UIS_ALWAYS_ON_TOP)
  550. self.ui.ch_engine_prefer_ui_bridges.setChecked(CARLA_DEFAULT_PREFER_UI_BRIDGES)
  551. self.ui.sb_engine_ui_bridges_timeout.setValue(CARLA_DEFAULT_UI_BRIDGES_TIMEOUT)
  552. self.ui.ch_engine_manage_uis.setChecked(CARLA_DEFAULT_MANAGE_UIS)
  553. # ----------------------------------------------------------------------------------------------------
  554. # Paths
  555. elif self.ui.lw_page.currentRow() == self.TAB_INDEX_PATHS:
  556. curIndex = self.ui.tw_paths.currentIndex()
  557. if curIndex == self.PATH_INDEX_LADSPA:
  558. paths = CARLA_DEFAULT_LADSPA_PATH
  559. paths.sort()
  560. self.ui.lw_ladspa.clear()
  561. for path in paths:
  562. if not path: continue
  563. self.ui.lw_ladspa.addItem(path)
  564. elif curIndex == self.PATH_INDEX_DSSI:
  565. paths = CARLA_DEFAULT_DSSI_PATH
  566. paths.sort()
  567. self.ui.lw_dssi.clear()
  568. for path in paths:
  569. if not path: continue
  570. self.ui.lw_dssi.addItem(path)
  571. elif curIndex == self.PATH_INDEX_LV2:
  572. paths = CARLA_DEFAULT_LV2_PATH
  573. paths.sort()
  574. self.ui.lw_lv2.clear()
  575. for path in paths:
  576. if not path: continue
  577. self.ui.lw_lv2.addItem(path)
  578. elif curIndex == self.PATH_INDEX_VST2:
  579. paths = CARLA_DEFAULT_VST2_PATH
  580. paths.sort()
  581. self.ui.lw_vst.clear()
  582. for path in paths:
  583. if not path: continue
  584. self.ui.lw_vst.addItem(path)
  585. elif curIndex == self.PATH_INDEX_SF2:
  586. paths = CARLA_DEFAULT_SF2_PATH
  587. paths.sort()
  588. self.ui.lw_sf2.clear()
  589. for path in paths:
  590. if not path: continue
  591. self.ui.lw_sf2.addItem(path)
  592. elif curIndex == self.PATH_INDEX_SFZ:
  593. paths = CARLA_DEFAULT_SFZ_PATH
  594. paths.sort()
  595. self.ui.lw_sfz.clear()
  596. for path in paths:
  597. if not path: continue
  598. self.ui.lw_sfz.addItem(path)
  599. # ----------------------------------------------------------------------------------------------------
  600. # Wine
  601. elif self.ui.lw_page.currentRow() == self.TAB_INDEX_WINE:
  602. self.ui.le_wine_exec.setText(CARLA_DEFAULT_WINE_EXECUTABLE)
  603. self.ui.cb_wine_prefix_detect.setChecked(CARLA_DEFAULT_WINE_AUTO_PREFIX)
  604. self.ui.le_wine_prefix_fallback.setText(CARLA_DEFAULT_WINE_FALLBACK_PREFIX)
  605. self.ui.group_wine_realtime.setChecked(CARLA_DEFAULT_WINE_RT_PRIO_ENABLED)
  606. self.ui.sb_wine_base_prio.setValue(CARLA_DEFAULT_WINE_BASE_RT_PRIO)
  607. self.ui.sb_wine_server_prio.setValue(CARLA_DEFAULT_WINE_SERVER_RT_PRIO)
  608. # ----------------------------------------------------------------------------------------------------
  609. # Experimental
  610. elif self.ui.lw_page.currentRow() == self.TAB_INDEX_EXPERIMENTAL:
  611. self.resetExperimentalSettings()
  612. def resetExperimentalSettings(self):
  613. # Forever experimental
  614. self.ui.cb_exp_plugin_bridges.setChecked(CARLA_DEFAULT_EXPERIMENTAL_PLUGIN_BRIDGES)
  615. self.ui.ch_exp_wine_bridges.setChecked(CARLA_DEFAULT_EXPERIMENTAL_WINE_BRIDGES)
  616. self.ui.ch_exp_jack_apps.setChecked(CARLA_DEFAULT_EXPERIMENTAL_JACK_APPS)
  617. self.ui.ch_exp_export_lv2.setChecked(CARLA_DEFAULT_EXPERIMENTAL_LV2_EXPORT)
  618. self.ui.ch_exp_load_lib_global.setChecked(CARLA_DEFAULT_EXPERIMENTAL_LOAD_LIB_GLOBAL)
  619. self.ui.ch_exp_prevent_bad_behaviour.setChecked(CARLA_DEFAULT_EXPERIMENTAL_PREVENT_BAD_BEHAVIOUR)
  620. # Temporary, until stable
  621. self.ui.cb_canvas_fancy_eyecandy.setChecked(CARLA_DEFAULT_CANVAS_FANCY_EYE_CANDY)
  622. self.ui.cb_canvas_use_opengl.setChecked(CARLA_DEFAULT_CANVAS_USE_OPENGL and self.ui.cb_canvas_use_opengl.isEnabled())
  623. self.ui.cb_canvas_render_hq_aa.setChecked(CARLA_DEFAULT_CANVAS_HQ_ANTIALIASING and self.ui.cb_canvas_render_hq_aa.isEnabled())
  624. self.ui.ch_engine_force_stereo.setChecked(CARLA_DEFAULT_FORCE_STEREO)
  625. self.ui.ch_engine_prefer_plugin_bridges.setChecked(CARLA_DEFAULT_PREFER_PLUGIN_BRIDGES)
  626. # --------------------------------------------------------------------------------------------------------
  627. @pyqtSlot(bool)
  628. def slot_enableExperimental(self, toggled):
  629. if toggled:
  630. self.ui.lw_page.showRow(self.TAB_INDEX_EXPERIMENTAL)
  631. if self.ui.ch_exp_wine_bridges.isChecked():
  632. self.ui.lw_page.showRow(self.TAB_INDEX_WINE)
  633. else:
  634. self.ui.lw_page.hideRow(self.TAB_INDEX_EXPERIMENTAL)
  635. self.ui.lw_page.hideRow(self.TAB_INDEX_WINE)
  636. @pyqtSlot(bool)
  637. def slot_enableWineBridges(self, toggled):
  638. if toggled:
  639. self.ui.lw_page.showRow(self.TAB_INDEX_WINE)
  640. else:
  641. self.ui.lw_page.hideRow(self.TAB_INDEX_WINE)
  642. @pyqtSlot(bool)
  643. def slot_pluginBridgesToggled(self, toggled):
  644. if not toggled:
  645. self.ui.ch_exp_wine_bridges.setChecked(False)
  646. self.ui.ch_engine_prefer_plugin_bridges.setChecked(False)
  647. self.ui.lw_page.hideRow(self.TAB_INDEX_WINE)
  648. @pyqtSlot(bool)
  649. def slot_canvasEyeCandyToggled(self, toggled):
  650. if not toggled:
  651. self.ui.cb_canvas_fancy_eyecandy.setChecked(False)
  652. @pyqtSlot(bool)
  653. def slot_canvasFancyEyeCandyToggled(self, toggled):
  654. if toggled:
  655. self.ui.cb_canvas_eyecandy.setChecked(True)
  656. @pyqtSlot(bool)
  657. def slot_canvasOpenGLToggled(self, toggled):
  658. if not toggled:
  659. self.ui.cb_canvas_render_hq_aa.setChecked(False)
  660. # --------------------------------------------------------------------------------------------------------
  661. @pyqtSlot()
  662. def slot_getAndSetProjectPath(self):
  663. # FIXME
  664. getAndSetPath(self, self.ui.le_main_proj_folder)
  665. # --------------------------------------------------------------------------------------------------------
  666. @pyqtSlot()
  667. def slot_engineAudioDriverChanged(self):
  668. if self.ui.cb_engine_audio_driver.currentText() == "JACK":
  669. self.ui.sw_engine_process_mode.setCurrentIndex(0)
  670. else:
  671. self.ui.sw_engine_process_mode.setCurrentIndex(1)
  672. @pyqtSlot()
  673. def slot_showAudioDriverSettings(self):
  674. driverIndex = self.ui.cb_engine_audio_driver.currentIndex()
  675. driverName = self.ui.cb_engine_audio_driver.currentText()
  676. DriverSettingsW(self, self.host, driverIndex, driverName).exec_()
  677. # --------------------------------------------------------------------------------------------------------
  678. @pyqtSlot()
  679. def slot_addPluginPath(self):
  680. newPath = QFileDialog.getExistingDirectory(self, self.tr("Add Path"), "", QFileDialog.ShowDirsOnly)
  681. if not newPath:
  682. return
  683. curIndex = self.ui.tw_paths.currentIndex()
  684. if curIndex == self.PATH_INDEX_LADSPA:
  685. self.ui.lw_ladspa.addItem(newPath)
  686. elif curIndex == self.PATH_INDEX_DSSI:
  687. self.ui.lw_dssi.addItem(newPath)
  688. elif curIndex == self.PATH_INDEX_LV2:
  689. self.ui.lw_lv2.addItem(newPath)
  690. elif curIndex == self.PATH_INDEX_VST2:
  691. self.ui.lw_vst.addItem(newPath)
  692. elif curIndex == self.PATH_INDEX_SF2:
  693. self.ui.lw_sf2.addItem(newPath)
  694. elif curIndex == self.PATH_INDEX_SFZ:
  695. self.ui.lw_sfz.addItem(newPath)
  696. @pyqtSlot()
  697. def slot_removePluginPath(self):
  698. curIndex = self.ui.tw_paths.currentIndex()
  699. if curIndex == self.PATH_INDEX_LADSPA:
  700. self.ui.lw_ladspa.takeItem(self.ui.lw_ladspa.currentRow())
  701. elif curIndex == self.PATH_INDEX_DSSI:
  702. self.ui.lw_dssi.takeItem(self.ui.lw_dssi.currentRow())
  703. elif curIndex == self.PATH_INDEX_LV2:
  704. self.ui.lw_lv2.takeItem(self.ui.lw_lv2.currentRow())
  705. elif curIndex == self.PATH_INDEX_VST2:
  706. self.ui.lw_vst.takeItem(self.ui.lw_vst.currentRow())
  707. elif curIndex == self.PATH_INDEX_SF2:
  708. self.ui.lw_sf2.takeItem(self.ui.lw_sf2.currentRow())
  709. elif curIndex == self.PATH_INDEX_SFZ:
  710. self.ui.lw_sfz.takeItem(self.ui.lw_sfz.currentRow())
  711. @pyqtSlot()
  712. def slot_changePluginPath(self):
  713. curIndex = self.ui.tw_paths.currentIndex()
  714. if curIndex == self.PATH_INDEX_LADSPA:
  715. currentPath = self.ui.lw_ladspa.currentItem().text()
  716. elif curIndex == self.PATH_INDEX_DSSI:
  717. currentPath = self.ui.lw_dssi.currentItem().text()
  718. elif curIndex == self.PATH_INDEX_LV2:
  719. currentPath = self.ui.lw_lv2.currentItem().text()
  720. elif curIndex == self.PATH_INDEX_VST2:
  721. currentPath = self.ui.lw_vst.currentItem().text()
  722. elif curIndex == self.PATH_INDEX_SF2:
  723. currentPath = self.ui.lw_sf2.currentItem().text()
  724. elif curIndex == self.PATH_INDEX_SFZ:
  725. currentPath = self.ui.lw_sfz.currentItem().text()
  726. else:
  727. currentPath = ""
  728. newPath = QFileDialog.getExistingDirectory(self, self.tr("Add Path"), currentPath, QFileDialog.ShowDirsOnly)
  729. if not newPath:
  730. return
  731. if curIndex == self.PATH_INDEX_LADSPA:
  732. self.ui.lw_ladspa.currentItem().setText(newPath)
  733. elif curIndex == self.PATH_INDEX_DSSI:
  734. self.ui.lw_dssi.currentItem().setText(newPath)
  735. elif curIndex == self.PATH_INDEX_LV2:
  736. self.ui.lw_lv2.currentItem().setText(newPath)
  737. elif curIndex == self.PATH_INDEX_VST2:
  738. self.ui.lw_vst.currentItem().setText(newPath)
  739. elif curIndex == self.PATH_INDEX_SF2:
  740. self.ui.lw_sf2.currentItem().setText(newPath)
  741. elif curIndex == self.PATH_INDEX_SFZ:
  742. self.ui.lw_sfz.currentItem().setText(newPath)
  743. # --------------------------------------------------------------------------------------------------------
  744. @pyqtSlot(int)
  745. def slot_pluginPathTabChanged(self, index):
  746. if index == self.PATH_INDEX_LADSPA:
  747. row = self.ui.lw_ladspa.currentRow()
  748. elif index == self.PATH_INDEX_DSSI:
  749. row = self.ui.lw_dssi.currentRow()
  750. elif index == self.PATH_INDEX_LV2:
  751. row = self.ui.lw_lv2.currentRow()
  752. elif index == self.PATH_INDEX_VST2:
  753. row = self.ui.lw_vst.currentRow()
  754. elif index == self.PATH_INDEX_SF2:
  755. row = self.ui.lw_sf2.currentRow()
  756. elif index == self.PATH_INDEX_SFZ:
  757. row = self.ui.lw_sfz.currentRow()
  758. else:
  759. row = -1
  760. check = bool(row >= 0)
  761. self.ui.b_paths_remove.setEnabled(check)
  762. self.ui.b_paths_change.setEnabled(check)
  763. @pyqtSlot(int)
  764. def slot_pluginPathRowChanged(self, row):
  765. check = bool(row >= 0)
  766. self.ui.b_paths_remove.setEnabled(check)
  767. self.ui.b_paths_change.setEnabled(check)
  768. # --------------------------------------------------------------------------------------------------------
  769. def done(self, r):
  770. QDialog.done(self, r)
  771. self.close()
  772. # ------------------------------------------------------------------------------------------------------------
  773. # Main
  774. if __name__ == '__main__':
  775. from carla_app import CarlaApplication
  776. from carla_host import initHost, loadHostSettings
  777. initName, libPrefix = handleInitialCommandLineArguments(__file__ if "__file__" in dir() else None)
  778. app = CarlaApplication("Carla2-Settings", libPrefix)
  779. host = initHost("Carla2-Settings", libPrefix, False, False, False)
  780. loadHostSettings(host)
  781. gui = CarlaSettingsW(None, host, True, True)
  782. gui.show()
  783. app.exit_exec()
  784. # ------------------------------------------------------------------------------------------------------------