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.

1549 lines
68KB

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