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

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
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981
  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_EXPERIMENTAL = 4
  150. TAB_INDEX_NONE = 5
  151. # Path indexes
  152. PATH_INDEX_LADSPA = 0
  153. PATH_INDEX_DSSI = 1
  154. PATH_INDEX_LV2 = 2
  155. PATH_INDEX_VST2 = 3
  156. PATH_INDEX_VST3 = 4
  157. PATH_INDEX_GIG = 5
  158. PATH_INDEX_SF2 = 6
  159. PATH_INDEX_SFZ = 7
  160. # Single and Multiple client mode is only for JACK,
  161. # but we still want to match QComboBox index to backend defines,
  162. # so add +2 pos padding if driverName != "JACK".
  163. PROCESS_MODE_NON_JACK_PADDING = 2
  164. # --------------------------------------------------------------------------------------------------------
  165. def __init__(self, parent, host, hasCanvas, hasCanvasGL):
  166. QDialog.__init__(self, parent)
  167. self.host = host
  168. self.ui = ui_carla_settings.Ui_CarlaSettingsW()
  169. self.ui.setupUi(self)
  170. if False:
  171. # kdevelop likes this :)
  172. host = CarlaHostNull()
  173. self.host = host
  174. # ----------------------------------------------------------------------------------------------------
  175. # Set-up GUI
  176. self.ui.lw_page.setFixedWidth(48 + 6*3 + QFontMetrics(self.ui.lw_page.font()).width(" Experimental "))
  177. for i in range(host.get_engine_driver_count()):
  178. self.ui.cb_engine_audio_driver.addItem(host.get_engine_driver_name(i))
  179. for i in range(Theme.THEME_MAX):
  180. self.ui.cb_canvas_theme.addItem(getThemeName(i))
  181. if MACOS or (WINDOWS and not config_UseQt5):
  182. self.ui.group_main_theme.setEnabled(False)
  183. self.ui.group_main_theme.setVisible(False)
  184. if WINDOWS or host.isControl:
  185. self.ui.ch_main_show_logs.setEnabled(False)
  186. self.ui.ch_main_show_logs.setVisible(False)
  187. if MACOS or WINDOWS:
  188. self.ui.ch_engine_manage_uis.setEnabled(False)
  189. self.ui.ch_engine_manage_uis.setVisible(False)
  190. if host.isControl:
  191. self.ui.lw_page.hideRow(self.TAB_INDEX_CANVAS)
  192. self.ui.lw_page.hideRow(self.TAB_INDEX_ENGINE)
  193. self.ui.lw_page.hideRow(self.TAB_INDEX_PATHS)
  194. elif not hasCanvas:
  195. self.ui.lw_page.hideRow(self.TAB_INDEX_CANVAS)
  196. elif not hasCanvasGL:
  197. self.ui.cb_canvas_use_opengl.setEnabled(False)
  198. self.ui.cb_canvas_render_hq_aa.setEnabled(False)
  199. if host.isPlugin:
  200. self.ui.cb_engine_audio_driver.setEnabled(False)
  201. if host.audioDriverForced is not None:
  202. self.ui.cb_engine_audio_driver.setEnabled(False)
  203. self.ui.tb_engine_driver_config.setEnabled(False)
  204. if host.processModeForced:
  205. self.ui.cb_engine_process_mode_jack.setEnabled(False)
  206. self.ui.cb_engine_process_mode_other.setEnabled(False)
  207. if self.host.processMode == ENGINE_PROCESS_MODE_CONTINUOUS_RACK:
  208. self.ui.ch_engine_force_stereo.setEnabled(False)
  209. if host.isControl or host.isPlugin:
  210. self.ui.ch_exp_load_lib_global.hide()
  211. # FIXME, pipes on win32 not working
  212. if WINDOWS:
  213. self.ui.ch_engine_prefer_ui_bridges.setChecked(False)
  214. self.ui.ch_engine_prefer_ui_bridges.setEnabled(False)
  215. self.ui.ch_engine_prefer_ui_bridges.setVisible(False)
  216. # FIXME, not implemented yet
  217. self.ui.ch_engine_uis_always_on_top.hide()
  218. # ----------------------------------------------------------------------------------------------------
  219. # Load settings
  220. self.loadSettings()
  221. # ----------------------------------------------------------------------------------------------------
  222. # Set-up connections
  223. self.accepted.connect(self.slot_saveSettings)
  224. self.ui.buttonBox.button(QDialogButtonBox.Reset).clicked.connect(self.slot_resetSettings)
  225. self.ui.b_main_proj_folder_open.clicked.connect(self.slot_getAndSetProjectPath)
  226. self.ui.cb_engine_audio_driver.currentIndexChanged.connect(self.slot_engineAudioDriverChanged)
  227. self.ui.tb_engine_driver_config.clicked.connect(self.slot_showAudioDriverSettings)
  228. self.ui.b_paths_add.clicked.connect(self.slot_addPluginPath)
  229. self.ui.b_paths_remove.clicked.connect(self.slot_removePluginPath)
  230. self.ui.b_paths_change.clicked.connect(self.slot_changePluginPath)
  231. self.ui.cb_paths.currentIndexChanged.connect(self.slot_pluginPathTabChanged)
  232. self.ui.lw_ladspa.currentRowChanged.connect(self.slot_pluginPathRowChanged)
  233. self.ui.lw_dssi.currentRowChanged.connect(self.slot_pluginPathRowChanged)
  234. self.ui.lw_lv2.currentRowChanged.connect(self.slot_pluginPathRowChanged)
  235. self.ui.lw_vst.currentRowChanged.connect(self.slot_pluginPathRowChanged)
  236. self.ui.lw_vst3.currentRowChanged.connect(self.slot_pluginPathRowChanged)
  237. self.ui.lw_gig.currentRowChanged.connect(self.slot_pluginPathRowChanged)
  238. self.ui.lw_sf2.currentRowChanged.connect(self.slot_pluginPathRowChanged)
  239. self.ui.lw_sfz.currentRowChanged.connect(self.slot_pluginPathRowChanged)
  240. self.ui.ch_main_experimental.toggled.connect(self.slot_enableExperimental)
  241. self.ui.cb_canvas_eyecandy.toggled.connect(self.slot_canvasEyeCandyToggled)
  242. self.ui.cb_canvas_fancy_eyecandy.toggled.connect(self.slot_canvasFancyEyeCandyToggled)
  243. # ----------------------------------------------------------------------------------------------------
  244. # Post-connect setup
  245. self.ui.lw_ladspa.setCurrentRow(0)
  246. self.ui.lw_dssi.setCurrentRow(0)
  247. self.ui.lw_lv2.setCurrentRow(0)
  248. self.ui.lw_vst.setCurrentRow(0)
  249. self.ui.lw_vst3.setCurrentRow(0)
  250. self.ui.lw_gig.setCurrentRow(0)
  251. self.ui.lw_sf2.setCurrentRow(0)
  252. self.ui.lw_sfz.setCurrentRow(0)
  253. self.ui.lw_page.setCurrentCell(0, 0)
  254. # --------------------------------------------------------------------------------------------------------
  255. def loadSettings(self):
  256. settings = QSettings()
  257. # ----------------------------------------------------------------------------------------------------
  258. # Main
  259. self.ui.ch_main_show_logs.setChecked(self.host.showLogs)
  260. self.ui.ch_engine_uis_always_on_top.setChecked(self.host.uisAlwaysOnTop)
  261. self.ui.le_main_proj_folder.setText(settings.value(CARLA_KEY_MAIN_PROJECT_FOLDER, CARLA_DEFAULT_MAIN_PROJECT_FOLDER, type=str))
  262. 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())
  263. 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)))
  264. self.ui.sb_main_refresh_interval.setValue(settings.value(CARLA_KEY_MAIN_REFRESH_INTERVAL, CARLA_DEFAULT_MAIN_REFRESH_INTERVAL, type=int))
  265. self.ui.ch_main_use_custom_skins.setChecked(settings.value(CARLA_KEY_MAIN_USE_CUSTOM_SKINS, CARLA_DEFAULT_MAIN_USE_CUSTOM_SKINS, type=bool))
  266. # ----------------------------------------------------------------------------------------------------
  267. # Canvas
  268. self.ui.cb_canvas_theme.setCurrentIndex(self.ui.cb_canvas_theme.findText(settings.value(CARLA_KEY_CANVAS_THEME, CARLA_DEFAULT_CANVAS_THEME, type=str)))
  269. self.ui.cb_canvas_size.setCurrentIndex(self.ui.cb_canvas_size.findText(settings.value(CARLA_KEY_CANVAS_SIZE, CARLA_DEFAULT_CANVAS_SIZE, type=str)))
  270. self.ui.cb_canvas_bezier_lines.setChecked(settings.value(CARLA_KEY_CANVAS_USE_BEZIER_LINES, CARLA_DEFAULT_CANVAS_USE_BEZIER_LINES, type=bool))
  271. self.ui.cb_canvas_hide_groups.setChecked(settings.value(CARLA_KEY_CANVAS_AUTO_HIDE_GROUPS, CARLA_DEFAULT_CANVAS_AUTO_HIDE_GROUPS, type=bool))
  272. self.ui.cb_canvas_auto_select.setChecked(settings.value(CARLA_KEY_CANVAS_AUTO_SELECT_ITEMS, CARLA_DEFAULT_CANVAS_AUTO_SELECT_ITEMS, type=bool))
  273. self.ui.cb_canvas_eyecandy.setChecked(settings.value(CARLA_KEY_CANVAS_EYE_CANDY, CARLA_DEFAULT_CANVAS_EYE_CANDY, type=bool))
  274. self.ui.cb_canvas_fancy_eyecandy.setChecked(settings.value(CARLA_KEY_CANVAS_FANCY_EYE_CANDY, CARLA_DEFAULT_CANVAS_FANCY_EYE_CANDY, type=bool))
  275. 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())
  276. self.ui.cb_canvas_render_aa.setCheckState(settings.value(CARLA_KEY_CANVAS_ANTIALIASING, CARLA_DEFAULT_CANVAS_ANTIALIASING, type=int))
  277. 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())
  278. # ----------------------------------------------------------------------------------------------------
  279. settings = QSettings("falkTX", "Carla2")
  280. # ----------------------------------------------------------------------------------------------------
  281. # Main
  282. self.ui.ch_main_experimental.setChecked(self.host.experimental)
  283. if not self.host.experimental:
  284. self.ui.lw_page.hideRow(self.TAB_INDEX_EXPERIMENTAL)
  285. # ----------------------------------------------------------------------------------------------------
  286. # Engine
  287. if self.host.isPlugin:
  288. audioDriver = "Plugin"
  289. self.ui.cb_engine_audio_driver.setCurrentIndex(0)
  290. elif self.host.audioDriverForced:
  291. audioDriver = self.host.audioDriverForced
  292. self.ui.cb_engine_audio_driver.setCurrentIndex(0)
  293. else:
  294. audioDriver = settings.value(CARLA_KEY_ENGINE_AUDIO_DRIVER, CARLA_DEFAULT_AUDIO_DRIVER, type=str)
  295. for i in range(self.ui.cb_engine_audio_driver.count()):
  296. if self.ui.cb_engine_audio_driver.itemText(i) == audioDriver:
  297. self.ui.cb_engine_audio_driver.setCurrentIndex(i)
  298. break
  299. else:
  300. self.ui.cb_engine_audio_driver.setCurrentIndex(-1)
  301. if audioDriver == "JACK":
  302. self.ui.sw_engine_process_mode.setCurrentIndex(0)
  303. self.ui.tb_engine_driver_config.setEnabled(False)
  304. else:
  305. self.ui.sw_engine_process_mode.setCurrentIndex(1)
  306. self.ui.tb_engine_driver_config.setEnabled(self.host.audioDriverForced is None and not self.host.isPlugin)
  307. self.ui.cb_engine_process_mode_jack.setCurrentIndex(self.host.nextProcessMode)
  308. if self.host.nextProcessMode >= self.PROCESS_MODE_NON_JACK_PADDING:
  309. self.ui.cb_engine_process_mode_other.setCurrentIndex(self.host.nextProcessMode-self.PROCESS_MODE_NON_JACK_PADDING)
  310. else:
  311. self.ui.cb_engine_process_mode_other.setCurrentIndex(0)
  312. self.ui.sb_engine_max_params.setValue(self.host.maxParameters)
  313. self.ui.ch_engine_manage_uis.setChecked(self.host.manageUIs)
  314. self.ui.ch_engine_prefer_ui_bridges.setChecked(self.host.preferUIBridges)
  315. self.ui.sb_engine_ui_bridges_timeout.setValue(self.host.uiBridgesTimeout)
  316. self.ui.ch_engine_force_stereo.setChecked(self.host.forceStereo or not self.ui.ch_engine_force_stereo.isEnabled())
  317. self.ui.ch_engine_prefer_plugin_bridges.setChecked(self.host.preferPluginBridges)
  318. # ----------------------------------------------------------------------------------------------------
  319. # Paths
  320. ladspas = toList(settings.value(CARLA_KEY_PATHS_LADSPA, CARLA_DEFAULT_LADSPA_PATH))
  321. dssis = toList(settings.value(CARLA_KEY_PATHS_DSSI, CARLA_DEFAULT_DSSI_PATH))
  322. lv2s = toList(settings.value(CARLA_KEY_PATHS_LV2, CARLA_DEFAULT_LV2_PATH))
  323. vst2s = toList(settings.value(CARLA_KEY_PATHS_VST2, CARLA_DEFAULT_VST2_PATH))
  324. vst3s = toList(settings.value(CARLA_KEY_PATHS_VST3, CARLA_DEFAULT_VST3_PATH))
  325. gigs = toList(settings.value(CARLA_KEY_PATHS_GIG, CARLA_DEFAULT_GIG_PATH))
  326. sf2s = toList(settings.value(CARLA_KEY_PATHS_SF2, CARLA_DEFAULT_SF2_PATH))
  327. sfzs = toList(settings.value(CARLA_KEY_PATHS_SFZ, CARLA_DEFAULT_SFZ_PATH))
  328. ladspas.sort()
  329. dssis.sort()
  330. lv2s.sort()
  331. vst2s.sort()
  332. vst3s.sort()
  333. gigs.sort()
  334. sf2s.sort()
  335. sfzs.sort()
  336. for ladspa in ladspas:
  337. if not ladspa: continue
  338. self.ui.lw_ladspa.addItem(ladspa)
  339. for dssi in dssis:
  340. if not dssi: continue
  341. self.ui.lw_dssi.addItem(dssi)
  342. for lv2 in lv2s:
  343. if not lv2: continue
  344. self.ui.lw_lv2.addItem(lv2)
  345. for vst2 in vst2s:
  346. if not vst2: continue
  347. self.ui.lw_vst.addItem(vst2)
  348. for vst3 in vst3s:
  349. if not vst3: continue
  350. self.ui.lw_vst3.addItem(vst3)
  351. for gig in gigs:
  352. if not gig: continue
  353. self.ui.lw_gig.addItem(gig)
  354. for sf2 in sf2s:
  355. if not sf2: continue
  356. self.ui.lw_sf2.addItem(sf2)
  357. for sfz in sfzs:
  358. if not sfz: continue
  359. self.ui.lw_sfz.addItem(sfz)
  360. # ----------------------------------------------------------------------------------------------------
  361. # Experimental
  362. self.ui.cb_exp_plugin_bridges.setChecked(settings.value(CARLA_KEY_EXPERIMENTAL_PLUGIN_BRIDGES,
  363. CARLA_DEFAULT_EXPERIMENTAL_PLUGIN_BRIDGES,
  364. type=bool))
  365. self.ui.ch_exp_jack_apps.setChecked(settings.value(CARLA_KEY_EXPERIMENTAL_JACK_APPS,
  366. CARLA_DEFAULT_EXPERIMENTAL_JACK_APPS,
  367. type=bool))
  368. self.ui.ch_exp_load_lib_global.setChecked(settings.value(CARLA_KEY_EXPERIMENTAL_LOAD_LIB_GLOBAL,
  369. CARLA_DEFAULT_EXPERIMENTAL_LOAD_LIB_GLOBAL,
  370. type=bool))
  371. self.ui.ch_exp_prevent_bad_behaviour.setChecked(settings.value(CARLA_KEY_EXPERIMENTAL_PREVENT_BAD_BEHAVIOUR,
  372. CARLA_DEFAULT_EXPERIMENTAL_PREVENT_BAD_BEHAVIOUR,
  373. type=bool))
  374. # --------------------------------------------------------------------------------------------------------
  375. @pyqtSlot()
  376. def slot_saveSettings(self):
  377. settings = QSettings()
  378. self.host.experimental = self.ui.ch_main_experimental.isChecked()
  379. if not self.host.experimental:
  380. self.resetExperimentalSettings()
  381. # ----------------------------------------------------------------------------------------------------
  382. # Main
  383. settings.setValue(CARLA_KEY_MAIN_PROJECT_FOLDER, self.ui.le_main_proj_folder.text())
  384. settings.setValue(CARLA_KEY_MAIN_USE_PRO_THEME, self.ui.ch_main_theme_pro.isChecked())
  385. settings.setValue(CARLA_KEY_MAIN_PRO_THEME_COLOR, self.ui.cb_main_theme_color.currentText())
  386. settings.setValue(CARLA_KEY_MAIN_REFRESH_INTERVAL, self.ui.sb_main_refresh_interval.value())
  387. settings.setValue(CARLA_KEY_MAIN_USE_CUSTOM_SKINS, self.ui.ch_main_use_custom_skins.isChecked())
  388. # ----------------------------------------------------------------------------------------------------
  389. # Canvas
  390. settings.setValue(CARLA_KEY_CANVAS_THEME, self.ui.cb_canvas_theme.currentText())
  391. settings.setValue(CARLA_KEY_CANVAS_SIZE, self.ui.cb_canvas_size.currentText())
  392. settings.setValue(CARLA_KEY_CANVAS_USE_BEZIER_LINES, self.ui.cb_canvas_bezier_lines.isChecked())
  393. settings.setValue(CARLA_KEY_CANVAS_AUTO_HIDE_GROUPS, self.ui.cb_canvas_hide_groups.isChecked())
  394. settings.setValue(CARLA_KEY_CANVAS_AUTO_SELECT_ITEMS, self.ui.cb_canvas_auto_select.isChecked())
  395. settings.setValue(CARLA_KEY_CANVAS_EYE_CANDY, self.ui.cb_canvas_eyecandy.isChecked())
  396. settings.setValue(CARLA_KEY_CANVAS_FANCY_EYE_CANDY, self.ui.cb_canvas_fancy_eyecandy.isChecked())
  397. settings.setValue(CARLA_KEY_CANVAS_USE_OPENGL, self.ui.cb_canvas_use_opengl.isChecked())
  398. settings.setValue(CARLA_KEY_CANVAS_HQ_ANTIALIASING, self.ui.cb_canvas_render_hq_aa.isChecked())
  399. settings.setValue(CARLA_KEY_CANVAS_ANTIALIASING, self.ui.cb_canvas_render_aa.checkState()) # 0, 1, 2 match their enum variants
  400. # ----------------------------------------------------------------------------------------------------
  401. settings = QSettings("falkTX", "Carla2")
  402. # ----------------------------------------------------------------------------------------------------
  403. # Main
  404. settings.setValue(CARLA_KEY_MAIN_EXPERIMENTAL, self.host.experimental)
  405. # ----------------------------------------------------------------------------------------------------
  406. # Engine
  407. audioDriver = self.ui.cb_engine_audio_driver.currentText()
  408. if audioDriver and self.host.audioDriverForced is None and not self.host.isPlugin:
  409. settings.setValue(CARLA_KEY_ENGINE_AUDIO_DRIVER, audioDriver)
  410. if not self.host.processModeForced:
  411. # engine sends callback if processMode really changes
  412. 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
  413. self.host.set_engine_option(ENGINE_OPTION_PROCESS_MODE, self.host.nextProcessMode, "")
  414. settings.setValue(CARLA_KEY_ENGINE_PROCESS_MODE, self.host.nextProcessMode)
  415. self.host.forceStereo = self.ui.ch_engine_force_stereo.isChecked()
  416. self.host.maxParameters = self.ui.sb_engine_max_params.value()
  417. self.host.manageUIs = self.ui.ch_engine_manage_uis.isChecked()
  418. self.host.preferPluginBridges = self.ui.ch_engine_prefer_plugin_bridges.isChecked()
  419. self.host.preferUIBridges = self.ui.ch_engine_prefer_ui_bridges.isChecked()
  420. self.host.showLogs = self.ui.ch_main_show_logs.isChecked()
  421. self.host.uiBridgesTimeout = self.ui.sb_engine_ui_bridges_timeout.value()
  422. self.host.uisAlwaysOnTop = self.ui.ch_engine_uis_always_on_top.isChecked()
  423. if self.ui.ch_engine_force_stereo.isEnabled():
  424. self.host.set_engine_option(ENGINE_OPTION_FORCE_STEREO, self.host.forceStereo, "")
  425. self.host.set_engine_option(ENGINE_OPTION_MAX_PARAMETERS, self.host.maxParameters, "")
  426. self.host.set_engine_option(ENGINE_OPTION_PREFER_PLUGIN_BRIDGES, self.host.preferPluginBridges, "")
  427. self.host.set_engine_option(ENGINE_OPTION_PREFER_UI_BRIDGES, self.host.preferUIBridges, "")
  428. self.host.set_engine_option(ENGINE_OPTION_UI_BRIDGES_TIMEOUT, self.host.uiBridgesTimeout, "")
  429. self.host.set_engine_option(ENGINE_OPTION_UIS_ALWAYS_ON_TOP, self.host.uisAlwaysOnTop, "")
  430. if self.ui.ch_engine_force_stereo.isEnabled():
  431. settings.setValue(CARLA_KEY_ENGINE_FORCE_STEREO, self.host.forceStereo)
  432. settings.setValue(CARLA_KEY_MAIN_SHOW_LOGS, self.host.showLogs)
  433. settings.setValue(CARLA_KEY_ENGINE_MAX_PARAMETERS, self.host.maxParameters)
  434. settings.setValue(CARLA_KEY_ENGINE_MANAGE_UIS, self.host.manageUIs)
  435. settings.setValue(CARLA_KEY_ENGINE_PREFER_PLUGIN_BRIDGES, self.host.preferPluginBridges)
  436. settings.setValue(CARLA_KEY_ENGINE_PREFER_UI_BRIDGES, self.host.preferUIBridges)
  437. settings.setValue(CARLA_KEY_ENGINE_UI_BRIDGES_TIMEOUT, self.host.uiBridgesTimeout)
  438. settings.setValue(CARLA_KEY_ENGINE_UIS_ALWAYS_ON_TOP, self.host.uisAlwaysOnTop)
  439. # ----------------------------------------------------------------------------------------------------
  440. # Paths
  441. ladspas = []
  442. dssis = []
  443. lv2s = []
  444. vst2s = []
  445. vst3s = []
  446. gigs = []
  447. sf2s = []
  448. sfzs = []
  449. for i in range(self.ui.lw_ladspa.count()):
  450. ladspas.append(self.ui.lw_ladspa.item(i).text())
  451. for i in range(self.ui.lw_dssi.count()):
  452. dssis.append(self.ui.lw_dssi.item(i).text())
  453. for i in range(self.ui.lw_lv2.count()):
  454. lv2s.append(self.ui.lw_lv2.item(i).text())
  455. for i in range(self.ui.lw_vst.count()):
  456. vst2s.append(self.ui.lw_vst.item(i).text())
  457. for i in range(self.ui.lw_vst3.count()):
  458. vst3s.append(self.ui.lw_vst3.item(i).text())
  459. for i in range(self.ui.lw_gig.count()):
  460. gigs.append(self.ui.lw_gig.item(i).text())
  461. for i in range(self.ui.lw_sf2.count()):
  462. sf2s.append(self.ui.lw_sf2.item(i).text())
  463. for i in range(self.ui.lw_sfz.count()):
  464. sfzs.append(self.ui.lw_sfz.item(i).text())
  465. self.host.set_engine_option(ENGINE_OPTION_PLUGIN_PATH, PLUGIN_LADSPA, splitter.join(ladspas))
  466. self.host.set_engine_option(ENGINE_OPTION_PLUGIN_PATH, PLUGIN_DSSI, splitter.join(dssis))
  467. self.host.set_engine_option(ENGINE_OPTION_PLUGIN_PATH, PLUGIN_LV2, splitter.join(lv2s))
  468. self.host.set_engine_option(ENGINE_OPTION_PLUGIN_PATH, PLUGIN_VST2, splitter.join(vst2s))
  469. self.host.set_engine_option(ENGINE_OPTION_PLUGIN_PATH, PLUGIN_VST3, splitter.join(vst3s))
  470. self.host.set_engine_option(ENGINE_OPTION_PLUGIN_PATH, PLUGIN_GIG, splitter.join(gigs))
  471. self.host.set_engine_option(ENGINE_OPTION_PLUGIN_PATH, PLUGIN_SF2, splitter.join(sf2s))
  472. self.host.set_engine_option(ENGINE_OPTION_PLUGIN_PATH, PLUGIN_SFZ, splitter.join(sfzs))
  473. settings.setValue(CARLA_KEY_PATHS_LADSPA, ladspas)
  474. settings.setValue(CARLA_KEY_PATHS_DSSI, dssis)
  475. settings.setValue(CARLA_KEY_PATHS_LV2, lv2s)
  476. settings.setValue(CARLA_KEY_PATHS_VST2, vst2s)
  477. settings.setValue(CARLA_KEY_PATHS_VST3, vst3s)
  478. settings.setValue(CARLA_KEY_PATHS_GIG, gigs)
  479. settings.setValue(CARLA_KEY_PATHS_SF2, sf2s)
  480. settings.setValue(CARLA_KEY_PATHS_SFZ, sfzs)
  481. # ----------------------------------------------------------------------------------------------------
  482. # Experimental
  483. settings.setValue(CARLA_KEY_EXPERIMENTAL_PLUGIN_BRIDGES, self.ui.cb_exp_plugin_bridges.isChecked())
  484. settings.setValue(CARLA_KEY_EXPERIMENTAL_JACK_APPS, self.ui.ch_exp_jack_apps.isChecked())
  485. settings.setValue(CARLA_KEY_EXPERIMENTAL_LOAD_LIB_GLOBAL, self.ui.ch_exp_load_lib_global.isChecked())
  486. settings.setValue(CARLA_KEY_EXPERIMENTAL_PREVENT_BAD_BEHAVIOUR, self.ui.ch_exp_prevent_bad_behaviour.isChecked())
  487. # --------------------------------------------------------------------------------------------------------
  488. @pyqtSlot()
  489. def slot_resetSettings(self):
  490. # ----------------------------------------------------------------------------------------------------
  491. # Main
  492. if self.ui.lw_page.currentRow() == self.TAB_INDEX_MAIN:
  493. self.ui.le_main_proj_folder.setText(CARLA_DEFAULT_MAIN_PROJECT_FOLDER)
  494. self.ui.ch_main_theme_pro.setChecked(CARLA_DEFAULT_MAIN_USE_PRO_THEME and self.ui.group_main_theme.isEnabled())
  495. self.ui.cb_main_theme_color.setCurrentIndex(self.ui.cb_main_theme_color.findText(CARLA_DEFAULT_MAIN_PRO_THEME_COLOR))
  496. self.ui.sb_main_refresh_interval.setValue(CARLA_DEFAULT_MAIN_REFRESH_INTERVAL)
  497. self.ui.ch_main_use_custom_skins.setChecked(CARLA_DEFAULT_MAIN_USE_CUSTOM_SKINS)
  498. self.ui.ch_main_show_logs.setChecked(CARLA_DEFAULT_MAIN_SHOW_LOGS)
  499. # ----------------------------------------------------------------------------------------------------
  500. # Canvas
  501. elif self.ui.lw_page.currentRow() == self.TAB_INDEX_CANVAS:
  502. self.ui.cb_canvas_theme.setCurrentIndex(self.ui.cb_canvas_theme.findText(CARLA_DEFAULT_CANVAS_THEME))
  503. self.ui.cb_canvas_size.setCurrentIndex(self.ui.cb_canvas_size.findText(CARLA_DEFAULT_CANVAS_SIZE))
  504. self.ui.cb_canvas_bezier_lines.setChecked(CARLA_DEFAULT_CANVAS_USE_BEZIER_LINES)
  505. self.ui.cb_canvas_hide_groups.setChecked(CARLA_DEFAULT_CANVAS_AUTO_HIDE_GROUPS)
  506. self.ui.cb_canvas_auto_select.setChecked(CARLA_DEFAULT_CANVAS_AUTO_SELECT_ITEMS)
  507. self.ui.cb_canvas_eyecandy.setChecked(CARLA_DEFAULT_CANVAS_EYE_CANDY)
  508. self.ui.cb_canvas_render_aa.setCheckState(Qt.PartiallyChecked) # CARLA_DEFAULT_CANVAS_ANTIALIASING
  509. # ----------------------------------------------------------------------------------------------------
  510. # Engine
  511. elif self.ui.lw_page.currentRow() == self.TAB_INDEX_ENGINE:
  512. if not self.host.isPlugin:
  513. self.ui.cb_engine_audio_driver.setCurrentIndex(0)
  514. if not self.host.processModeForced:
  515. if self.ui.cb_engine_audio_driver.currentText() == "JACK":
  516. self.ui.cb_engine_process_mode_jack.setCurrentIndex(CARLA_DEFAULT_PROCESS_MODE)
  517. self.ui.sw_engine_process_mode.setCurrentIndex(0) # show all modes
  518. else:
  519. self.ui.cb_engine_process_mode_other.setCurrentIndex(CARLA_DEFAULT_PROCESS_MODE-self.PROCESS_MODE_NON_JACK_PADDING)
  520. self.ui.sw_engine_process_mode.setCurrentIndex(1) # hide single+multi client modes
  521. self.ui.sb_engine_max_params.setValue(CARLA_DEFAULT_MAX_PARAMETERS)
  522. self.ui.ch_engine_uis_always_on_top.setChecked(CARLA_DEFAULT_UIS_ALWAYS_ON_TOP)
  523. self.ui.ch_engine_prefer_ui_bridges.setChecked(CARLA_DEFAULT_PREFER_UI_BRIDGES)
  524. self.ui.sb_engine_ui_bridges_timeout.setValue(CARLA_DEFAULT_UI_BRIDGES_TIMEOUT)
  525. self.ui.ch_engine_manage_uis.setChecked(CARLA_DEFAULT_MANAGE_UIS)
  526. # ----------------------------------------------------------------------------------------------------
  527. # Paths
  528. elif self.ui.lw_page.currentRow() == self.TAB_INDEX_PATHS:
  529. curIndex = self.ui.tw_paths.currentIndex()
  530. if curIndex == self.PATH_INDEX_LADSPA:
  531. paths = CARLA_DEFAULT_LADSPA_PATH
  532. paths.sort()
  533. self.ui.lw_ladspa.clear()
  534. for path in paths:
  535. if not path: continue
  536. self.ui.lw_ladspa.addItem(path)
  537. elif curIndex == self.PATH_INDEX_DSSI:
  538. paths = CARLA_DEFAULT_DSSI_PATH
  539. paths.sort()
  540. self.ui.lw_dssi.clear()
  541. for path in paths:
  542. if not path: continue
  543. self.ui.lw_dssi.addItem(path)
  544. elif curIndex == self.PATH_INDEX_LV2:
  545. paths = CARLA_DEFAULT_LV2_PATH
  546. paths.sort()
  547. self.ui.lw_lv2.clear()
  548. for path in paths:
  549. if not path: continue
  550. self.ui.lw_lv2.addItem(path)
  551. elif curIndex == self.PATH_INDEX_VST2:
  552. paths = CARLA_DEFAULT_VST2_PATH
  553. paths.sort()
  554. self.ui.lw_vst.clear()
  555. for path in paths:
  556. if not path: continue
  557. self.ui.lw_vst.addItem(path)
  558. elif curIndex == self.PATH_INDEX_VST3:
  559. paths = CARLA_DEFAULT_VST3_PATH
  560. paths.sort()
  561. self.ui.lw_vst3.clear()
  562. for path in paths:
  563. if not path: continue
  564. self.ui.lw_vst3.addItem(path)
  565. elif curIndex == self.PATH_INDEX_GIG:
  566. paths = CARLA_DEFAULT_GIG_PATH
  567. paths.sort()
  568. self.ui.lw_gig.clear()
  569. for path in paths:
  570. if not path: continue
  571. self.ui.lw_gig.addItem(path)
  572. elif curIndex == self.PATH_INDEX_SF2:
  573. paths = CARLA_DEFAULT_SF2_PATH
  574. paths.sort()
  575. self.ui.lw_sf2.clear()
  576. for path in paths:
  577. if not path: continue
  578. self.ui.lw_sf2.addItem(path)
  579. elif curIndex == self.PATH_INDEX_SFZ:
  580. paths = CARLA_DEFAULT_SFZ_PATH
  581. paths.sort()
  582. self.ui.lw_sfz.clear()
  583. for path in paths:
  584. if not path: continue
  585. self.ui.lw_sfz.addItem(path)
  586. # ----------------------------------------------------------------------------------------------------
  587. # Experimental
  588. elif self.ui.lw_page.currentRow() == self.TAB_INDEX_EXPERIMENTAL:
  589. self.resetExperimentalSettings()
  590. def resetExperimentalSettings(self):
  591. # Forever experimental
  592. self.ui.cb_exp_plugin_bridges.setChecked(CARLA_DEFAULT_EXPERIMENTAL_PLUGIN_BRIDGES)
  593. self.ui.ch_exp_jack_apps.setChecked(CARLA_DEFAULT_EXPERIMENTAL_JACK_APPS)
  594. self.ui.ch_exp_load_lib_global.setChecked(CARLA_DEFAULT_EXPERIMENTAL_LOAD_LIB_GLOBAL)
  595. self.ui.ch_exp_prevent_bad_behaviour.setChecked(CARLA_DEFAULT_EXPERIMENTAL_PREVENT_BAD_BEHAVIOUR)
  596. # Temporary, until stable
  597. self.ui.cb_canvas_fancy_eyecandy.setChecked(CARLA_DEFAULT_CANVAS_FANCY_EYE_CANDY)
  598. self.ui.cb_canvas_use_opengl.setChecked(CARLA_DEFAULT_CANVAS_USE_OPENGL and self.ui.cb_canvas_use_opengl.isEnabled())
  599. self.ui.cb_canvas_render_hq_aa.setChecked(CARLA_DEFAULT_CANVAS_HQ_ANTIALIASING and self.ui.cb_canvas_render_hq_aa.isEnabled())
  600. self.ui.ch_engine_force_stereo.setChecked(CARLA_DEFAULT_FORCE_STEREO)
  601. self.ui.ch_engine_prefer_plugin_bridges.setChecked(CARLA_DEFAULT_PREFER_PLUGIN_BRIDGES)
  602. # --------------------------------------------------------------------------------------------------------
  603. @pyqtSlot(bool)
  604. def slot_enableExperimental(self, toggled):
  605. if toggled:
  606. self.ui.lw_page.showRow(self.TAB_INDEX_EXPERIMENTAL)
  607. else:
  608. self.ui.lw_page.hideRow(self.TAB_INDEX_EXPERIMENTAL)
  609. @pyqtSlot(bool)
  610. def slot_canvasEyeCandyToggled(self, toggled):
  611. if not toggled:
  612. self.ui.cb_canvas_fancy_eyecandy.setChecked(False)
  613. @pyqtSlot(bool)
  614. def slot_canvasFancyEyeCandyToggled(self, toggled):
  615. if toggled:
  616. self.ui.cb_canvas_eyecandy.setChecked(True)
  617. # --------------------------------------------------------------------------------------------------------
  618. @pyqtSlot()
  619. def slot_getAndSetProjectPath(self):
  620. # FIXME
  621. getAndSetPath(self, self.ui.le_main_proj_folder)
  622. # --------------------------------------------------------------------------------------------------------
  623. @pyqtSlot()
  624. def slot_engineAudioDriverChanged(self):
  625. if self.ui.cb_engine_audio_driver.currentText() == "JACK":
  626. self.ui.sw_engine_process_mode.setCurrentIndex(0)
  627. self.ui.tb_engine_driver_config.setEnabled(False)
  628. else:
  629. self.ui.sw_engine_process_mode.setCurrentIndex(1)
  630. self.ui.tb_engine_driver_config.setEnabled(True)
  631. @pyqtSlot()
  632. def slot_showAudioDriverSettings(self):
  633. driverIndex = self.ui.cb_engine_audio_driver.currentIndex()
  634. driverName = self.ui.cb_engine_audio_driver.currentText()
  635. DriverSettingsW(self, self.host, driverIndex, driverName).exec_()
  636. # --------------------------------------------------------------------------------------------------------
  637. @pyqtSlot()
  638. def slot_addPluginPath(self):
  639. newPath = QFileDialog.getExistingDirectory(self, self.tr("Add Path"), "", QFileDialog.ShowDirsOnly)
  640. if not newPath:
  641. return
  642. curIndex = self.ui.tw_paths.currentIndex()
  643. if curIndex == self.PATH_INDEX_LADSPA:
  644. self.ui.lw_ladspa.addItem(newPath)
  645. elif curIndex == self.PATH_INDEX_DSSI:
  646. self.ui.lw_dssi.addItem(newPath)
  647. elif curIndex == self.PATH_INDEX_LV2:
  648. self.ui.lw_lv2.addItem(newPath)
  649. elif curIndex == self.PATH_INDEX_VST2:
  650. self.ui.lw_vst.addItem(newPath)
  651. elif curIndex == self.PATH_INDEX_VST3:
  652. self.ui.lw_vst3.addItem(newPath)
  653. elif curIndex == self.PATH_INDEX_GIG:
  654. self.ui.lw_gig.addItem(newPath)
  655. elif curIndex == self.PATH_INDEX_SF2:
  656. self.ui.lw_sf2.addItem(newPath)
  657. elif curIndex == self.PATH_INDEX_SFZ:
  658. self.ui.lw_sfz.addItem(newPath)
  659. @pyqtSlot()
  660. def slot_removePluginPath(self):
  661. curIndex = self.ui.tw_paths.currentIndex()
  662. if curIndex == self.PATH_INDEX_LADSPA:
  663. self.ui.lw_ladspa.takeItem(self.ui.lw_ladspa.currentRow())
  664. elif curIndex == self.PATH_INDEX_DSSI:
  665. self.ui.lw_dssi.takeItem(self.ui.lw_dssi.currentRow())
  666. elif curIndex == self.PATH_INDEX_LV2:
  667. self.ui.lw_lv2.takeItem(self.ui.lw_lv2.currentRow())
  668. elif curIndex == self.PATH_INDEX_VST2:
  669. self.ui.lw_vst.takeItem(self.ui.lw_vst.currentRow())
  670. elif curIndex == self.PATH_INDEX_VST3:
  671. self.ui.lw_vst3.takeItem(self.ui.lw_vst3.currentRow())
  672. elif curIndex == self.PATH_INDEX_GIG:
  673. self.ui.lw_gig.takeItem(self.ui.lw_gig.currentRow())
  674. elif curIndex == self.PATH_INDEX_SF2:
  675. self.ui.lw_sf2.takeItem(self.ui.lw_sf2.currentRow())
  676. elif curIndex == self.PATH_INDEX_SFZ:
  677. self.ui.lw_sfz.takeItem(self.ui.lw_sfz.currentRow())
  678. @pyqtSlot()
  679. def slot_changePluginPath(self):
  680. curIndex = self.ui.tw_paths.currentIndex()
  681. if curIndex == self.PATH_INDEX_LADSPA:
  682. currentPath = self.ui.lw_ladspa.currentItem().text()
  683. elif curIndex == self.PATH_INDEX_DSSI:
  684. currentPath = self.ui.lw_dssi.currentItem().text()
  685. elif curIndex == self.PATH_INDEX_LV2:
  686. currentPath = self.ui.lw_lv2.currentItem().text()
  687. elif curIndex == self.PATH_INDEX_VST2:
  688. currentPath = self.ui.lw_vst.currentItem().text()
  689. elif curIndex == self.PATH_INDEX_VST3:
  690. currentPath = self.ui.lw_vst3.currentItem().text()
  691. elif curIndex == self.PATH_INDEX_GIG:
  692. currentPath = self.ui.lw_gig.currentItem().text()
  693. elif curIndex == self.PATH_INDEX_SF2:
  694. currentPath = self.ui.lw_sf2.currentItem().text()
  695. elif curIndex == self.PATH_INDEX_SFZ:
  696. currentPath = self.ui.lw_sfz.currentItem().text()
  697. else:
  698. currentPath = ""
  699. newPath = QFileDialog.getExistingDirectory(self, self.tr("Add Path"), currentPath, QFileDialog.ShowDirsOnly)
  700. if not newPath:
  701. return
  702. if curIndex == self.PATH_INDEX_LADSPA:
  703. self.ui.lw_ladspa.currentItem().setText(newPath)
  704. elif curIndex == self.PATH_INDEX_DSSI:
  705. self.ui.lw_dssi.currentItem().setText(newPath)
  706. elif curIndex == self.PATH_INDEX_LV2:
  707. self.ui.lw_lv2.currentItem().setText(newPath)
  708. elif curIndex == self.PATH_INDEX_VST2:
  709. self.ui.lw_vst.currentItem().setText(newPath)
  710. elif curIndex == self.PATH_INDEX_VST3:
  711. self.ui.lw_vst3.currentItem().setText(newPath)
  712. elif curIndex == self.PATH_INDEX_GIG:
  713. self.ui.lw_gig.currentItem().setText(newPath)
  714. elif curIndex == self.PATH_INDEX_SF2:
  715. self.ui.lw_sf2.currentItem().setText(newPath)
  716. elif curIndex == self.PATH_INDEX_SFZ:
  717. self.ui.lw_sfz.currentItem().setText(newPath)
  718. # --------------------------------------------------------------------------------------------------------
  719. @pyqtSlot(int)
  720. def slot_pluginPathTabChanged(self, index):
  721. if index == self.PATH_INDEX_LADSPA:
  722. row = self.ui.lw_ladspa.currentRow()
  723. elif index == self.PATH_INDEX_DSSI:
  724. row = self.ui.lw_dssi.currentRow()
  725. elif index == self.PATH_INDEX_LV2:
  726. row = self.ui.lw_lv2.currentRow()
  727. elif index == self.PATH_INDEX_VST2:
  728. row = self.ui.lw_vst.currentRow()
  729. elif index == self.PATH_INDEX_VST3:
  730. row = self.ui.lw_vst3.currentRow()
  731. elif index == self.PATH_INDEX_GIG:
  732. row = self.ui.lw_gig.currentRow()
  733. elif index == self.PATH_INDEX_SF2:
  734. row = self.ui.lw_sf2.currentRow()
  735. elif index == self.PATH_INDEX_SFZ:
  736. row = self.ui.lw_sfz.currentRow()
  737. else:
  738. row = -1
  739. check = bool(row >= 0)
  740. self.ui.b_paths_remove.setEnabled(check)
  741. self.ui.b_paths_change.setEnabled(check)
  742. @pyqtSlot(int)
  743. def slot_pluginPathRowChanged(self, row):
  744. check = bool(row >= 0)
  745. self.ui.b_paths_remove.setEnabled(check)
  746. self.ui.b_paths_change.setEnabled(check)
  747. # --------------------------------------------------------------------------------------------------------
  748. def done(self, r):
  749. QDialog.done(self, r)
  750. self.close()
  751. # ------------------------------------------------------------------------------------------------------------
  752. # Main
  753. if __name__ == '__main__':
  754. from carla_app import CarlaApplication
  755. from carla_host import initHost, loadHostSettings
  756. initName, libPrefix = handleInitialCommandLineArguments(__file__ if "__file__" in dir() else None)
  757. app = CarlaApplication("Carla2-Settings", libPrefix)
  758. host = initHost("Carla2-Settings", libPrefix, False, False, False)
  759. loadHostSettings(host)
  760. gui = CarlaSettingsW(None, host, True, True)
  761. gui.show()
  762. app.exit_exec()
  763. # ------------------------------------------------------------------------------------------------------------