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

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