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.

680 lines
29KB

  1. #!/usr/bin/env python3
  2. # -*- coding: utf-8 -*-
  3. # Carla settings code
  4. # Copyright (C) 2011-2013 Filipe Coelho <falktx@falktx.com>
  5. #
  6. # This program is free software; you can redistribute it and/or
  7. # modify it under the terms of the GNU General Public License as
  8. # published by the Free Software Foundation; either version 2 of
  9. # the License, or any later version.
  10. #
  11. # This program is distributed in the hope that it will be useful,
  12. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. # GNU General Public License for more details.
  15. #
  16. # For a full copy of the GNU General Public License see the doc/GPL.txt file.
  17. # ------------------------------------------------------------------------------------------------------------
  18. # Imports (Global)
  19. try:
  20. from PyQt5.QtCore import pyqtSlot, QByteArray, QSettings
  21. from PyQt5.QtGui import QColor, QCursor, QFontMetrics, QPainter, QPainterPath
  22. from PyQt5.QtWidgets import QDialog, QFrame, QInputDialog, QLineEdit, QMenu, QVBoxLayout, QWidget
  23. except:
  24. from PyQt4.QtCore import pyqtSlot, QByteArray, QSettings
  25. from PyQt4.QtGui import QColor, QCursor, QFontMetrics, QPainter, QPainterPath
  26. from PyQt4.QtGui import QDialog, QFrame, QInputDialog, QLineEdit, QMenu, QVBoxLayout, QWidget
  27. # ------------------------------------------------------------------------------------------------------------
  28. # Imports (Custom)
  29. import ui_carla_settings
  30. import ui_carla_settings_driver
  31. from carla_shared import *
  32. from patchcanvas_theme import *
  33. # ------------------------------------------------------------------------------------------------------------
  34. # Carla defaults
  35. # Canvas size
  36. CARLA_DEFAULT_CANVAS_WIDTH = 3100
  37. CARLA_DEFAULT_CANVAS_HEIGHT = 2400
  38. # Engine settings
  39. CARLA_DEFAULT_RUN_DISCOVERY_CHECKS = True
  40. CARLA_DEFAULT_FORCE_STEREO = False
  41. CARLA_DEFAULT_PREFER_PLUGIN_BRIDGES = False
  42. CARLA_DEFAULT_PREFER_UI_BRIDGES = True
  43. CARLA_DEFAULT_UIS_ALWAYS_ON_TOP = True
  44. CARLA_DEFAULT_MAX_PARAMETERS = MAX_DEFAULT_PARAMETERS
  45. CARLA_DEFAULT_UI_BRIDGES_TIMEOUT = 4000
  46. CARLA_DEFAULT_AUDIO_NUM_PERIODS = 2
  47. CARLA_DEFAULT_AUDIO_BUFFER_SIZE = 512
  48. CARLA_DEFAULT_AUDIO_SAMPLE_RATE = 44100
  49. if WINDOWS:
  50. CARLA_DEFAULT_AUDIO_DRIVER = "DirectSound"
  51. elif MACOS:
  52. CARLA_DEFAULT_AUDIO_DRIVER = "CoreAudio"
  53. else:
  54. CARLA_DEFAULT_AUDIO_DRIVER = "JACK"
  55. if LINUX:
  56. CARLA_DEFAULT_PROCESS_MODE = PROCESS_MODE_MULTIPLE_CLIENTS
  57. CARLA_DEFAULT_TRANSPORT_MODE = TRANSPORT_MODE_JACK
  58. CARLA_DEFAULT_DISABLE_CHECKS = False
  59. else:
  60. CARLA_DEFAULT_PROCESS_MODE = PROCESS_MODE_CONTINUOUS_RACK
  61. CARLA_DEFAULT_TRANSPORT_MODE = TRANSPORT_MODE_INTERNAL
  62. CARLA_DEFAULT_DISABLE_CHECKS = False
  63. # ------------------------------------------------------------------------------------------------------------
  64. # PatchCanvas defines
  65. CANVAS_ANTIALIASING_SMALL = 1
  66. CANVAS_EYECANDY_SMALL = 1
  67. CANVAS_DEFAULT_THEME_NAME = "Modern Dark"
  68. # ------------------------------------------------------------------------------------------------------------
  69. # ...
  70. BUFFER_SIZE_LIST = (16, 32, 64, 128, 256, 512, 1024, 2048, 4096, 8192)
  71. SAMPLE_RATE_LIST = (22050, 32000, 44100, 48000, 88200, 96000, 176400, 192000)
  72. # ------------------------------------------------------------------------------------------------------------
  73. # Driver Settings
  74. class DriverSettingsW(QDialog):
  75. def __init__(self, parent, driverIndex, driverName):
  76. QDialog.__init__(self, parent)
  77. self.ui = ui_carla_settings_driver.Ui_DriverSettingsW()
  78. self.ui.setupUi(self)
  79. if driverName == "JACK":
  80. print("This dialog is not compatible with JACK")
  81. return
  82. # -------------------------------------------------------------
  83. # Internal stuff
  84. self.fDriverIndex = driverIndex
  85. self.fDriverName = driverName
  86. self.fDeviceNames = Carla.host.get_engine_driver_device_names(driverIndex) if Carla.host is not None else []
  87. # -------------------------------------------------------------
  88. # Set-up GUI
  89. for name in self.fDeviceNames:
  90. self.ui.cb_device.addItem(name)
  91. for bsize in BUFFER_SIZE_LIST:
  92. self.ui.cb_buffersize.addItem(str(bsize))
  93. for srate in SAMPLE_RATE_LIST:
  94. self.ui.cb_samplerate.addItem(str(srate))
  95. # -------------------------------------------------------------
  96. # Load settings
  97. self.loadSettings()
  98. # -------------------------------------------------------------
  99. # Set-up connections
  100. self.accepted.connect(self.slot_saveSettings)
  101. # -------------------------------------------------------------
  102. def loadSettings(self):
  103. settings = QSettings()
  104. audioDevice = settings.value("Engine/Driver-%s/Device" % self.fDriverName, "", type=str)
  105. audioNumPeriods = settings.value("Engine/Driver-%s/NumPeriods" % self.fDriverName, CARLA_DEFAULT_AUDIO_NUM_PERIODS, type=int)
  106. audioBufferSize = settings.value("Engine/Driver-%s/BufferSize" % self.fDriverName, CARLA_DEFAULT_AUDIO_BUFFER_SIZE, type=int)
  107. audioSampleRate = settings.value("Engine/Driver-%s/SampleRate" % self.fDriverName, CARLA_DEFAULT_AUDIO_SAMPLE_RATE, type=int)
  108. if audioDevice and audioDevice in self.fDeviceNames:
  109. self.ui.cb_device.setCurrentIndex(self.fDeviceNames.index(audioDevice))
  110. else:
  111. self.ui.cb_device.setCurrentIndex(-1)
  112. if 2 < audioNumPeriods < 3:
  113. self.ui.sb_numperiods.setValue(audioNumPeriods)
  114. else:
  115. self.ui.sb_numperiods.setValue(CARLA_DEFAULT_AUDIO_NUM_PERIODS)
  116. if audioBufferSize and audioBufferSize in BUFFER_SIZE_LIST:
  117. self.ui.cb_buffersize.setCurrentIndex(BUFFER_SIZE_LIST.index(audioBufferSize))
  118. else:
  119. self.ui.cb_buffersize.setCurrentIndex(BUFFER_SIZE_LIST.index(CARLA_DEFAULT_AUDIO_BUFFER_SIZE))
  120. if audioSampleRate and audioSampleRate in SAMPLE_RATE_LIST:
  121. self.ui.cb_samplerate.setCurrentIndex(SAMPLE_RATE_LIST.index(audioSampleRate))
  122. else:
  123. self.ui.cb_samplerate.setCurrentIndex(SAMPLE_RATE_LIST.index(CARLA_DEFAULT_AUDIO_SAMPLE_RATE))
  124. @pyqtSlot()
  125. def slot_saveSettings(self):
  126. settings = QSettings()
  127. settings.setValue("Engine/Driver-%s/Device" % self.fDriverName, self.ui.cb_device.currentText())
  128. settings.setValue("Engine/Driver-%s/NumPeriods" % self.fDriverName, self.ui.sb_numperiods.value())
  129. settings.setValue("Engine/Driver-%s/BufferSize" % self.fDriverName, self.ui.cb_buffersize.currentText())
  130. settings.setValue("Engine/Driver-%s/SampleRate" % self.fDriverName, self.ui.cb_samplerate.currentText())
  131. def done(self, r):
  132. QDialog.done(self, r)
  133. self.close()
  134. # ------------------------------------------------------------------------------------------------------------
  135. # Settings Dialog
  136. class CarlaSettingsW(QDialog):
  137. # Tab indexes
  138. TAB_INDEX_MAIN = 0
  139. TAB_INDEX_CANVAS = 1
  140. TAB_INDEX_CARLA_ENGINE = 2
  141. TAB_INDEX_CARLA_PATHS = 3
  142. TAB_INDEX_NONE = 4
  143. # Single and Multiple client mode is only for JACK,
  144. # but we still want to match QComboBox index to defines,
  145. # so add +2 pos padding if driverName != "JACK".
  146. PROCESS_MODE_NON_JACK_PADDING = 2
  147. def __init__(self, parent, hasCanvas, hasCanvasGL):
  148. QDialog.__init__(self, parent)
  149. self.ui = ui_carla_settings.Ui_CarlaSettingsW()
  150. self.ui.setupUi(self)
  151. # -------------------------------------------------------------
  152. # Set-up GUI
  153. driverCount = Carla.host.get_engine_driver_count() if Carla.host is not None else 0
  154. for i in range(driverCount):
  155. driverName = cString(Carla.host.get_engine_driver_name(i))
  156. self.ui.cb_engine_audio_driver.addItem(driverName)
  157. # -------------------------------------------------------------
  158. # Load settings
  159. self.loadSettings()
  160. if not hasCanvas:
  161. # TODO - hide canvas section
  162. if not hasCanvasGL:
  163. self.ui.cb_canvas_use_opengl.setChecked(False)
  164. self.ui.cb_canvas_use_opengl.setEnabled(False)
  165. if WINDOWS:
  166. self.ui.group_theme.setEnabled(False)
  167. self.ui.ch_theme_pro.setChecked(False)
  168. if Carla.isPlugin:
  169. self.ui.lw_page.hideRow(self.TAB_INDEX_CARLA_ENGINE)
  170. self.ui.lw_page.hideRow(self.TAB_INDEX_CARLA_PATHS)
  171. #from PyQt4.QtGui import QTableWidget
  172. #x = QTableWidget(self)
  173. #x.()
  174. # -------------------------------------------------------------
  175. # Set-up connections
  176. #self.connect(self, SIGNAL("accepted()"), SLOT("slot_saveSettings()"))
  177. #self.connect(self.ui.buttonBox.button(QDialogButtonBox.Reset), SIGNAL("clicked()"), SLOT("slot_resetSettings()"))
  178. #self.connect(self.ui.b_main_def_folder_open, SIGNAL("clicked()"), SLOT("slot_getAndSetProjectPath()"))
  179. #self.connect(self.ui.cb_engine_audio_driver, SIGNAL("currentIndexChanged(int)"), SLOT("slot_engineAudioDriverChanged()"))
  180. #self.connect(self.ui.tb_engine_driver_config, SIGNAL("clicked()"), SLOT("slot_showAudioDriverSettings()"))
  181. #self.connect(self.ui.b_paths_add, SIGNAL("clicked()"), SLOT("slot_addPluginPath()"))
  182. #self.connect(self.ui.b_paths_remove, SIGNAL("clicked()"), SLOT("slot_removePluginPath()"))
  183. #self.connect(self.ui.b_paths_change, SIGNAL("clicked()"), SLOT("slot_changePluginPath()"))
  184. #self.connect(self.ui.tw_paths, SIGNAL("currentChanged(int)"), SLOT("slot_pluginPathTabChanged(int)"))
  185. #self.connect(self.ui.lw_ladspa, SIGNAL("currentRowChanged(int)"), SLOT("slot_pluginPathRowChanged(int)"))
  186. #self.connect(self.ui.lw_dssi, SIGNAL("currentRowChanged(int)"), SLOT("slot_pluginPathRowChanged(int)"))
  187. #self.connect(self.ui.lw_lv2, SIGNAL("currentRowChanged(int)"), SLOT("slot_pluginPathRowChanged(int)"))
  188. #self.connect(self.ui.lw_vst, SIGNAL("currentRowChanged(int)"), SLOT("slot_pluginPathRowChanged(int)"))
  189. #self.connect(self.ui.lw_sf2, SIGNAL("currentRowChanged(int)"), SLOT("slot_pluginPathRowChanged(int)"))
  190. # -------------------------------------------------------------
  191. # Post-connect setup
  192. # TODO - add AU and csound, hide AU on non-mac
  193. self.ui.lw_ladspa.setCurrentRow(0)
  194. self.ui.lw_dssi.setCurrentRow(0)
  195. self.ui.lw_lv2.setCurrentRow(0)
  196. self.ui.lw_vst.setCurrentRow(0)
  197. self.ui.lw_gig.setCurrentRow(0)
  198. self.ui.lw_sf2.setCurrentRow(0)
  199. self.ui.lw_sfz.setCurrentRow(0)
  200. self.ui.lw_page.setCurrentCell(0, 0)
  201. def loadSettings(self):
  202. settings = QSettings()
  203. # ---------------------------------------
  204. self.ui.le_main_def_folder.setText(settings.value("Main/DefaultProjectFolder", HOME, type=str))
  205. self.ui.ch_theme_pro.setChecked(settings.value("Main/UseProTheme", True, type=bool))
  206. self.ui.sb_gui_refresh.setValue(settings.value("Main/RefreshInterval", 50, type=int))
  207. themeColor = settings.value("Main/ProThemeColor", "Black", type=str)
  208. if themeColor == "System":
  209. self.ui.cb_theme_color.setCurrentIndex(1)
  210. else:
  211. self.ui.cb_theme_color.setCurrentIndex(0)
  212. # ---------------------------------------
  213. self.ui.cb_canvas_hide_groups.setChecked(settings.value("Canvas/AutoHideGroups", False, type=bool))
  214. self.ui.cb_canvas_bezier_lines.setChecked(settings.value("Canvas/UseBezierLines", True, type=bool))
  215. self.ui.cb_canvas_eyecandy.setCheckState(settings.value("Canvas/EyeCandy", CANVAS_EYECANDY_SMALL, type=int))
  216. self.ui.cb_canvas_use_opengl.setChecked(settings.value("Canvas/UseOpenGL", False, type=bool))
  217. self.ui.cb_canvas_render_aa.setCheckState(settings.value("Canvas/Antialiasing", CANVAS_ANTIALIASING_SMALL, type=int))
  218. self.ui.cb_canvas_render_hq_aa.setChecked(settings.value("Canvas/HighQualityAntialiasing", False, type=bool))
  219. canvasThemeName = settings.value("Canvas/Theme", getDefaultThemeName(), type=str)
  220. for i in range(Theme.THEME_MAX):
  221. thisThemeName = getThemeName(i)
  222. self.ui.cb_canvas_theme.addItem(thisThemeName)
  223. if thisThemeName == canvasThemeName:
  224. self.ui.cb_canvas_theme.setCurrentIndex(i)
  225. # --------------------------------------------
  226. audioDriver = settings.value("Engine/AudioDriver", CARLA_DEFAULT_AUDIO_DRIVER, type=str)
  227. for i in range(self.ui.cb_engine_audio_driver.count()):
  228. if self.ui.cb_engine_audio_driver.itemText(i) == audioDriver:
  229. self.ui.cb_engine_audio_driver.setCurrentIndex(i)
  230. break
  231. else:
  232. self.ui.cb_engine_audio_driver.setCurrentIndex(-1)
  233. if audioDriver == "JACK":
  234. processModeIndex = settings.value("Engine/ProcessMode", PROCESS_MODE_MULTIPLE_CLIENTS, type=int)
  235. self.ui.cb_engine_process_mode_jack.setCurrentIndex(processModeIndex)
  236. self.ui.sw_engine_process_mode.setCurrentIndex(0)
  237. else:
  238. processModeIndex = settings.value("Engine/ProcessMode", PROCESS_MODE_CONTINUOUS_RACK, type=int)
  239. processModeIndex -= self.PROCESS_MODE_NON_JACK_PADDING
  240. self.ui.cb_engine_process_mode_other.setCurrentIndex(processModeIndex)
  241. self.ui.sw_engine_process_mode.setCurrentIndex(1)
  242. self.ui.sb_engine_max_params.setValue(settings.value("Engine/MaxParameters", CARLA_DEFAULT_MAX_PARAMETERS, type=int))
  243. self.ui.ch_engine_uis_always_on_top.setChecked(settings.value("Engine/UIsAlwaysOnTop", CARLA_DEFAULT_UIS_ALWAYS_ON_TOP, type=bool))
  244. self.ui.ch_engine_prefer_ui_bridges.setChecked(settings.value("Engine/PreferUiBridges", CARLA_DEFAULT_PREFER_UI_BRIDGES, type=bool))
  245. #self.ui.sb_engine_oscgui_timeout.setValue(settings.value("Engine/OscUiTimeout", CARLA_DEFAULT_OSC_UI_TIMEOUT, type=int))
  246. self.ui.ch_engine_disable_checks.setChecked(settings.value("Engine/DisableChecks", CARLA_DEFAULT_DISABLE_CHECKS, type=bool))
  247. self.ui.ch_engine_prefer_plugin_bridges.setChecked(settings.value("Engine/PreferPluginBridges", CARLA_DEFAULT_PREFER_PLUGIN_BRIDGES, type=bool))
  248. self.ui.ch_engine_force_stereo.setChecked(settings.value("Engine/ForceStereo", CARLA_DEFAULT_FORCE_STEREO, type=bool))
  249. # --------------------------------------------
  250. ladspas = toList(settings.value("Paths/LADSPA", Carla.DEFAULT_LADSPA_PATH))
  251. dssis = toList(settings.value("Paths/DSSI", Carla.DEFAULT_DSSI_PATH))
  252. lv2s = toList(settings.value("Paths/LV2", Carla.DEFAULT_LV2_PATH))
  253. vsts = toList(settings.value("Paths/VST", Carla.DEFAULT_VST_PATH))
  254. gigs = toList(settings.value("Paths/GIG", Carla.DEFAULT_GIG_PATH))
  255. sf2s = toList(settings.value("Paths/SF2", Carla.DEFAULT_SF2_PATH))
  256. sfzs = toList(settings.value("Paths/SFZ", Carla.DEFAULT_SFZ_PATH))
  257. ladspas.sort()
  258. dssis.sort()
  259. lv2s.sort()
  260. vsts.sort()
  261. gigs.sort()
  262. sf2s.sort()
  263. sfzs.sort()
  264. for ladspa in ladspas:
  265. self.ui.lw_ladspa.addItem(ladspa)
  266. for dssi in dssis:
  267. self.ui.lw_dssi.addItem(dssi)
  268. for lv2 in lv2s:
  269. self.ui.lw_lv2.addItem(lv2)
  270. for vst in vsts:
  271. self.ui.lw_vst.addItem(vst)
  272. for gig in gigs:
  273. self.ui.lw_gig.addItem(gig)
  274. for sf2 in sf2s:
  275. self.ui.lw_sf2.addItem(sf2)
  276. for sfz in sfzs:
  277. self.ui.lw_sfz.addItem(sfz)
  278. @pyqtSlot()
  279. def slot_saveSettings(self):
  280. settings = QSettings()
  281. # ---------------------------------------
  282. settings.setValue("Main/DefaultProjectFolder", self.ui.le_main_def_folder.text())
  283. settings.setValue("Main/UseProTheme", self.ui.ch_theme_pro.isChecked())
  284. settings.setValue("Main/ProThemeColor", self.ui.cb_theme_color.currentText())
  285. settings.setValue("Main/RefreshInterval", self.ui.sb_gui_refresh.value())
  286. # ---------------------------------------
  287. settings.setValue("Canvas/Theme", self.ui.cb_canvas_theme.currentText())
  288. settings.setValue("Canvas/AutoHideGroups", self.ui.cb_canvas_hide_groups.isChecked())
  289. settings.setValue("Canvas/UseBezierLines", self.ui.cb_canvas_bezier_lines.isChecked())
  290. settings.setValue("Canvas/UseOpenGL", self.ui.cb_canvas_use_opengl.isChecked())
  291. settings.setValue("Canvas/HighQualityAntialiasing", self.ui.cb_canvas_render_hq_aa.isChecked())
  292. # 0, 1, 2 match their enum variants
  293. settings.setValue("Canvas/EyeCandy", self.ui.cb_canvas_eyecandy.checkState())
  294. settings.setValue("Canvas/Antialiasing", self.ui.cb_canvas_render_aa.checkState())
  295. # --------------------------------------------
  296. audioDriver = self.ui.cb_engine_audio_driver.currentText()
  297. if audioDriver:
  298. settings.setValue("Engine/AudioDriver", audioDriver)
  299. if audioDriver == "JACK":
  300. settings.setValue("Engine/ProcessMode", self.ui.cb_engine_process_mode_jack.currentIndex())
  301. else:
  302. settings.setValue("Engine/ProcessMode", self.ui.cb_engine_process_mode_other.currentIndex()+self.PROCESS_MODE_NON_JACK_PADDING)
  303. settings.setValue("Engine/MaxParameters", self.ui.sb_engine_max_params.value())
  304. settings.setValue("Engine/UIsAlwaysOnTop", self.ui.ch_engine_uis_always_on_top.isChecked())
  305. settings.setValue("Engine/PreferUiBridges", self.ui.ch_engine_prefer_ui_bridges.isChecked())
  306. #settings.setValue("Engine/OscUiTimeout", self.ui.sb_engine_oscgui_timeout.value())
  307. settings.setValue("Engine/DisableChecks", self.ui.ch_engine_disable_checks.isChecked())
  308. settings.setValue("Engine/UseDssiVstChunks", self.ui.ch_engine_dssi_chunks.isChecked())
  309. settings.setValue("Engine/PreferPluginBridges", self.ui.ch_engine_prefer_plugin_bridges.isChecked())
  310. settings.setValue("Engine/ForceStereo", self.ui.ch_engine_force_stereo.isChecked())
  311. # --------------------------------------------
  312. ladspas = []
  313. dssis = []
  314. lv2s = []
  315. vsts = []
  316. gigs = []
  317. sf2s = []
  318. sfzs = []
  319. for i in range(self.ui.lw_ladspa.count()):
  320. ladspas.append(self.ui.lw_ladspa.item(i).text())
  321. for i in range(self.ui.lw_dssi.count()):
  322. dssis.append(self.ui.lw_dssi.item(i).text())
  323. for i in range(self.ui.lw_lv2.count()):
  324. lv2s.append(self.ui.lw_lv2.item(i).text())
  325. for i in range(self.ui.lw_vst.count()):
  326. vsts.append(self.ui.lw_vst.item(i).text())
  327. for i in range(self.ui.lw_gig.count()):
  328. gigs.append(self.ui.lw_gig.item(i).text())
  329. for i in range(self.ui.lw_sf2.count()):
  330. sf2s.append(self.ui.lw_sf2.item(i).text())
  331. for i in range(self.ui.lw_sfz.count()):
  332. sfzs.append(self.ui.lw_sfz.item(i).text())
  333. settings.setValue("Paths/LADSPA", ladspas)
  334. settings.setValue("Paths/DSSI", dssis)
  335. settings.setValue("Paths/LV2", lv2s)
  336. settings.setValue("Paths/VST", vsts)
  337. settings.setValue("Paths/GIG", gigs)
  338. settings.setValue("Paths/SF2", sf2s)
  339. settings.setValue("Paths/SFZ", sfzs)
  340. @pyqtSlot()
  341. def slot_resetSettings(self):
  342. if self.ui.lw_page.currentRow() == self.TAB_INDEX_MAIN:
  343. self.ui.le_main_def_folder.setText(HOME)
  344. self.ui.ch_theme_pro.setChecked(True)
  345. self.ui.cb_theme_color.setCurrentIndex(0)
  346. self.ui.sb_gui_refresh.setValue(50)
  347. elif self.ui.lw_page.currentRow() == self.TAB_INDEX_CANVAS:
  348. self.ui.cb_canvas_theme.setCurrentIndex(0)
  349. self.ui.cb_canvas_hide_groups.setChecked(False)
  350. self.ui.cb_canvas_bezier_lines.setChecked(True)
  351. self.ui.cb_canvas_eyecandy.setCheckState(Qt.PartiallyChecked)
  352. self.ui.cb_canvas_use_opengl.setChecked(False)
  353. self.ui.cb_canvas_render_aa.setCheckState(Qt.PartiallyChecked)
  354. self.ui.cb_canvas_render_hq_aa.setChecked(False)
  355. elif self.ui.lw_page.currentRow() == self.TAB_INDEX_CARLA_ENGINE:
  356. self.ui.cb_engine_audio_driver.setCurrentIndex(0)
  357. self.ui.sb_engine_max_params.setValue(CARLA_DEFAULT_MAX_PARAMETERS)
  358. self.ui.ch_engine_uis_always_on_top.setChecked(CARLA_DEFAULT_UIS_ALWAYS_ON_TOP)
  359. self.ui.ch_engine_prefer_ui_bridges.setChecked(CARLA_DEFAULT_PREFER_UI_BRIDGES)
  360. #self.ui.sb_engine_oscgui_timeout.setValue(CARLA_DEFAULT_OSC_UI_TIMEOUT)
  361. #self.ui.ch_engine_disable_checks.setChecked(CARLA_DEFAULT_DISABLE_CHECKS)
  362. self.ui.ch_engine_prefer_plugin_bridges.setChecked(CARLA_DEFAULT_PREFER_PLUGIN_BRIDGES)
  363. self.ui.ch_engine_force_stereo.setChecked(CARLA_DEFAULT_FORCE_STEREO)
  364. if self.ui.cb_engine_audio_driver.currentText() == "JACK":
  365. self.ui.cb_engine_process_mode_jack.setCurrentIndex(PROCESS_MODE_MULTIPLE_CLIENTS)
  366. self.ui.sw_engine_process_mode.setCurrentIndex(0)
  367. else:
  368. self.ui.cb_engine_process_mode_other.setCurrentIndex(PROCESS_MODE_CONTINUOUS_RACK-self.PROCESS_MODE_NON_JACK_PADDING)
  369. self.ui.sw_engine_process_mode.setCurrentIndex(1)
  370. elif self.ui.lw_page.currentRow() == self.TAB_INDEX_CARLA_PATHS:
  371. if self.ui.tw_paths.currentIndex() == 0:
  372. paths = DEFAULT_LADSPA_PATH.split(splitter)
  373. paths.sort()
  374. self.ui.lw_ladspa.clear()
  375. for ladspa in paths:
  376. self.ui.lw_ladspa.addItem(ladspa)
  377. elif self.ui.tw_paths.currentIndex() == 1:
  378. paths = DEFAULT_DSSI_PATH.split(splitter)
  379. paths.sort()
  380. self.ui.lw_dssi.clear()
  381. for dssi in paths:
  382. self.ui.lw_dssi.addItem(dssi)
  383. elif self.ui.tw_paths.currentIndex() == 2:
  384. paths = DEFAULT_LV2_PATH.split(splitter)
  385. paths.sort()
  386. self.ui.lw_lv2.clear()
  387. for lv2 in paths:
  388. self.ui.lw_lv2.addItem(lv2)
  389. elif self.ui.tw_paths.currentIndex() == 3:
  390. paths = DEFAULT_VST_PATH.split(splitter)
  391. paths.sort()
  392. self.ui.lw_vst.clear()
  393. for vst in paths:
  394. self.ui.lw_vst.addItem(vst)
  395. elif self.ui.tw_paths.currentIndex() == 4:
  396. paths = DEFAULT_GIG_PATH.split(splitter)
  397. paths.sort()
  398. self.ui.lw_gig.clear()
  399. for gig in paths:
  400. self.ui.lw_gig.addItem(gig)
  401. elif self.ui.tw_paths.currentIndex() == 5:
  402. paths = DEFAULT_SF2_PATH.split(splitter)
  403. paths.sort()
  404. self.ui.lw_sf2.clear()
  405. for sf2 in paths:
  406. self.ui.lw_sf2.addItem(sf2)
  407. elif self.ui.tw_paths.currentIndex() == 6:
  408. paths = DEFAULT_SFZ_PATH.split(splitter)
  409. paths.sort()
  410. self.ui.lw_sfz.clear()
  411. for sfz in paths:
  412. self.ui.lw_sfz.addItem(sfz)
  413. @pyqtSlot()
  414. def slot_getAndSetProjectPath(self):
  415. getAndSetPath(self, self.ui.le_main_def_folder.text(), self.ui.le_main_def_folder)
  416. @pyqtSlot()
  417. def slot_engineAudioDriverChanged(self):
  418. if self.ui.cb_engine_audio_driver.currentText() == "JACK":
  419. self.ui.sw_engine_process_mode.setCurrentIndex(0)
  420. else:
  421. self.ui.sw_engine_process_mode.setCurrentIndex(1)
  422. @pyqtSlot()
  423. def slot_showAudioDriverSettings(self):
  424. driverIndex = self.ui.cb_engine_audio_driver.currentIndex()
  425. driverName = self.ui.cb_engine_audio_driver.currentText()
  426. DriverSettingsW(self, driverIndex, driverName).exec_()
  427. @pyqtSlot()
  428. def slot_addPluginPath(self):
  429. newPath = QFileDialog.getExistingDirectory(self, self.tr("Add Path"), "", QFileDialog.ShowDirsOnly)
  430. if newPath:
  431. if self.ui.tw_paths.currentIndex() == 0:
  432. self.ui.lw_ladspa.addItem(newPath)
  433. elif self.ui.tw_paths.currentIndex() == 1:
  434. self.ui.lw_dssi.addItem(newPath)
  435. elif self.ui.tw_paths.currentIndex() == 2:
  436. self.ui.lw_lv2.addItem(newPath)
  437. elif self.ui.tw_paths.currentIndex() == 3:
  438. self.ui.lw_vst.addItem(newPath)
  439. elif self.ui.tw_paths.currentIndex() == 4:
  440. self.ui.lw_gig.addItem(newPath)
  441. elif self.ui.tw_paths.currentIndex() == 5:
  442. self.ui.lw_sf2.addItem(newPath)
  443. elif self.ui.tw_paths.currentIndex() == 6:
  444. self.ui.lw_sfz.addItem(newPath)
  445. @pyqtSlot()
  446. def slot_removePluginPath(self):
  447. if self.ui.tw_paths.currentIndex() == 0:
  448. self.ui.lw_ladspa.takeItem(self.ui.lw_ladspa.currentRow())
  449. elif self.ui.tw_paths.currentIndex() == 1:
  450. self.ui.lw_dssi.takeItem(self.ui.lw_dssi.currentRow())
  451. elif self.ui.tw_paths.currentIndex() == 2:
  452. self.ui.lw_lv2.takeItem(self.ui.lw_lv2.currentRow())
  453. elif self.ui.tw_paths.currentIndex() == 3:
  454. self.ui.lw_vst.takeItem(self.ui.lw_vst.currentRow())
  455. elif self.ui.tw_paths.currentIndex() == 4:
  456. self.ui.lw_gig.takeItem(self.ui.lw_gig.currentRow())
  457. elif self.ui.tw_paths.currentIndex() == 5:
  458. self.ui.lw_sf2.takeItem(self.ui.lw_sf2.currentRow())
  459. elif self.ui.tw_paths.currentIndex() == 6:
  460. self.ui.lw_sfz.takeItem(self.ui.lw_sfz.currentRow())
  461. @pyqtSlot()
  462. def slot_changePluginPath(self):
  463. if self.ui.tw_paths.currentIndex() == 0:
  464. currentPath = self.ui.lw_ladspa.currentItem().text()
  465. elif self.ui.tw_paths.currentIndex() == 1:
  466. currentPath = self.ui.lw_dssi.currentItem().text()
  467. elif self.ui.tw_paths.currentIndex() == 2:
  468. currentPath = self.ui.lw_lv2.currentItem().text()
  469. elif self.ui.tw_paths.currentIndex() == 3:
  470. currentPath = self.ui.lw_vst.currentItem().text()
  471. elif self.ui.tw_paths.currentIndex() == 4:
  472. currentPath = self.ui.lw_gig.currentItem().text()
  473. elif self.ui.tw_paths.currentIndex() == 5:
  474. currentPath = self.ui.lw_sf2.currentItem().text()
  475. elif self.ui.tw_paths.currentIndex() == 6:
  476. currentPath = self.ui.lw_sfz.currentItem().text()
  477. else:
  478. currentPath = ""
  479. newPath = QFileDialog.getExistingDirectory(self, self.tr("Add Path"), currentPath, QFileDialog.ShowDirsOnly)
  480. if newPath:
  481. if self.ui.tw_paths.currentIndex() == 0:
  482. self.ui.lw_ladspa.currentItem().setText(newPath)
  483. elif self.ui.tw_paths.currentIndex() == 1:
  484. self.ui.lw_dssi.currentItem().setText(newPath)
  485. elif self.ui.tw_paths.currentIndex() == 2:
  486. self.ui.lw_lv2.currentItem().setText(newPath)
  487. elif self.ui.tw_paths.currentIndex() == 3:
  488. self.ui.lw_vst.currentItem().setText(newPath)
  489. elif self.ui.tw_paths.currentIndex() == 4:
  490. self.ui.lw_gig.currentItem().setText(newPath)
  491. elif self.ui.tw_paths.currentIndex() == 5:
  492. self.ui.lw_sf2.currentItem().setText(newPath)
  493. elif self.ui.tw_paths.currentIndex() == 6:
  494. self.ui.lw_sfz.currentItem().setText(newPath)
  495. @pyqtSlot(int)
  496. def slot_pluginPathTabChanged(self, index):
  497. if index == 0:
  498. row = self.ui.lw_ladspa.currentRow()
  499. elif index == 1:
  500. row = self.ui.lw_dssi.currentRow()
  501. elif index == 2:
  502. row = self.ui.lw_lv2.currentRow()
  503. elif index == 3:
  504. row = self.ui.lw_vst.currentRow()
  505. elif index == 4:
  506. row = self.ui.lw_gig.currentRow()
  507. elif index == 5:
  508. row = self.ui.lw_sf2.currentRow()
  509. elif index == 6:
  510. row = self.ui.lw_sfz.currentRow()
  511. else:
  512. row = -1
  513. check = bool(row >= 0)
  514. self.ui.b_paths_remove.setEnabled(check)
  515. self.ui.b_paths_change.setEnabled(check)
  516. @pyqtSlot(int)
  517. def slot_pluginPathRowChanged(self, row):
  518. check = bool(row >= 0)
  519. self.ui.b_paths_remove.setEnabled(check)
  520. self.ui.b_paths_change.setEnabled(check)
  521. def done(self, r):
  522. QDialog.done(self, r)
  523. self.close()
  524. # ------------------------------------------------------------------------------------------------------------
  525. # Main
  526. if __name__ == '__main__':
  527. try:
  528. from PyQt5.QtWidgets import QApplication
  529. except:
  530. from PyQt4.QtGui import QApplication
  531. app = QApplication(sys.argv)
  532. app.setApplicationName("Carla")
  533. app.setApplicationVersion(VERSION)
  534. app.setOrganizationName("falkTX")
  535. app.setWindowIcon(QIcon(":/scalable/carla.svg"))
  536. initHost("Settings", None, False)
  537. gui = CarlaSettingsW(None, True, True)
  538. gui.show()
  539. sys.exit(app.exec_())