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.

1556 lines
68KB

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