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.

carla_settings.py 58KB

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