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.

1654 lines
72KB

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