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.

1692 lines
74KB

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