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 48KB

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