Cleanup
[carla.git] / source / frontend / carla_settings.py
blobb35c2ddc0413f9b49b44413822f9920cb981f7e8
1 #!/usr/bin/env python3
2 # SPDX-FileCopyrightText: 2011-2024 Filipe Coelho <falktx@falktx.com>
3 # SPDX-License-Identifier: GPL-2.0-or-later
5 # ---------------------------------------------------------------------------------------------------------------------
6 # Imports (PyQt)
8 from qt_compat import qt_config
10 if qt_config == 5:
11 from PyQt5.QtCore import pyqtSlot, QT_VERSION, Qt
12 from PyQt5.QtWidgets import QDialog, QDialogButtonBox, QFileDialog
13 elif qt_config == 6:
14 from PyQt6.QtCore import pyqtSlot, QT_VERSION, Qt
15 from PyQt6.QtWidgets import QDialog, QDialogButtonBox, QFileDialog
17 # ---------------------------------------------------------------------------------------------------------------------
18 # Imports (Custom)
20 import ui_carla_settings
21 import ui_carla_settings_driver
23 from carla_backend import (
24 LINUX, MACOS, WINDOWS,
25 ENGINE_DRIVER_DEVICE_HAS_CONTROL_PANEL,
26 ENGINE_DRIVER_DEVICE_CAN_TRIPLE_BUFFER,
27 ENGINE_DRIVER_DEVICE_VARIABLE_BUFFER_SIZE,
28 ENGINE_DRIVER_DEVICE_VARIABLE_SAMPLE_RATE,
29 ENGINE_PROCESS_MODE_CONTINUOUS_RACK,
30 ENGINE_OPTION_FILE_PATH,
31 ENGINE_OPTION_PLUGIN_PATH,
32 FILE_AUDIO,
33 FILE_MIDI,
34 PLUGIN_LADSPA,
35 PLUGIN_DSSI,
36 PLUGIN_LV2,
37 PLUGIN_VST2,
38 PLUGIN_VST3,
39 PLUGIN_SF2,
40 PLUGIN_SFZ,
41 PLUGIN_JSFX,
42 PLUGIN_CLAP,
45 from carla_shared import (
46 CARLA_KEY_MAIN_PROJECT_FOLDER,
47 CARLA_KEY_MAIN_USE_PRO_THEME,
48 CARLA_KEY_MAIN_PRO_THEME_COLOR,
49 CARLA_KEY_MAIN_REFRESH_INTERVAL,
50 CARLA_KEY_MAIN_CONFIRM_EXIT,
51 CARLA_KEY_MAIN_CLASSIC_SKIN,
52 CARLA_KEY_MAIN_SHOW_LOGS,
53 CARLA_KEY_MAIN_SYSTEM_ICONS,
54 CARLA_KEY_MAIN_EXPERIMENTAL,
55 CARLA_KEY_CANVAS_THEME,
56 CARLA_KEY_CANVAS_SIZE,
57 CARLA_KEY_CANVAS_USE_BEZIER_LINES,
58 CARLA_KEY_CANVAS_AUTO_HIDE_GROUPS,
59 CARLA_KEY_CANVAS_AUTO_SELECT_ITEMS,
60 CARLA_KEY_CANVAS_EYE_CANDY,
61 CARLA_KEY_CANVAS_FANCY_EYE_CANDY,
62 CARLA_KEY_CANVAS_USE_OPENGL,
63 CARLA_KEY_CANVAS_ANTIALIASING,
64 CARLA_KEY_CANVAS_HQ_ANTIALIASING,
65 CARLA_KEY_CANVAS_INLINE_DISPLAYS,
66 CARLA_KEY_CANVAS_FULL_REPAINTS,
67 CARLA_KEY_ENGINE_DRIVER_PREFIX,
68 CARLA_KEY_ENGINE_AUDIO_DRIVER,
69 CARLA_KEY_ENGINE_PROCESS_MODE,
70 CARLA_KEY_ENGINE_FORCE_STEREO,
71 CARLA_KEY_ENGINE_PREFER_PLUGIN_BRIDGES,
72 CARLA_KEY_ENGINE_PREFER_UI_BRIDGES,
73 CARLA_KEY_ENGINE_MANAGE_UIS,
74 CARLA_KEY_ENGINE_UIS_ALWAYS_ON_TOP,
75 CARLA_KEY_ENGINE_MAX_PARAMETERS,
76 CARLA_KEY_ENGINE_RESET_XRUNS,
77 CARLA_KEY_ENGINE_UI_BRIDGES_TIMEOUT,
78 CARLA_KEY_OSC_ENABLED,
79 CARLA_KEY_OSC_TCP_PORT_ENABLED,
80 CARLA_KEY_OSC_TCP_PORT_NUMBER,
81 CARLA_KEY_OSC_TCP_PORT_RANDOM,
82 CARLA_KEY_OSC_UDP_PORT_ENABLED,
83 CARLA_KEY_OSC_UDP_PORT_NUMBER,
84 CARLA_KEY_OSC_UDP_PORT_RANDOM,
85 CARLA_KEY_PATHS_AUDIO,
86 CARLA_KEY_PATHS_MIDI,
87 CARLA_KEY_PATHS_LADSPA,
88 CARLA_KEY_PATHS_DSSI,
89 CARLA_KEY_PATHS_LV2,
90 CARLA_KEY_PATHS_VST2,
91 CARLA_KEY_PATHS_VST3,
92 CARLA_KEY_PATHS_SF2,
93 CARLA_KEY_PATHS_SFZ,
94 CARLA_KEY_PATHS_JSFX,
95 CARLA_KEY_PATHS_CLAP,
96 CARLA_KEY_WINE_EXECUTABLE,
97 CARLA_KEY_WINE_AUTO_PREFIX,
98 CARLA_KEY_WINE_FALLBACK_PREFIX,
99 CARLA_KEY_WINE_RT_PRIO_ENABLED,
100 CARLA_KEY_WINE_BASE_RT_PRIO,
101 CARLA_KEY_WINE_SERVER_RT_PRIO,
102 CARLA_KEY_EXPERIMENTAL_PLUGIN_BRIDGES,
103 CARLA_KEY_EXPERIMENTAL_WINE_BRIDGES,
104 CARLA_KEY_EXPERIMENTAL_JACK_APPS,
105 CARLA_KEY_EXPERIMENTAL_EXPORT_LV2,
106 CARLA_KEY_EXPERIMENTAL_PREVENT_BAD_BEHAVIOUR,
107 CARLA_KEY_EXPERIMENTAL_LOAD_LIB_GLOBAL,
108 CARLA_DEFAULT_MAIN_PROJECT_FOLDER,
109 CARLA_DEFAULT_MAIN_USE_PRO_THEME,
110 CARLA_DEFAULT_MAIN_PRO_THEME_COLOR,
111 CARLA_DEFAULT_MAIN_REFRESH_INTERVAL,
112 CARLA_DEFAULT_MAIN_CONFIRM_EXIT,
113 CARLA_DEFAULT_MAIN_CLASSIC_SKIN,
114 CARLA_DEFAULT_MAIN_SHOW_LOGS,
115 CARLA_DEFAULT_MAIN_SYSTEM_ICONS,
116 #CARLA_DEFAULT_MAIN_EXPERIMENTAL,
117 CARLA_DEFAULT_CANVAS_THEME,
118 CARLA_DEFAULT_CANVAS_SIZE,
119 CARLA_DEFAULT_CANVAS_USE_BEZIER_LINES,
120 CARLA_DEFAULT_CANVAS_AUTO_HIDE_GROUPS,
121 CARLA_DEFAULT_CANVAS_AUTO_SELECT_ITEMS,
122 CARLA_DEFAULT_CANVAS_EYE_CANDY,
123 CARLA_DEFAULT_CANVAS_FANCY_EYE_CANDY,
124 CARLA_DEFAULT_CANVAS_USE_OPENGL,
125 CARLA_DEFAULT_CANVAS_ANTIALIASING,
126 CARLA_DEFAULT_CANVAS_HQ_ANTIALIASING,
127 CARLA_DEFAULT_CANVAS_INLINE_DISPLAYS,
128 CARLA_DEFAULT_CANVAS_FULL_REPAINTS,
129 CARLA_DEFAULT_FORCE_STEREO,
130 CARLA_DEFAULT_PREFER_PLUGIN_BRIDGES,
131 CARLA_DEFAULT_PREFER_UI_BRIDGES,
132 CARLA_DEFAULT_MANAGE_UIS,
133 CARLA_DEFAULT_UIS_ALWAYS_ON_TOP,
134 CARLA_DEFAULT_MAX_PARAMETERS,
135 CARLA_DEFAULT_RESET_XRUNS,
136 CARLA_DEFAULT_UI_BRIDGES_TIMEOUT,
137 CARLA_DEFAULT_AUDIO_BUFFER_SIZE,
138 CARLA_DEFAULT_AUDIO_SAMPLE_RATE,
139 CARLA_DEFAULT_AUDIO_TRIPLE_BUFFER,
140 CARLA_DEFAULT_AUDIO_DRIVER,
141 CARLA_DEFAULT_PROCESS_MODE,
142 CARLA_DEFAULT_OSC_ENABLED,
143 CARLA_DEFAULT_OSC_TCP_PORT_ENABLED,
144 CARLA_DEFAULT_OSC_TCP_PORT_NUMBER,
145 CARLA_DEFAULT_OSC_TCP_PORT_RANDOM,
146 CARLA_DEFAULT_OSC_UDP_PORT_ENABLED,
147 CARLA_DEFAULT_OSC_UDP_PORT_NUMBER,
148 CARLA_DEFAULT_OSC_UDP_PORT_RANDOM,
149 CARLA_DEFAULT_WINE_EXECUTABLE,
150 CARLA_DEFAULT_WINE_AUTO_PREFIX,
151 CARLA_DEFAULT_WINE_FALLBACK_PREFIX,
152 CARLA_DEFAULT_WINE_RT_PRIO_ENABLED,
153 CARLA_DEFAULT_WINE_BASE_RT_PRIO,
154 CARLA_DEFAULT_WINE_SERVER_RT_PRIO,
155 CARLA_DEFAULT_EXPERIMENTAL_PLUGIN_BRIDGES,
156 CARLA_DEFAULT_EXPERIMENTAL_WINE_BRIDGES,
157 CARLA_DEFAULT_EXPERIMENTAL_JACK_APPS,
158 CARLA_DEFAULT_EXPERIMENTAL_LV2_EXPORT,
159 CARLA_DEFAULT_EXPERIMENTAL_PREVENT_BAD_BEHAVIOUR,
160 CARLA_DEFAULT_EXPERIMENTAL_LOAD_LIB_GLOBAL,
161 CARLA_DEFAULT_FILE_PATH_AUDIO,
162 CARLA_DEFAULT_FILE_PATH_MIDI,
163 CARLA_DEFAULT_LADSPA_PATH,
164 CARLA_DEFAULT_DSSI_PATH,
165 CARLA_DEFAULT_LV2_PATH,
166 CARLA_DEFAULT_VST2_PATH,
167 CARLA_DEFAULT_VST3_PATH,
168 CARLA_DEFAULT_SF2_PATH,
169 CARLA_DEFAULT_SFZ_PATH,
170 CARLA_DEFAULT_JSFX_PATH,
171 CARLA_DEFAULT_CLAP_PATH,
172 getAndSetPath,
173 getIcon,
174 fontMetricsHorizontalAdvance,
175 splitter,
178 from patchcanvas.theme import Theme, getThemeName
180 from utils import QSafeSettings
182 # ---------------------------------------------------------------------------------------------------------------------
183 # ...
185 BUFFER_SIZE_LIST = (16, 32, 64, 128, 256, 512, 1024, 2048, 4096, 8192)
186 SAMPLE_RATE_LIST = (22050, 32000, 44100, 48000, 88200, 96000, 176400, 192000)
188 # ---------------------------------------------------------------------------------------------------------------------
189 # Driver Settings
191 class DriverSettingsW(QDialog):
192 AUTOMATIC_OPTION = "(Auto)"
194 def __init__(self, parent, host, driverIndex, driverName):
195 QDialog.__init__(self, parent)
196 self.host = host
197 self.ui = ui_carla_settings_driver.Ui_DriverSettingsW()
198 self.ui.setupUi(self)
200 # -------------------------------------------------------------------------------------------------------------
201 # Internal stuff
203 self.fDriverIndex = driverIndex
204 self.fDriverName = driverName
205 self.fDeviceNames = host.get_engine_driver_device_names(driverIndex)
207 self.fBufferSizes = BUFFER_SIZE_LIST
208 self.fSampleRates = SAMPLE_RATE_LIST
210 # -------------------------------------------------------------------------------------------------------------
211 # Set-up GUI
213 for name in self.fDeviceNames:
214 self.ui.cb_device.addItem(name)
216 self.setWindowFlags(self.windowFlags() & ~Qt.WindowContextHelpButtonHint)
218 if MACOS:
219 self.setWindowModality(Qt.WindowModal)
221 # -------------------------------------------------------------------------------------------------------------
222 # Load settings
224 self.loadSettings()
226 # -------------------------------------------------------------------------------------------------------------
227 # Set-up connections
229 self.accepted.connect(self.slot_saveSettings)
230 self.ui.b_panel.clicked.connect(self.slot_showDevicePanel)
231 self.ui.cb_device.currentIndexChanged.connect(self.slot_updateDeviceInfo)
233 # -----------------------------------------------------------------------------------------------------------------
235 def getValues(self):
236 audioDevice = self.ui.cb_device.currentText()
237 bufferSize = self.ui.cb_buffersize.currentText()
238 sampleRate = self.ui.cb_samplerate.currentText()
240 if bufferSize == self.AUTOMATIC_OPTION:
241 bufferSize = "0"
242 if sampleRate == self.AUTOMATIC_OPTION:
243 sampleRate = "0"
245 return (audioDevice, int(bufferSize), int(sampleRate))
247 # -----------------------------------------------------------------------------------------------------------------
249 def loadSettings(self):
250 settings = QSafeSettings("falkTX", "Carla2")
252 args = (CARLA_KEY_ENGINE_DRIVER_PREFIX, self.fDriverName)
253 audioDevice = settings.value("%s%s/Device" % args, "", str)
254 audioBufferSize = settings.value("%s%s/BufferSize" % args, CARLA_DEFAULT_AUDIO_BUFFER_SIZE, int)
255 audioSampleRate = settings.value("%s%s/SampleRate" % args, CARLA_DEFAULT_AUDIO_SAMPLE_RATE, int)
256 audioTripleBuffer = settings.value("%s%s/TripleBuffer" % args, CARLA_DEFAULT_AUDIO_TRIPLE_BUFFER, bool)
258 if audioDevice and audioDevice in self.fDeviceNames:
259 self.ui.cb_device.setCurrentIndex(self.fDeviceNames.index(audioDevice))
260 else:
261 self.ui.cb_device.setCurrentIndex(-1)
263 # fill combo-boxes first
264 self.slot_updateDeviceInfo()
266 if audioBufferSize and audioBufferSize in self.fBufferSizes:
267 self.ui.cb_buffersize.setCurrentIndex(self.fBufferSizes.index(audioBufferSize))
268 elif self.fBufferSizes == BUFFER_SIZE_LIST:
269 self.ui.cb_buffersize.setCurrentIndex(BUFFER_SIZE_LIST.index(CARLA_DEFAULT_AUDIO_BUFFER_SIZE))
270 else:
271 self.ui.cb_buffersize.setCurrentIndex(int(len(self.fBufferSizes)/2))
273 if audioSampleRate and audioSampleRate in self.fSampleRates:
274 self.ui.cb_samplerate.setCurrentIndex(self.fSampleRates.index(audioSampleRate))
275 elif self.fSampleRates == SAMPLE_RATE_LIST:
276 self.ui.cb_samplerate.setCurrentIndex(SAMPLE_RATE_LIST.index(CARLA_DEFAULT_AUDIO_SAMPLE_RATE))
277 else:
278 self.ui.cb_samplerate.setCurrentIndex(int(len(self.fSampleRates)/2))
280 self.ui.cb_triple_buffer.setChecked(audioTripleBuffer and self.ui.cb_triple_buffer.isEnabled())
282 # -----------------------------------------------------------------------------------------------------------------
284 @pyqtSlot()
285 def slot_saveSettings(self):
286 settings = QSafeSettings("falkTX", "Carla2")
288 bufferSize = self.ui.cb_buffersize.currentText()
289 sampleRate = self.ui.cb_samplerate.currentText()
291 if bufferSize == self.AUTOMATIC_OPTION:
292 bufferSize = "0"
293 if sampleRate == self.AUTOMATIC_OPTION:
294 sampleRate = "0"
296 args = (CARLA_KEY_ENGINE_DRIVER_PREFIX, self.fDriverName)
297 settings.setValue("%s%s/Device" % args, self.ui.cb_device.currentText())
298 settings.setValue("%s%s/BufferSize" % args, bufferSize)
299 settings.setValue("%s%s/SampleRate" % args, sampleRate)
300 settings.setValue("%s%s/TripleBuffer" % args, self.ui.cb_triple_buffer.isChecked())
302 # -----------------------------------------------------------------------------------------------------------------
304 @pyqtSlot()
305 def slot_showDevicePanel(self):
306 self.host.show_engine_driver_device_control_panel(self.fDriverIndex, self.ui.cb_device.currentText())
308 @pyqtSlot()
309 def slot_updateDeviceInfo(self):
310 deviceName = self.ui.cb_device.currentText()
312 oldBufferSize = self.ui.cb_buffersize.currentText()
313 oldSampleRate = self.ui.cb_samplerate.currentText()
315 self.ui.cb_buffersize.clear()
316 self.ui.cb_samplerate.clear()
318 driverDeviceInfo = self.host.get_engine_driver_device_info(self.fDriverIndex, deviceName)
319 driverDeviceHints = driverDeviceInfo['hints']
320 self.fBufferSizes = driverDeviceInfo['bufferSizes']
321 self.fSampleRates = driverDeviceInfo['sampleRates']
323 if driverDeviceHints & ENGINE_DRIVER_DEVICE_CAN_TRIPLE_BUFFER:
324 self.ui.cb_triple_buffer.setEnabled(True)
325 else:
326 self.ui.cb_triple_buffer.setEnabled(False)
328 if driverDeviceHints & ENGINE_DRIVER_DEVICE_HAS_CONTROL_PANEL:
329 self.ui.b_panel.setEnabled(True)
330 else:
331 self.ui.b_panel.setEnabled(False)
333 if self.fBufferSizes:
334 match = False
335 for bsize in self.fBufferSizes:
336 sbsize = str(bsize)
337 self.ui.cb_buffersize.addItem(sbsize)
339 if oldBufferSize == sbsize:
340 match = True
341 self.ui.cb_buffersize.setCurrentIndex(self.ui.cb_buffersize.count()-1)
343 if not match:
344 if CARLA_DEFAULT_AUDIO_BUFFER_SIZE in self.fBufferSizes:
345 self.ui.cb_buffersize.setCurrentIndex(self.fBufferSizes.index(CARLA_DEFAULT_AUDIO_BUFFER_SIZE))
346 else:
347 self.ui.cb_buffersize.setCurrentIndex(int(len(self.fBufferSizes)/2))
349 else:
350 self.ui.cb_buffersize.addItem(self.AUTOMATIC_OPTION)
351 self.ui.cb_buffersize.setCurrentIndex(0)
353 if self.fSampleRates:
354 match = False
355 for srate in self.fSampleRates:
356 ssrate = str(int(srate))
357 self.ui.cb_samplerate.addItem(ssrate)
359 if oldSampleRate == ssrate:
360 match = True
361 self.ui.cb_samplerate.setCurrentIndex(self.ui.cb_samplerate.count()-1)
363 if not match:
364 if CARLA_DEFAULT_AUDIO_SAMPLE_RATE in self.fSampleRates:
365 self.ui.cb_samplerate.setCurrentIndex(self.fSampleRates.index(CARLA_DEFAULT_AUDIO_SAMPLE_RATE))
366 else:
367 self.ui.cb_samplerate.setCurrentIndex(int(len(self.fSampleRates)/2))
369 else:
370 self.ui.cb_samplerate.addItem(self.AUTOMATIC_OPTION)
371 self.ui.cb_samplerate.setCurrentIndex(0)
373 # ---------------------------------------------------------------------------------------------------------------------
374 # Runtime Driver Settings
376 class RuntimeDriverSettingsW(QDialog):
377 def __init__(self, parent, host):
378 QDialog.__init__(self, parent)
379 self.host = host
380 self.ui = ui_carla_settings_driver.Ui_DriverSettingsW()
381 self.ui.setupUi(self)
383 driverDeviceInfo = host.get_runtime_engine_driver_device_info()
385 # -------------------------------------------------------------------------------------------------------------
386 # Set-up GUI
388 self.ui.cb_device.clear()
389 self.ui.cb_buffersize.clear()
390 self.ui.cb_samplerate.clear()
391 self.ui.cb_triple_buffer.hide()
392 self.ui.ico_restart.hide()
393 self.ui.label_restart.hide()
395 self.ui.layout_triple_buffer.takeAt(2)
396 self.ui.layout_triple_buffer.takeAt(1)
397 self.ui.layout_triple_buffer.takeAt(0)
398 self.ui.verticalLayout.removeItem(self.ui.layout_triple_buffer)
400 self.ui.layout_restart.takeAt(3)
401 self.ui.layout_restart.takeAt(2)
402 self.ui.layout_restart.takeAt(1)
403 self.ui.layout_restart.takeAt(0)
404 self.ui.verticalLayout.removeItem(self.ui.layout_restart)
406 self.adjustSize()
407 self.setWindowFlags(self.windowFlags() & ~Qt.WindowContextHelpButtonHint)
409 if MACOS:
410 self.setWindowModality(Qt.WindowModal)
412 # -------------------------------------------------------------------------------------------------------------
413 # Load runtime settings
415 if host.is_engine_running():
416 self.ui.cb_device.addItem(driverDeviceInfo['name'])
417 self.ui.cb_device.setCurrentIndex(0)
418 self.ui.cb_device.setEnabled(False)
419 else:
420 self.ui.cb_device.addItem(driverDeviceInfo['name'])
421 self.ui.cb_device.setCurrentIndex(0)
423 if driverDeviceInfo['bufferSizes']:
424 for bsize in driverDeviceInfo['bufferSizes']:
425 sbsize = str(bsize)
426 self.ui.cb_buffersize.addItem(sbsize)
428 if driverDeviceInfo['bufferSize'] == bsize:
429 self.ui.cb_buffersize.setCurrentIndex(self.ui.cb_buffersize.count()-1)
431 else:
432 self.ui.cb_buffersize.addItem(DriverSettingsW.AUTOMATIC_OPTION)
433 self.ui.cb_buffersize.setCurrentIndex(0)
435 if (driverDeviceInfo['hints'] & ENGINE_DRIVER_DEVICE_VARIABLE_BUFFER_SIZE) == 0x0:
436 self.ui.cb_buffersize.setEnabled(False)
438 if driverDeviceInfo['sampleRates']:
439 for srate in driverDeviceInfo['sampleRates']:
440 ssrate = str(int(srate))
441 self.ui.cb_samplerate.addItem(ssrate)
443 if driverDeviceInfo['sampleRate'] == srate:
444 self.ui.cb_samplerate.setCurrentIndex(self.ui.cb_samplerate.count()-1)
446 else:
447 self.ui.cb_samplerate.addItem(DriverSettingsW.AUTOMATIC_OPTION)
448 self.ui.cb_samplerate.setCurrentIndex(0)
450 if (driverDeviceInfo['hints'] & ENGINE_DRIVER_DEVICE_VARIABLE_SAMPLE_RATE) == 0x0:
451 self.ui.cb_samplerate.setEnabled(False)
453 if (driverDeviceInfo['hints'] & ENGINE_DRIVER_DEVICE_HAS_CONTROL_PANEL) == 0x0:
454 self.ui.b_panel.setEnabled(False)
456 # -------------------------------------------------------------------------------------------------------------
457 # Set-up connections
459 self.ui.b_panel.clicked.connect(self.slot_showDevicePanel)
461 # -----------------------------------------------------------------------------------------------------------------
463 def getValues(self):
464 audioDevice = self.ui.cb_device.currentText()
465 bufferSize = self.ui.cb_buffersize.currentText()
466 sampleRate = self.ui.cb_samplerate.currentText()
468 if bufferSize == DriverSettingsW.AUTOMATIC_OPTION:
469 bufferSize = "0"
470 if sampleRate == DriverSettingsW.AUTOMATIC_OPTION:
471 sampleRate = "0"
473 return (audioDevice, int(bufferSize), int(sampleRate))
475 # -----------------------------------------------------------------------------------------------------------------
477 @pyqtSlot()
478 def slot_showDevicePanel(self):
479 self.host.show_engine_device_control_panel()
481 # ---------------------------------------------------------------------------------------------------------------------
482 # Settings Dialog
484 class CarlaSettingsW(QDialog):
485 # Tab indexes
486 TAB_INDEX_MAIN = 0
487 TAB_INDEX_CANVAS = 1
488 TAB_INDEX_ENGINE = 2
489 TAB_INDEX_OSC = 3
490 TAB_INDEX_FILEPATHS = 4
491 TAB_INDEX_PLUGINPATHS = 5
492 TAB_INDEX_WINE = 6
493 TAB_INDEX_EXPERIMENTAL = 7
494 TAB_INDEX_NONE = 8
496 # File Path indexes
497 FILEPATH_INDEX_AUDIO = 0
498 FILEPATH_INDEX_MIDI = 1
500 # Plugin Path indexes
501 PLUGINPATH_INDEX_LADSPA = 0
502 PLUGINPATH_INDEX_DSSI = 1
503 PLUGINPATH_INDEX_LV2 = 2
504 PLUGINPATH_INDEX_VST2 = 3
505 PLUGINPATH_INDEX_VST3 = 4
506 PLUGINPATH_INDEX_SF2 = 5
507 PLUGINPATH_INDEX_SFZ = 6
508 PLUGINPATH_INDEX_JSFX = 7
509 PLUGINPATH_INDEX_CLAP = 8
511 # Single and Multiple client mode is only for JACK,
512 # but we still want to match QComboBox index to backend defines,
513 # so add +2 pos padding if driverName != "JACK".
514 PROCESS_MODE_NON_JACK_PADDING = 2
516 # -----------------------------------------------------------------------------------------------------------------
518 def __init__(self, parent, host, hasCanvas, hasCanvasGL):
519 QDialog.__init__(self, parent)
520 self.host = host
521 self.ui = ui_carla_settings.Ui_CarlaSettingsW()
522 self.ui.setupUi(self)
524 # -------------------------------------------------------------------------------------------------------------
525 # Set-up GUI
527 self.ui.lw_page.setFixedWidth(48 + 6*3 +
528 fontMetricsHorizontalAdvance(self.ui.lw_page.fontMetrics(), " Experimental "))
530 for i in range(host.get_engine_driver_count()):
531 self.ui.cb_engine_audio_driver.addItem(host.get_engine_driver_name(i))
533 for i in range(Theme.THEME_MAX):
534 self.ui.cb_canvas_theme.addItem(getThemeName(i))
536 if MACOS:
537 self.ui.group_main_theme.setEnabled(False)
538 self.ui.group_main_theme.setVisible(False)
540 if WINDOWS or host.isControl:
541 self.ui.ch_main_show_logs.setEnabled(False)
542 self.ui.ch_main_show_logs.setVisible(False)
544 if host.isControl:
545 self.ui.lw_page.hideRow(self.TAB_INDEX_ENGINE)
546 self.ui.lw_page.hideRow(self.TAB_INDEX_FILEPATHS)
547 self.ui.lw_page.hideRow(self.TAB_INDEX_PLUGINPATHS)
548 self.ui.ch_exp_export_lv2.hide()
549 self.ui.group_experimental_engine.hide()
550 self.ui.cb_canvas_inline_displays.hide()
552 elif not hasCanvas:
553 self.ui.lw_page.hideRow(self.TAB_INDEX_CANVAS)
555 elif not hasCanvasGL:
556 self.ui.cb_canvas_use_opengl.setEnabled(False)
557 self.ui.cb_canvas_render_hq_aa.setEnabled(False)
559 if host.isPlugin:
560 self.ui.cb_engine_audio_driver.setEnabled(False)
562 if host.audioDriverForced is not None:
563 self.ui.cb_engine_audio_driver.setEnabled(False)
564 self.ui.tb_engine_driver_config.setEnabled(False)
566 if host.processModeForced:
567 self.ui.cb_engine_process_mode_jack.setEnabled(False)
568 self.ui.cb_engine_process_mode_other.setEnabled(False)
570 if self.host.processMode == ENGINE_PROCESS_MODE_CONTINUOUS_RACK:
571 self.ui.ch_engine_force_stereo.setEnabled(False)
573 if host.isControl or host.isPlugin:
574 self.ui.ch_main_confirm_exit.hide()
575 self.ui.ch_exp_load_lib_global.hide()
576 self.ui.lw_page.hideRow(self.TAB_INDEX_OSC)
577 self.ui.lw_page.hideRow(self.TAB_INDEX_WINE)
579 if not LINUX:
580 self.ui.ch_exp_wine_bridges.setVisible(False)
581 self.ui.ch_exp_prevent_bad_behaviour.setVisible(False)
582 self.ui.lw_page.hideRow(self.TAB_INDEX_WINE)
584 if not MACOS:
585 self.ui.label_engine_ui_bridges_mac_note.setVisible(False)
587 if not (LINUX or MACOS):
588 self.ui.ch_exp_jack_apps.setVisible(False)
590 # FIXME, not implemented yet
591 self.ui.ch_engine_uis_always_on_top.hide()
593 # FIXME broken in some Qt5 versions
594 self.ui.cb_canvas_eyecandy.setEnabled(QT_VERSION >= 0x50c00)
596 # removed in Qt6
597 if QT_VERSION >= 0x60000:
598 self.ui.cb_canvas_render_hq_aa.hide()
600 self.setWindowFlags(self.windowFlags() & ~Qt.WindowContextHelpButtonHint)
602 if MACOS:
603 self.setWindowModality(Qt.WindowModal)
605 # -------------------------------------------------------------------------------------------------------------
606 # Load settings
608 self.loadSettings()
610 # -------------------------------------------------------------------------------------------------------------
611 # Set-up Icons
613 if self.ui.ch_main_system_icons.isChecked():
614 self.ui.b_main_proj_folder_open.setIcon(getIcon('document-open', 16, 'svgz'))
615 self.ui.b_filepaths_add.setIcon(getIcon('list-add', 16, 'svgz'))
616 self.ui.b_filepaths_change.setIcon(getIcon('edit-rename', 16, 'svgz'))
617 self.ui.b_filepaths_remove.setIcon(getIcon('list-remove', 16, 'svgz'))
618 self.ui.b_paths_add.setIcon(getIcon('list-add', 16, 'svgz'))
619 self.ui.b_paths_change.setIcon(getIcon('edit-rename', 16, 'svgz'))
620 self.ui.b_paths_remove.setIcon(getIcon('list-remove', 16, 'svgz'))
622 # -------------------------------------------------------------------------------------------------------------
623 # Set-up connections
625 self.accepted.connect(self.slot_saveSettings)
626 self.ui.buttonBox.button(QDialogButtonBox.Reset).clicked.connect(self.slot_resetSettings)
628 self.ui.b_main_proj_folder_open.clicked.connect(self.slot_getAndSetProjectPath)
630 self.ui.cb_engine_audio_driver.currentIndexChanged.connect(self.slot_engineAudioDriverChanged)
631 self.ui.tb_engine_driver_config.clicked.connect(self.slot_showAudioDriverSettings)
633 self.ui.b_paths_add.clicked.connect(self.slot_addPluginPath)
634 self.ui.b_paths_remove.clicked.connect(self.slot_removePluginPath)
635 self.ui.b_paths_change.clicked.connect(self.slot_changePluginPath)
636 self.ui.cb_paths.currentIndexChanged.connect(self.slot_pluginPathTabChanged)
637 self.ui.lw_ladspa.currentRowChanged.connect(self.slot_pluginPathRowChanged)
638 self.ui.lw_dssi.currentRowChanged.connect(self.slot_pluginPathRowChanged)
639 self.ui.lw_lv2.currentRowChanged.connect(self.slot_pluginPathRowChanged)
640 self.ui.lw_vst.currentRowChanged.connect(self.slot_pluginPathRowChanged)
641 self.ui.lw_vst3.currentRowChanged.connect(self.slot_pluginPathRowChanged)
642 self.ui.lw_sf2.currentRowChanged.connect(self.slot_pluginPathRowChanged)
643 self.ui.lw_sfz.currentRowChanged.connect(self.slot_pluginPathRowChanged)
644 self.ui.lw_jsfx.currentRowChanged.connect(self.slot_pluginPathRowChanged)
645 self.ui.lw_clap.currentRowChanged.connect(self.slot_pluginPathRowChanged)
647 self.ui.b_filepaths_add.clicked.connect(self.slot_addFilePath)
648 self.ui.b_filepaths_remove.clicked.connect(self.slot_removeFilePath)
649 self.ui.b_filepaths_change.clicked.connect(self.slot_changeFilePath)
650 self.ui.cb_filepaths.currentIndexChanged.connect(self.slot_filePathTabChanged)
651 self.ui.lw_files_audio.currentRowChanged.connect(self.slot_filePathRowChanged)
652 self.ui.lw_files_midi.currentRowChanged.connect(self.slot_filePathRowChanged)
654 self.ui.ch_main_experimental.toggled.connect(self.slot_enableExperimental)
655 self.ui.ch_exp_wine_bridges.toggled.connect(self.slot_enableWineBridges)
656 self.ui.cb_exp_plugin_bridges.toggled.connect(self.slot_pluginBridgesToggled)
657 self.ui.cb_canvas_eyecandy.toggled.connect(self.slot_canvasEyeCandyToggled)
658 #self.ui.cb_canvas_fancy_eyecandy.toggled.connect(self.slot_canvasFancyEyeCandyToggled)
659 self.ui.cb_canvas_use_opengl.toggled.connect(self.slot_canvasOpenGLToggled)
661 # -------------------------------------------------------------------------------------------------------------
662 # Post-connect setup
664 self.ui.lw_ladspa.setCurrentRow(0)
665 self.ui.lw_dssi.setCurrentRow(0)
666 self.ui.lw_lv2.setCurrentRow(0)
667 self.ui.lw_vst.setCurrentRow(0)
668 self.ui.lw_vst3.setCurrentRow(0)
669 self.ui.lw_sf2.setCurrentRow(0)
670 self.ui.lw_sfz.setCurrentRow(0)
671 self.ui.lw_jsfx.setCurrentRow(0)
672 self.ui.lw_clap.setCurrentRow(0)
674 self.ui.lw_files_audio.setCurrentRow(0)
675 self.ui.lw_files_midi.setCurrentRow(0)
677 self.ui.lw_page.setCurrentCell(0, 0)
679 self.slot_filePathTabChanged(0)
680 self.slot_pluginPathTabChanged(0)
682 self.adjustSize()
684 # -----------------------------------------------------------------------------------------------------------------
686 def loadSettings(self):
687 settings = QSafeSettings()
689 # -------------------------------------------------------------------------------------------------------------
690 # Main
692 self.ui.ch_main_show_logs.setChecked(self.host.showLogs)
693 self.ui.ch_engine_uis_always_on_top.setChecked(self.host.uisAlwaysOnTop)
695 self.ui.le_main_proj_folder.setText(
696 settings.value(CARLA_KEY_MAIN_PROJECT_FOLDER, CARLA_DEFAULT_MAIN_PROJECT_FOLDER, str))
698 self.ui.ch_main_theme_pro.setChecked(self.ui.group_main_theme.isEnabled() and
699 settings.value(CARLA_KEY_MAIN_USE_PRO_THEME,
700 CARLA_DEFAULT_MAIN_USE_PRO_THEME, bool))
702 self.ui.cb_main_theme_color.setCurrentIndex(
703 self.ui.cb_main_theme_color.findText(settings.value(CARLA_KEY_MAIN_PRO_THEME_COLOR,
704 CARLA_DEFAULT_MAIN_PRO_THEME_COLOR, str)))
706 self.ui.sb_main_refresh_interval.setValue(
707 settings.value(CARLA_KEY_MAIN_REFRESH_INTERVAL, CARLA_DEFAULT_MAIN_REFRESH_INTERVAL, int))
709 self.ui.ch_main_confirm_exit.setChecked(
710 settings.value(CARLA_KEY_MAIN_CONFIRM_EXIT, CARLA_DEFAULT_MAIN_CONFIRM_EXIT, bool))
712 self.ui.cb_main_classic_skin_default.setChecked(
713 settings.value(CARLA_KEY_MAIN_CLASSIC_SKIN, CARLA_DEFAULT_MAIN_CLASSIC_SKIN, bool))
715 self.ui.ch_main_system_icons.setChecked(
716 settings.value(CARLA_KEY_MAIN_SYSTEM_ICONS, CARLA_DEFAULT_MAIN_SYSTEM_ICONS, bool))
718 # -------------------------------------------------------------------------------------------------------------
719 # Canvas
721 self.ui.cb_canvas_theme.setCurrentIndex(
722 self.ui.cb_canvas_theme.findText(settings.value(CARLA_KEY_CANVAS_THEME, CARLA_DEFAULT_CANVAS_THEME, str)))
724 self.ui.cb_canvas_size.setCurrentIndex(
725 self.ui.cb_canvas_size.findText(settings.value(CARLA_KEY_CANVAS_SIZE, CARLA_DEFAULT_CANVAS_SIZE, str)))
727 self.ui.cb_canvas_bezier_lines.setChecked(
728 settings.value(CARLA_KEY_CANVAS_USE_BEZIER_LINES, CARLA_DEFAULT_CANVAS_USE_BEZIER_LINES, bool))
730 self.ui.cb_canvas_hide_groups.setChecked(
731 settings.value(CARLA_KEY_CANVAS_AUTO_HIDE_GROUPS, CARLA_DEFAULT_CANVAS_AUTO_HIDE_GROUPS, bool))
733 self.ui.cb_canvas_auto_select.setChecked(
734 settings.value(CARLA_KEY_CANVAS_AUTO_SELECT_ITEMS, CARLA_DEFAULT_CANVAS_AUTO_SELECT_ITEMS, bool))
736 if self.ui.cb_canvas_eyecandy.isEnabled():
737 self.ui.cb_canvas_eyecandy.setChecked(
738 settings.value(CARLA_KEY_CANVAS_EYE_CANDY, CARLA_DEFAULT_CANVAS_EYE_CANDY, bool))
740 self.ui.cb_canvas_fancy_eyecandy.setChecked(
741 settings.value(CARLA_KEY_CANVAS_FANCY_EYE_CANDY, CARLA_DEFAULT_CANVAS_FANCY_EYE_CANDY, bool))
743 self.ui.cb_canvas_use_opengl.setChecked(self.ui.cb_canvas_use_opengl.isEnabled() and
744 settings.value(CARLA_KEY_CANVAS_USE_OPENGL,
745 CARLA_DEFAULT_CANVAS_USE_OPENGL, bool))
747 self.ui.cb_canvas_render_aa.setCheckState(
748 Qt.CheckState(settings.value(CARLA_KEY_CANVAS_ANTIALIASING, CARLA_DEFAULT_CANVAS_ANTIALIASING, int)))
750 self.ui.cb_canvas_render_hq_aa.setChecked(self.ui.cb_canvas_render_hq_aa.isEnabled() and
751 settings.value(CARLA_KEY_CANVAS_HQ_ANTIALIASING,
752 CARLA_DEFAULT_CANVAS_HQ_ANTIALIASING, bool))
754 self.ui.cb_canvas_full_repaints.setChecked(
755 settings.value(CARLA_KEY_CANVAS_FULL_REPAINTS, CARLA_DEFAULT_CANVAS_FULL_REPAINTS, bool))
757 self.ui.cb_canvas_inline_displays.setChecked(
758 settings.value(CARLA_KEY_CANVAS_INLINE_DISPLAYS, CARLA_DEFAULT_CANVAS_INLINE_DISPLAYS, bool))
760 # -------------------------------------------------------------------------------------------------------------
762 settings = QSafeSettings("falkTX", "Carla2")
764 # -------------------------------------------------------------------------------------------------------------
765 # Main
767 self.ui.ch_main_experimental.setChecked(self.host.experimental)
769 if not self.host.experimental:
770 self.ui.lw_page.hideRow(self.TAB_INDEX_EXPERIMENTAL)
771 self.ui.lw_page.hideRow(self.TAB_INDEX_WINE)
773 elif not self.host.showWineBridges:
774 self.ui.lw_page.hideRow(self.TAB_INDEX_WINE)
776 # -------------------------------------------------------------------------------------------------------------
777 # Engine
779 if self.host.isPlugin:
780 audioDriver = "Plugin"
781 self.ui.cb_engine_audio_driver.setCurrentIndex(0)
782 elif self.host.audioDriverForced:
783 audioDriver = self.host.audioDriverForced
784 self.ui.cb_engine_audio_driver.setCurrentIndex(0)
785 else:
786 audioDriver = settings.value(CARLA_KEY_ENGINE_AUDIO_DRIVER, CARLA_DEFAULT_AUDIO_DRIVER, str)
788 for i in range(self.ui.cb_engine_audio_driver.count()):
789 if self.ui.cb_engine_audio_driver.itemText(i) == audioDriver:
790 self.ui.cb_engine_audio_driver.setCurrentIndex(i)
791 break
792 else:
793 self.ui.cb_engine_audio_driver.setCurrentIndex(-1)
795 if audioDriver == "JACK":
796 self.ui.sw_engine_process_mode.setCurrentIndex(0)
797 else:
798 self.ui.sw_engine_process_mode.setCurrentIndex(1)
800 self.ui.tb_engine_driver_config.setEnabled(self.host.audioDriverForced is None and not self.host.isPlugin)
802 self.ui.cb_engine_process_mode_jack.setCurrentIndex(self.host.nextProcessMode)
804 if self.host.nextProcessMode >= self.PROCESS_MODE_NON_JACK_PADDING:
805 self.ui.cb_engine_process_mode_other.setCurrentIndex(self.host.nextProcessMode -
806 self.PROCESS_MODE_NON_JACK_PADDING)
807 else:
808 self.ui.cb_engine_process_mode_other.setCurrentIndex(0)
810 self.ui.sb_engine_max_params.setValue(self.host.maxParameters)
811 self.ui.cb_engine_reset_xruns.setChecked(self.host.resetXruns)
812 self.ui.ch_engine_manage_uis.setChecked(self.host.manageUIs)
813 self.ui.ch_engine_prefer_ui_bridges.setChecked(self.host.preferUIBridges)
814 self.ui.sb_engine_ui_bridges_timeout.setValue(self.host.uiBridgesTimeout)
815 self.ui.ch_engine_force_stereo.setChecked(self.host.forceStereo or
816 not self.ui.ch_engine_force_stereo.isEnabled())
817 self.ui.ch_engine_prefer_plugin_bridges.setChecked(self.host.preferPluginBridges)
818 self.ui.ch_exp_export_lv2.setChecked(self.host.exportLV2)
819 self.ui.cb_exp_plugin_bridges.setChecked(self.host.showPluginBridges)
820 self.ui.ch_exp_wine_bridges.setChecked(self.host.showWineBridges)
822 # -------------------------------------------------------------------------------------------------------------
823 # OSC
825 self.ui.ch_osc_enable.setChecked(
826 settings.value(CARLA_KEY_OSC_ENABLED, CARLA_DEFAULT_OSC_ENABLED, bool))
828 self.ui.group_osc_tcp_port.setChecked(
829 settings.value(CARLA_KEY_OSC_TCP_PORT_ENABLED, CARLA_DEFAULT_OSC_TCP_PORT_ENABLED, bool))
831 self.ui.group_osc_udp_port.setChecked(
832 settings.value(CARLA_KEY_OSC_UDP_PORT_ENABLED, CARLA_DEFAULT_OSC_UDP_PORT_ENABLED, bool))
834 self.ui.sb_osc_tcp_port_number.setValue(
835 settings.value(CARLA_KEY_OSC_TCP_PORT_NUMBER, CARLA_DEFAULT_OSC_TCP_PORT_NUMBER, int))
837 self.ui.sb_osc_udp_port_number.setValue(
838 settings.value(CARLA_KEY_OSC_UDP_PORT_NUMBER, CARLA_DEFAULT_OSC_UDP_PORT_NUMBER, int))
840 if settings.value(CARLA_KEY_OSC_TCP_PORT_RANDOM, CARLA_DEFAULT_OSC_TCP_PORT_RANDOM, bool):
841 self.ui.rb_osc_tcp_port_specific.setChecked(False)
842 self.ui.rb_osc_tcp_port_random.setChecked(True)
843 else:
844 self.ui.rb_osc_tcp_port_random.setChecked(False)
845 self.ui.rb_osc_tcp_port_specific.setChecked(True)
847 if settings.value(CARLA_KEY_OSC_UDP_PORT_RANDOM, CARLA_DEFAULT_OSC_UDP_PORT_RANDOM, bool):
848 self.ui.rb_osc_udp_port_specific.setChecked(False)
849 self.ui.rb_osc_udp_port_random.setChecked(True)
850 else:
851 self.ui.rb_osc_udp_port_random.setChecked(False)
852 self.ui.rb_osc_udp_port_specific.setChecked(True)
854 # -------------------------------------------------------------------------------------------------------------
855 # File Paths
857 audioPaths = settings.value(CARLA_KEY_PATHS_AUDIO, CARLA_DEFAULT_FILE_PATH_AUDIO, list)
858 midiPaths = settings.value(CARLA_KEY_PATHS_MIDI, CARLA_DEFAULT_FILE_PATH_MIDI, list)
860 audioPaths.sort()
861 midiPaths.sort()
863 for audioPath in audioPaths:
864 if not audioPath:
865 continue
866 self.ui.lw_files_audio.addItem(audioPath)
868 for midiPath in midiPaths:
869 if not midiPath:
870 continue
871 self.ui.lw_files_midi.addItem(midiPath)
873 # -------------------------------------------------------------------------------------------------------------
874 # Plugin Paths
876 ladspas = settings.value(CARLA_KEY_PATHS_LADSPA, CARLA_DEFAULT_LADSPA_PATH, list)
877 dssis = settings.value(CARLA_KEY_PATHS_DSSI, CARLA_DEFAULT_DSSI_PATH, list)
878 lv2s = settings.value(CARLA_KEY_PATHS_LV2, CARLA_DEFAULT_LV2_PATH, list)
879 vst2s = settings.value(CARLA_KEY_PATHS_VST2, CARLA_DEFAULT_VST2_PATH, list)
880 vst3s = settings.value(CARLA_KEY_PATHS_VST3, CARLA_DEFAULT_VST3_PATH, list)
881 sf2s = settings.value(CARLA_KEY_PATHS_SF2, CARLA_DEFAULT_SF2_PATH, list)
882 sfzs = settings.value(CARLA_KEY_PATHS_SFZ, CARLA_DEFAULT_SFZ_PATH, list)
883 jsfxs = settings.value(CARLA_KEY_PATHS_JSFX, CARLA_DEFAULT_JSFX_PATH, list)
884 claps = settings.value(CARLA_KEY_PATHS_CLAP, CARLA_DEFAULT_CLAP_PATH, list)
886 ladspas.sort()
887 dssis.sort()
888 lv2s.sort()
889 vst2s.sort()
890 vst3s.sort()
891 sf2s.sort()
892 sfzs.sort()
893 jsfxs.sort()
894 claps.sort()
896 for ladspa in ladspas:
897 if not ladspa:
898 continue
899 self.ui.lw_ladspa.addItem(ladspa)
901 for dssi in dssis:
902 if not dssi:
903 continue
904 self.ui.lw_dssi.addItem(dssi)
906 for lv2 in lv2s:
907 if not lv2:
908 continue
909 self.ui.lw_lv2.addItem(lv2)
911 for vst2 in vst2s:
912 if not vst2:
913 continue
914 self.ui.lw_vst.addItem(vst2)
916 for vst3 in vst3s:
917 if not vst3:
918 continue
919 self.ui.lw_vst3.addItem(vst3)
921 for sf2 in sf2s:
922 if not sf2:
923 continue
924 self.ui.lw_sf2.addItem(sf2)
926 for sfz in sfzs:
927 if not sfz:
928 continue
929 self.ui.lw_sfz.addItem(sfz)
931 for jsfx in jsfxs:
932 if not jsfx:
933 continue
934 self.ui.lw_jsfx.addItem(jsfx)
936 for clap in claps:
937 if not clap:
938 continue
939 self.ui.lw_clap.addItem(clap)
941 # -------------------------------------------------------------------------------------------------------------
942 # Wine
944 self.ui.le_wine_exec.setText(
945 settings.value(CARLA_KEY_WINE_EXECUTABLE, CARLA_DEFAULT_WINE_EXECUTABLE, str))
947 self.ui.cb_wine_prefix_detect.setChecked(
948 settings.value(CARLA_KEY_WINE_AUTO_PREFIX, CARLA_DEFAULT_WINE_AUTO_PREFIX, bool))
950 self.ui.le_wine_prefix_fallback.setText(
951 settings.value(CARLA_KEY_WINE_FALLBACK_PREFIX, CARLA_DEFAULT_WINE_FALLBACK_PREFIX, str))
953 self.ui.group_wine_realtime.setChecked(
954 settings.value(CARLA_KEY_WINE_RT_PRIO_ENABLED, CARLA_DEFAULT_WINE_RT_PRIO_ENABLED, bool))
956 self.ui.sb_wine_base_prio.setValue(
957 settings.value(CARLA_KEY_WINE_BASE_RT_PRIO, CARLA_DEFAULT_WINE_BASE_RT_PRIO, int))
959 self.ui.sb_wine_server_prio.setValue(
960 settings.value(CARLA_KEY_WINE_SERVER_RT_PRIO, CARLA_DEFAULT_WINE_SERVER_RT_PRIO, int))
962 # -------------------------------------------------------------------------------------------------------------
963 # Experimental
965 self.ui.ch_exp_jack_apps.setChecked(
966 settings.value(CARLA_KEY_EXPERIMENTAL_JACK_APPS, CARLA_DEFAULT_EXPERIMENTAL_JACK_APPS, bool))
968 self.ui.ch_exp_export_lv2.setChecked(
969 settings.value(CARLA_KEY_EXPERIMENTAL_EXPORT_LV2, CARLA_DEFAULT_EXPERIMENTAL_LV2_EXPORT, bool))
971 self.ui.ch_exp_load_lib_global.setChecked(
972 settings.value(CARLA_KEY_EXPERIMENTAL_LOAD_LIB_GLOBAL, CARLA_DEFAULT_EXPERIMENTAL_LOAD_LIB_GLOBAL, bool))
974 self.ui.ch_exp_prevent_bad_behaviour.setChecked(
975 settings.value(CARLA_KEY_EXPERIMENTAL_PREVENT_BAD_BEHAVIOUR,
976 CARLA_DEFAULT_EXPERIMENTAL_PREVENT_BAD_BEHAVIOUR, bool))
978 # -----------------------------------------------------------------------------------------------------------------
980 @pyqtSlot()
981 def slot_saveSettings(self):
982 settings = QSafeSettings()
984 self.host.experimental = self.ui.ch_main_experimental.isChecked()
986 if not self.host.experimental:
987 self.resetExperimentalSettings()
989 # -------------------------------------------------------------------------------------------------------------
990 # Main
992 settings.setValue(CARLA_KEY_MAIN_PROJECT_FOLDER, self.ui.le_main_proj_folder.text())
993 settings.setValue(CARLA_KEY_MAIN_CONFIRM_EXIT, self.ui.ch_main_confirm_exit.isChecked())
994 settings.setValue(CARLA_KEY_MAIN_CLASSIC_SKIN, self.ui.cb_main_classic_skin_default.isChecked())
995 settings.setValue(CARLA_KEY_MAIN_USE_PRO_THEME, self.ui.ch_main_theme_pro.isChecked())
996 settings.setValue(CARLA_KEY_MAIN_PRO_THEME_COLOR, self.ui.cb_main_theme_color.currentText())
997 settings.setValue(CARLA_KEY_MAIN_REFRESH_INTERVAL, self.ui.sb_main_refresh_interval.value())
998 settings.setValue(CARLA_KEY_MAIN_SYSTEM_ICONS, self.ui.ch_main_system_icons.isChecked())
1000 # -------------------------------------------------------------------------------------------------------------
1001 # Canvas
1003 settings.setValue(CARLA_KEY_CANVAS_THEME, self.ui.cb_canvas_theme.currentText())
1004 settings.setValue(CARLA_KEY_CANVAS_SIZE, self.ui.cb_canvas_size.currentText())
1005 settings.setValue(CARLA_KEY_CANVAS_USE_BEZIER_LINES, self.ui.cb_canvas_bezier_lines.isChecked())
1006 settings.setValue(CARLA_KEY_CANVAS_AUTO_HIDE_GROUPS, self.ui.cb_canvas_hide_groups.isChecked())
1007 settings.setValue(CARLA_KEY_CANVAS_AUTO_SELECT_ITEMS, self.ui.cb_canvas_auto_select.isChecked())
1008 settings.setValue(CARLA_KEY_CANVAS_EYE_CANDY, self.ui.cb_canvas_eyecandy.isChecked())
1009 settings.setValue(CARLA_KEY_CANVAS_FANCY_EYE_CANDY, self.ui.cb_canvas_fancy_eyecandy.isChecked())
1010 settings.setValue(CARLA_KEY_CANVAS_USE_OPENGL, self.ui.cb_canvas_use_opengl.isChecked())
1011 settings.setValue(CARLA_KEY_CANVAS_HQ_ANTIALIASING, self.ui.cb_canvas_render_hq_aa.isChecked())
1012 # NOTE: checkState() 0, 1, 2 match their enum variants
1013 settings.setValue(CARLA_KEY_CANVAS_ANTIALIASING, self.ui.cb_canvas_render_aa.checkState())
1014 settings.setValue(CARLA_KEY_CANVAS_FULL_REPAINTS, self.ui.cb_canvas_full_repaints.isChecked())
1015 settings.setValue(CARLA_KEY_CANVAS_INLINE_DISPLAYS, self.ui.cb_canvas_inline_displays.isChecked())
1017 # -------------------------------------------------------------------------------------------------------------
1019 settings = QSafeSettings("falkTX", "Carla2")
1021 # -------------------------------------------------------------------------------------------------------------
1022 # Main
1024 settings.setValue(CARLA_KEY_MAIN_EXPERIMENTAL, self.host.experimental)
1026 # -------------------------------------------------------------------------------------------------------------
1027 # Engine
1029 audioDriver = self.ui.cb_engine_audio_driver.currentText()
1031 if audioDriver and self.host.audioDriverForced is None and not self.host.isPlugin:
1032 settings.setValue(CARLA_KEY_ENGINE_AUDIO_DRIVER, audioDriver)
1034 if not self.host.processModeForced:
1035 # engine sends callback if processMode really changes
1036 if audioDriver == "JACK":
1037 self.host.nextProcessMode = self.ui.cb_engine_process_mode_jack.currentIndex()
1038 else:
1039 self.host.nextProcessMode = (self.ui.cb_engine_process_mode_other.currentIndex() +
1040 self.PROCESS_MODE_NON_JACK_PADDING)
1042 settings.setValue(CARLA_KEY_ENGINE_PROCESS_MODE, self.host.nextProcessMode)
1044 self.host.exportLV2 = self.ui.ch_exp_export_lv2.isChecked()
1045 self.host.forceStereo = self.ui.ch_engine_force_stereo.isChecked()
1046 self.host.resetXruns = self.ui.cb_engine_reset_xruns.isChecked()
1047 self.host.maxParameters = self.ui.sb_engine_max_params.value()
1048 self.host.manageUIs = self.ui.ch_engine_manage_uis.isChecked()
1049 self.host.preferPluginBridges = self.ui.ch_engine_prefer_plugin_bridges.isChecked()
1050 self.host.preferUIBridges = self.ui.ch_engine_prefer_ui_bridges.isChecked()
1051 self.host.showLogs = self.ui.ch_main_show_logs.isChecked()
1052 self.host.showPluginBridges = self.ui.cb_exp_plugin_bridges.isChecked()
1053 self.host.showWineBridges = self.ui.ch_exp_wine_bridges.isChecked()
1054 self.host.uiBridgesTimeout = self.ui.sb_engine_ui_bridges_timeout.value()
1055 self.host.uisAlwaysOnTop = self.ui.ch_engine_uis_always_on_top.isChecked()
1057 if self.ui.ch_engine_force_stereo.isEnabled():
1058 settings.setValue(CARLA_KEY_ENGINE_FORCE_STEREO, self.host.forceStereo)
1060 settings.setValue(CARLA_KEY_MAIN_SHOW_LOGS, self.host.showLogs)
1061 settings.setValue(CARLA_KEY_ENGINE_MAX_PARAMETERS, self.host.maxParameters)
1062 settings.setValue(CARLA_KEY_ENGINE_RESET_XRUNS, self.host.resetXruns)
1063 settings.setValue(CARLA_KEY_ENGINE_MANAGE_UIS, self.host.manageUIs)
1064 settings.setValue(CARLA_KEY_ENGINE_PREFER_PLUGIN_BRIDGES, self.host.preferPluginBridges)
1065 settings.setValue(CARLA_KEY_ENGINE_PREFER_UI_BRIDGES, self.host.preferUIBridges)
1066 settings.setValue(CARLA_KEY_ENGINE_UI_BRIDGES_TIMEOUT, self.host.uiBridgesTimeout)
1067 settings.setValue(CARLA_KEY_ENGINE_UIS_ALWAYS_ON_TOP, self.host.uisAlwaysOnTop)
1068 settings.setValue(CARLA_KEY_EXPERIMENTAL_EXPORT_LV2, self.host.exportLV2)
1069 settings.setValue(CARLA_KEY_EXPERIMENTAL_PLUGIN_BRIDGES, self.host.showPluginBridges)
1070 settings.setValue(CARLA_KEY_EXPERIMENTAL_WINE_BRIDGES, self.host.showWineBridges)
1072 # -------------------------------------------------------------------------------------------------------------
1073 # OSC
1075 settings.setValue(CARLA_KEY_OSC_ENABLED, self.ui.ch_osc_enable.isChecked())
1076 settings.setValue(CARLA_KEY_OSC_TCP_PORT_ENABLED, self.ui.group_osc_tcp_port.isChecked())
1077 settings.setValue(CARLA_KEY_OSC_UDP_PORT_ENABLED, self.ui.group_osc_udp_port.isChecked())
1078 settings.setValue(CARLA_KEY_OSC_TCP_PORT_RANDOM, self.ui.rb_osc_tcp_port_random.isChecked())
1079 settings.setValue(CARLA_KEY_OSC_UDP_PORT_RANDOM, self.ui.rb_osc_udp_port_random.isChecked())
1080 settings.setValue(CARLA_KEY_OSC_TCP_PORT_NUMBER, self.ui.sb_osc_tcp_port_number.value())
1081 settings.setValue(CARLA_KEY_OSC_UDP_PORT_NUMBER, self.ui.sb_osc_udp_port_number.value())
1083 # -------------------------------------------------------------------------------------------------------------
1084 # File Paths
1086 audioPaths = []
1087 midiPaths = []
1089 for i in range(self.ui.lw_files_audio.count()):
1090 audioPaths.append(self.ui.lw_files_audio.item(i).text())
1092 for i in range(self.ui.lw_files_midi.count()):
1093 midiPaths.append(self.ui.lw_files_midi.item(i).text())
1095 self.host.set_engine_option(ENGINE_OPTION_FILE_PATH, FILE_AUDIO, splitter.join(audioPaths))
1096 self.host.set_engine_option(ENGINE_OPTION_FILE_PATH, FILE_MIDI, splitter.join(midiPaths))
1098 settings.setValue(CARLA_KEY_PATHS_AUDIO, audioPaths)
1099 settings.setValue(CARLA_KEY_PATHS_MIDI, midiPaths)
1101 # -------------------------------------------------------------------------------------------------------------
1102 # Plugin Paths
1104 ladspas = []
1105 dssis = []
1106 lv2s = []
1107 vst2s = []
1108 vst3s = []
1109 sf2s = []
1110 sfzs = []
1111 jsfxs = []
1112 claps = []
1114 for i in range(self.ui.lw_ladspa.count()):
1115 ladspas.append(self.ui.lw_ladspa.item(i).text())
1117 for i in range(self.ui.lw_dssi.count()):
1118 dssis.append(self.ui.lw_dssi.item(i).text())
1120 for i in range(self.ui.lw_lv2.count()):
1121 lv2s.append(self.ui.lw_lv2.item(i).text())
1123 for i in range(self.ui.lw_vst.count()):
1124 vst2s.append(self.ui.lw_vst.item(i).text())
1126 for i in range(self.ui.lw_vst3.count()):
1127 vst3s.append(self.ui.lw_vst3.item(i).text())
1129 for i in range(self.ui.lw_sf2.count()):
1130 sf2s.append(self.ui.lw_sf2.item(i).text())
1132 for i in range(self.ui.lw_sfz.count()):
1133 sfzs.append(self.ui.lw_sfz.item(i).text())
1135 for i in range(self.ui.lw_jsfx.count()):
1136 jsfxs.append(self.ui.lw_jsfx.item(i).text())
1138 for i in range(self.ui.lw_clap.count()):
1139 claps.append(self.ui.lw_clap.item(i).text())
1141 self.host.set_engine_option(ENGINE_OPTION_PLUGIN_PATH, PLUGIN_LADSPA, splitter.join(ladspas))
1142 self.host.set_engine_option(ENGINE_OPTION_PLUGIN_PATH, PLUGIN_DSSI, splitter.join(dssis))
1143 self.host.set_engine_option(ENGINE_OPTION_PLUGIN_PATH, PLUGIN_LV2, splitter.join(lv2s))
1144 self.host.set_engine_option(ENGINE_OPTION_PLUGIN_PATH, PLUGIN_VST2, splitter.join(vst2s))
1145 self.host.set_engine_option(ENGINE_OPTION_PLUGIN_PATH, PLUGIN_VST3, splitter.join(vst3s))
1146 self.host.set_engine_option(ENGINE_OPTION_PLUGIN_PATH, PLUGIN_SF2, splitter.join(sf2s))
1147 self.host.set_engine_option(ENGINE_OPTION_PLUGIN_PATH, PLUGIN_SFZ, splitter.join(sfzs))
1148 self.host.set_engine_option(ENGINE_OPTION_PLUGIN_PATH, PLUGIN_JSFX, splitter.join(jsfxs))
1149 self.host.set_engine_option(ENGINE_OPTION_PLUGIN_PATH, PLUGIN_CLAP, splitter.join(claps))
1151 settings.setValue(CARLA_KEY_PATHS_LADSPA, ladspas)
1152 settings.setValue(CARLA_KEY_PATHS_DSSI, dssis)
1153 settings.setValue(CARLA_KEY_PATHS_LV2, lv2s)
1154 settings.setValue(CARLA_KEY_PATHS_VST2, vst2s)
1155 settings.setValue(CARLA_KEY_PATHS_VST3, vst3s)
1156 settings.setValue(CARLA_KEY_PATHS_SF2, sf2s)
1157 settings.setValue(CARLA_KEY_PATHS_SFZ, sfzs)
1158 settings.setValue(CARLA_KEY_PATHS_JSFX, jsfxs)
1159 settings.setValue(CARLA_KEY_PATHS_CLAP, claps)
1161 # -------------------------------------------------------------------------------------------------------------
1162 # Wine
1164 settings.setValue(CARLA_KEY_WINE_EXECUTABLE, self.ui.le_wine_exec.text())
1165 settings.setValue(CARLA_KEY_WINE_AUTO_PREFIX, self.ui.cb_wine_prefix_detect.isChecked())
1166 settings.setValue(CARLA_KEY_WINE_FALLBACK_PREFIX, self.ui.le_wine_prefix_fallback.text())
1167 settings.setValue(CARLA_KEY_WINE_RT_PRIO_ENABLED, self.ui.group_wine_realtime.isChecked())
1168 settings.setValue(CARLA_KEY_WINE_BASE_RT_PRIO, self.ui.sb_wine_base_prio.value())
1169 settings.setValue(CARLA_KEY_WINE_SERVER_RT_PRIO, self.ui.sb_wine_server_prio.value())
1171 # -------------------------------------------------------------------------------------------------------------
1172 # Experimental
1174 settings.setValue(CARLA_KEY_EXPERIMENTAL_JACK_APPS, self.ui.ch_exp_jack_apps.isChecked())
1175 settings.setValue(CARLA_KEY_EXPERIMENTAL_LOAD_LIB_GLOBAL, self.ui.ch_exp_load_lib_global.isChecked())
1176 settings.setValue(CARLA_KEY_EXPERIMENTAL_PREVENT_BAD_BEHAVIOUR,
1177 self.ui.ch_exp_prevent_bad_behaviour.isChecked())
1179 # -----------------------------------------------------------------------------------------------------------------
1181 @pyqtSlot()
1182 def slot_resetSettings(self):
1183 currentRow = self.ui.lw_page.currentRow()
1185 # -------------------------------------------------------------------------------------------------------------
1186 # Main
1188 if currentRow == self.TAB_INDEX_MAIN:
1189 self.ui.le_main_proj_folder.setText(CARLA_DEFAULT_MAIN_PROJECT_FOLDER)
1190 self.ui.ch_main_theme_pro.setChecked(CARLA_DEFAULT_MAIN_USE_PRO_THEME and
1191 self.ui.group_main_theme.isEnabled())
1192 self.ui.cb_main_theme_color.setCurrentIndex(
1193 self.ui.cb_main_theme_color.findText(CARLA_DEFAULT_MAIN_PRO_THEME_COLOR))
1194 self.ui.sb_main_refresh_interval.setValue(CARLA_DEFAULT_MAIN_REFRESH_INTERVAL)
1195 self.ui.ch_main_confirm_exit.setChecked(CARLA_DEFAULT_MAIN_CONFIRM_EXIT)
1196 self.ui.cb_main_classic_skin_default(CARLA_DEFAULT_MAIN_CLASSIC_SKIN)
1197 self.ui.ch_main_show_logs.setChecked(CARLA_DEFAULT_MAIN_SHOW_LOGS)
1199 # -------------------------------------------------------------------------------------------------------------
1200 # Canvas
1202 elif currentRow == self.TAB_INDEX_CANVAS:
1203 self.ui.cb_canvas_theme.setCurrentIndex(self.ui.cb_canvas_theme.findText(CARLA_DEFAULT_CANVAS_THEME))
1204 self.ui.cb_canvas_size.setCurrentIndex(self.ui.cb_canvas_size.findText(CARLA_DEFAULT_CANVAS_SIZE))
1205 self.ui.cb_canvas_bezier_lines.setChecked(CARLA_DEFAULT_CANVAS_USE_BEZIER_LINES)
1206 self.ui.cb_canvas_hide_groups.setChecked(CARLA_DEFAULT_CANVAS_AUTO_HIDE_GROUPS)
1207 self.ui.cb_canvas_auto_select.setChecked(CARLA_DEFAULT_CANVAS_AUTO_SELECT_ITEMS)
1208 self.ui.cb_canvas_eyecandy.setChecked(CARLA_DEFAULT_CANVAS_EYE_CANDY and self.ui.cb_canvas_eyecandy.isEnabled())
1209 self.ui.cb_canvas_render_aa.setCheckState(Qt.PartiallyChecked) # CARLA_DEFAULT_CANVAS_ANTIALIASING
1210 self.ui.cb_canvas_full_repaints.setChecked(CARLA_DEFAULT_CANVAS_FULL_REPAINTS)
1212 # -------------------------------------------------------------------------------------------------------------
1213 # Engine
1215 elif currentRow == self.TAB_INDEX_ENGINE:
1216 if not self.host.isPlugin:
1217 self.ui.cb_engine_audio_driver.setCurrentIndex(0)
1219 if not self.host.processModeForced:
1220 if self.ui.cb_engine_audio_driver.currentText() == "JACK":
1221 self.ui.cb_engine_process_mode_jack.setCurrentIndex(CARLA_DEFAULT_PROCESS_MODE)
1222 self.ui.sw_engine_process_mode.setCurrentIndex(0) # show all modes
1223 else:
1224 self.ui.cb_engine_process_mode_other.setCurrentIndex(CARLA_DEFAULT_PROCESS_MODE -
1225 self.PROCESS_MODE_NON_JACK_PADDING)
1226 self.ui.sw_engine_process_mode.setCurrentIndex(1) # hide single+multi client modes
1228 self.ui.sb_engine_max_params.setValue(CARLA_DEFAULT_MAX_PARAMETERS)
1229 self.ui.cb_engine_reset_xruns.setChecked(CARLA_DEFAULT_RESET_XRUNS)
1230 self.ui.ch_engine_uis_always_on_top.setChecked(CARLA_DEFAULT_UIS_ALWAYS_ON_TOP)
1231 self.ui.ch_engine_prefer_ui_bridges.setChecked(CARLA_DEFAULT_PREFER_UI_BRIDGES)
1232 self.ui.sb_engine_ui_bridges_timeout.setValue(CARLA_DEFAULT_UI_BRIDGES_TIMEOUT)
1233 self.ui.ch_engine_manage_uis.setChecked(CARLA_DEFAULT_MANAGE_UIS)
1235 # -------------------------------------------------------------------------------------------------------------
1236 # OSC
1238 elif currentRow == self.TAB_INDEX_OSC:
1239 self.ui.ch_osc_enable.setChecked(CARLA_DEFAULT_OSC_ENABLED)
1240 self.ui.group_osc_tcp_port.setChecked(CARLA_DEFAULT_OSC_TCP_PORT_ENABLED)
1241 self.ui.group_osc_udp_port.setChecked(CARLA_DEFAULT_OSC_UDP_PORT_ENABLED)
1242 self.ui.sb_osc_tcp_port_number.setValue(CARLA_DEFAULT_OSC_TCP_PORT_NUMBER)
1243 self.ui.sb_osc_udp_port_number.setValue(CARLA_DEFAULT_OSC_UDP_PORT_NUMBER)
1245 if CARLA_DEFAULT_OSC_TCP_PORT_RANDOM:
1246 self.ui.rb_osc_tcp_port_specific.setChecked(False)
1247 self.ui.rb_osc_tcp_port_random.setChecked(True)
1248 else:
1249 self.ui.rb_osc_tcp_port_random.setChecked(False)
1250 self.ui.rb_osc_tcp_port_specific.setChecked(True)
1252 if CARLA_DEFAULT_OSC_UDP_PORT_RANDOM:
1253 self.ui.rb_osc_udp_port_specific.setChecked(False)
1254 self.ui.rb_osc_udp_port_random.setChecked(True)
1255 else:
1256 self.ui.rb_osc_udp_port_random.setChecked(False)
1257 self.ui.rb_osc_udp_port_specific.setChecked(True)
1259 # -------------------------------------------------------------------------------------------------------------
1260 # Plugin Paths
1262 elif currentRow == self.TAB_INDEX_FILEPATHS:
1263 curIndex = self.ui.tw_filepaths.currentIndex()
1265 if curIndex == self.FILEPATH_INDEX_AUDIO:
1266 self.ui.lw_files_audio.clear()
1268 elif curIndex == self.FILEPATH_INDEX_MIDI:
1269 self.ui.lw_files_midi.clear()
1271 # -------------------------------------------------------------------------------------------------------------
1272 # Plugin Paths
1274 elif currentRow == self.TAB_INDEX_PLUGINPATHS:
1275 curIndex = self.ui.tw_paths.currentIndex()
1277 if curIndex == self.PLUGINPATH_INDEX_LADSPA:
1278 paths = CARLA_DEFAULT_LADSPA_PATH
1279 paths.sort()
1280 self.ui.lw_ladspa.clear()
1282 for path in paths:
1283 if not path:
1284 continue
1285 self.ui.lw_ladspa.addItem(path)
1287 elif curIndex == self.PLUGINPATH_INDEX_DSSI:
1288 paths = CARLA_DEFAULT_DSSI_PATH
1289 paths.sort()
1290 self.ui.lw_dssi.clear()
1292 for path in paths:
1293 if not path:
1294 continue
1295 self.ui.lw_dssi.addItem(path)
1297 elif curIndex == self.PLUGINPATH_INDEX_LV2:
1298 paths = CARLA_DEFAULT_LV2_PATH
1299 paths.sort()
1300 self.ui.lw_lv2.clear()
1302 for path in paths:
1303 if not path:
1304 continue
1305 self.ui.lw_lv2.addItem(path)
1307 elif curIndex == self.PLUGINPATH_INDEX_VST2:
1308 paths = CARLA_DEFAULT_VST2_PATH
1309 paths.sort()
1310 self.ui.lw_vst.clear()
1312 for path in paths:
1313 if not path:
1314 continue
1315 self.ui.lw_vst.addItem(path)
1317 elif curIndex == self.PLUGINPATH_INDEX_VST3:
1318 paths = CARLA_DEFAULT_VST3_PATH
1319 paths.sort()
1320 self.ui.lw_vst3.clear()
1322 for path in paths:
1323 if not path:
1324 continue
1325 self.ui.lw_vst3.addItem(path)
1327 elif curIndex == self.PLUGINPATH_INDEX_SF2:
1328 paths = CARLA_DEFAULT_SF2_PATH
1329 paths.sort()
1330 self.ui.lw_sf2.clear()
1332 for path in paths:
1333 if not path:
1334 continue
1335 self.ui.lw_sf2.addItem(path)
1337 elif curIndex == self.PLUGINPATH_INDEX_SFZ:
1338 paths = CARLA_DEFAULT_SFZ_PATH
1339 paths.sort()
1340 self.ui.lw_sfz.clear()
1342 for path in paths:
1343 if not path:
1344 continue
1345 self.ui.lw_sfz.addItem(path)
1347 elif curIndex == self.PLUGINPATH_INDEX_JSFX:
1348 paths = CARLA_DEFAULT_JSFX_PATH
1349 paths.sort()
1350 self.ui.lw_jsfx.clear()
1352 for path in paths:
1353 if not path:
1354 continue
1355 self.ui.lw_jsfx.addItem(path)
1357 elif curIndex == self.PLUGINPATH_INDEX_CLAP:
1358 paths = CARLA_DEFAULT_CLAP_PATH
1359 paths.sort()
1360 self.ui.lw_clap.clear()
1362 for path in paths:
1363 if not path:
1364 continue
1365 self.ui.lw_clap.addItem(path)
1367 # -------------------------------------------------------------------------------------------------------------
1368 # Wine
1370 elif currentRow == self.TAB_INDEX_WINE:
1371 self.ui.le_wine_exec.setText(CARLA_DEFAULT_WINE_EXECUTABLE)
1372 self.ui.cb_wine_prefix_detect.setChecked(CARLA_DEFAULT_WINE_AUTO_PREFIX)
1373 self.ui.le_wine_prefix_fallback.setText(CARLA_DEFAULT_WINE_FALLBACK_PREFIX)
1374 self.ui.group_wine_realtime.setChecked(CARLA_DEFAULT_WINE_RT_PRIO_ENABLED)
1375 self.ui.sb_wine_base_prio.setValue(CARLA_DEFAULT_WINE_BASE_RT_PRIO)
1376 self.ui.sb_wine_server_prio.setValue(CARLA_DEFAULT_WINE_SERVER_RT_PRIO)
1378 # -------------------------------------------------------------------------------------------------------------
1379 # Experimental
1381 elif currentRow == self.TAB_INDEX_EXPERIMENTAL:
1382 self.resetExperimentalSettings()
1384 def resetExperimentalSettings(self):
1385 # Forever experimental
1386 self.ui.cb_exp_plugin_bridges.setChecked(CARLA_DEFAULT_EXPERIMENTAL_PLUGIN_BRIDGES)
1387 self.ui.ch_exp_wine_bridges.setChecked(CARLA_DEFAULT_EXPERIMENTAL_WINE_BRIDGES)
1388 self.ui.ch_exp_jack_apps.setChecked(CARLA_DEFAULT_EXPERIMENTAL_JACK_APPS)
1389 self.ui.ch_exp_export_lv2.setChecked(CARLA_DEFAULT_EXPERIMENTAL_LV2_EXPORT)
1390 self.ui.ch_exp_load_lib_global.setChecked(CARLA_DEFAULT_EXPERIMENTAL_LOAD_LIB_GLOBAL)
1391 self.ui.ch_exp_prevent_bad_behaviour.setChecked(CARLA_DEFAULT_EXPERIMENTAL_PREVENT_BAD_BEHAVIOUR)
1393 # Temporary, until stable
1394 self.ui.ch_main_system_icons.setChecked(CARLA_DEFAULT_MAIN_SYSTEM_ICONS)
1395 self.ui.cb_canvas_fancy_eyecandy.setChecked(CARLA_DEFAULT_CANVAS_FANCY_EYE_CANDY)
1396 self.ui.cb_canvas_use_opengl.setChecked(CARLA_DEFAULT_CANVAS_USE_OPENGL and
1397 self.ui.cb_canvas_use_opengl.isEnabled())
1398 self.ui.cb_canvas_render_hq_aa.setChecked(CARLA_DEFAULT_CANVAS_HQ_ANTIALIASING and
1399 self.ui.cb_canvas_render_hq_aa.isEnabled())
1400 self.ui.cb_canvas_inline_displays.setChecked(CARLA_DEFAULT_CANVAS_INLINE_DISPLAYS)
1401 self.ui.ch_engine_force_stereo.setChecked(CARLA_DEFAULT_FORCE_STEREO)
1402 self.ui.ch_engine_prefer_plugin_bridges.setChecked(CARLA_DEFAULT_PREFER_PLUGIN_BRIDGES)
1404 # -----------------------------------------------------------------------------------------------------------------
1406 @pyqtSlot(bool)
1407 def slot_enableExperimental(self, toggled):
1408 if toggled:
1409 self.ui.lw_page.showRow(self.TAB_INDEX_EXPERIMENTAL)
1410 if self.ui.ch_exp_wine_bridges.isChecked() and not self.host.isControl:
1411 self.ui.lw_page.showRow(self.TAB_INDEX_WINE)
1412 else:
1413 self.ui.lw_page.hideRow(self.TAB_INDEX_EXPERIMENTAL)
1414 self.ui.lw_page.hideRow(self.TAB_INDEX_WINE)
1416 @pyqtSlot(bool)
1417 def slot_enableWineBridges(self, toggled):
1418 if toggled and not self.host.isControl:
1419 self.ui.lw_page.showRow(self.TAB_INDEX_WINE)
1420 else:
1421 self.ui.lw_page.hideRow(self.TAB_INDEX_WINE)
1423 @pyqtSlot(bool)
1424 def slot_pluginBridgesToggled(self, toggled):
1425 if not toggled:
1426 self.ui.ch_exp_wine_bridges.setChecked(False)
1427 self.ui.ch_engine_prefer_plugin_bridges.setChecked(False)
1428 self.ui.lw_page.hideRow(self.TAB_INDEX_WINE)
1430 @pyqtSlot(bool)
1431 def slot_canvasEyeCandyToggled(self, toggled):
1432 if not toggled:
1433 # disable fancy eyecandy too
1434 self.ui.cb_canvas_fancy_eyecandy.setChecked(False)
1436 @pyqtSlot(bool)
1437 def slot_canvasFancyEyeCandyToggled(self, toggled):
1438 if toggled:
1439 # make sure normal eyecandy is enabled too
1440 self.ui.cb_canvas_eyecandy.setChecked(True)
1442 @pyqtSlot(bool)
1443 def slot_canvasOpenGLToggled(self, toggled):
1444 if not toggled:
1445 # uncheck GL specific option
1446 self.ui.cb_canvas_render_hq_aa.setChecked(False)
1448 # -----------------------------------------------------------------------------------------------------------------
1450 @pyqtSlot()
1451 def slot_getAndSetProjectPath(self):
1452 # FIXME
1453 getAndSetPath(self, self.ui.le_main_proj_folder)
1455 # -----------------------------------------------------------------------------------------------------------------
1457 @pyqtSlot()
1458 def slot_engineAudioDriverChanged(self):
1459 if self.ui.cb_engine_audio_driver.currentText() == "JACK":
1460 self.ui.sw_engine_process_mode.setCurrentIndex(0)
1461 else:
1462 self.ui.sw_engine_process_mode.setCurrentIndex(1)
1464 @pyqtSlot()
1465 def slot_showAudioDriverSettings(self):
1466 driverIndex = self.ui.cb_engine_audio_driver.currentIndex()
1467 driverName = self.ui.cb_engine_audio_driver.currentText()
1468 DriverSettingsW(self, self.host, driverIndex, driverName).exec_()
1470 # -----------------------------------------------------------------------------------------------------------------
1472 @pyqtSlot()
1473 def slot_addPluginPath(self):
1474 newPath = QFileDialog.getExistingDirectory(self, self.tr("Add Path"), "", QFileDialog.ShowDirsOnly)
1476 if not newPath:
1477 return
1479 curIndex = self.ui.tw_paths.currentIndex()
1481 if curIndex == self.PLUGINPATH_INDEX_LADSPA:
1482 self.ui.lw_ladspa.addItem(newPath)
1483 elif curIndex == self.PLUGINPATH_INDEX_DSSI:
1484 self.ui.lw_dssi.addItem(newPath)
1485 elif curIndex == self.PLUGINPATH_INDEX_LV2:
1486 self.ui.lw_lv2.addItem(newPath)
1487 elif curIndex == self.PLUGINPATH_INDEX_VST2:
1488 self.ui.lw_vst.addItem(newPath)
1489 elif curIndex == self.PLUGINPATH_INDEX_VST3:
1490 self.ui.lw_vst3.addItem(newPath)
1491 elif curIndex == self.PLUGINPATH_INDEX_SF2:
1492 self.ui.lw_sf2.addItem(newPath)
1493 elif curIndex == self.PLUGINPATH_INDEX_SFZ:
1494 self.ui.lw_sfz.addItem(newPath)
1495 elif curIndex == self.PLUGINPATH_INDEX_JSFX:
1496 self.ui.lw_jsfx.addItem(newPath)
1497 elif curIndex == self.PLUGINPATH_INDEX_CLAP:
1498 self.ui.lw_clap.addItem(newPath)
1500 @pyqtSlot()
1501 def slot_removePluginPath(self):
1502 curIndex = self.ui.tw_paths.currentIndex()
1504 if curIndex == self.PLUGINPATH_INDEX_LADSPA:
1505 self.ui.lw_ladspa.takeItem(self.ui.lw_ladspa.currentRow())
1506 elif curIndex == self.PLUGINPATH_INDEX_DSSI:
1507 self.ui.lw_dssi.takeItem(self.ui.lw_dssi.currentRow())
1508 elif curIndex == self.PLUGINPATH_INDEX_LV2:
1509 self.ui.lw_lv2.takeItem(self.ui.lw_lv2.currentRow())
1510 elif curIndex == self.PLUGINPATH_INDEX_VST2:
1511 self.ui.lw_vst.takeItem(self.ui.lw_vst.currentRow())
1512 elif curIndex == self.PLUGINPATH_INDEX_VST3:
1513 self.ui.lw_vst3.takeItem(self.ui.lw_vst3.currentRow())
1514 elif curIndex == self.PLUGINPATH_INDEX_SF2:
1515 self.ui.lw_sf2.takeItem(self.ui.lw_sf2.currentRow())
1516 elif curIndex == self.PLUGINPATH_INDEX_SFZ:
1517 self.ui.lw_sfz.takeItem(self.ui.lw_sfz.currentRow())
1518 elif curIndex == self.PLUGINPATH_INDEX_JSFX:
1519 self.ui.lw_jsfx.takeItem(self.ui.lw_jsfx.currentRow())
1520 elif curIndex == self.PLUGINPATH_INDEX_CLAP:
1521 self.ui.lw_clap.takeItem(self.ui.lw_clap.currentRow())
1523 @pyqtSlot()
1524 def slot_changePluginPath(self):
1525 curIndex = self.ui.tw_paths.currentIndex()
1527 if curIndex == self.PLUGINPATH_INDEX_LADSPA:
1528 currentPath = self.ui.lw_ladspa.currentItem().text()
1529 elif curIndex == self.PLUGINPATH_INDEX_DSSI:
1530 currentPath = self.ui.lw_dssi.currentItem().text()
1531 elif curIndex == self.PLUGINPATH_INDEX_LV2:
1532 currentPath = self.ui.lw_lv2.currentItem().text()
1533 elif curIndex == self.PLUGINPATH_INDEX_VST2:
1534 currentPath = self.ui.lw_vst.currentItem().text()
1535 elif curIndex == self.PLUGINPATH_INDEX_VST3:
1536 currentPath = self.ui.lw_vst3.currentItem().text()
1537 elif curIndex == self.PLUGINPATH_INDEX_SF2:
1538 currentPath = self.ui.lw_sf2.currentItem().text()
1539 elif curIndex == self.PLUGINPATH_INDEX_SFZ:
1540 currentPath = self.ui.lw_sfz.currentItem().text()
1541 elif curIndex == self.PLUGINPATH_INDEX_JSFX:
1542 currentPath = self.ui.lw_jsfx.currentItem().text()
1543 elif curIndex == self.PLUGINPATH_INDEX_CLAP:
1544 currentPath = self.ui.lw_clap.currentItem().text()
1545 else:
1546 currentPath = ""
1548 newPath = QFileDialog.getExistingDirectory(self, self.tr("Add Path"), currentPath, QFileDialog.ShowDirsOnly)
1550 if not newPath:
1551 return
1553 if curIndex == self.PLUGINPATH_INDEX_LADSPA:
1554 self.ui.lw_ladspa.currentItem().setText(newPath)
1555 elif curIndex == self.PLUGINPATH_INDEX_DSSI:
1556 self.ui.lw_dssi.currentItem().setText(newPath)
1557 elif curIndex == self.PLUGINPATH_INDEX_LV2:
1558 self.ui.lw_lv2.currentItem().setText(newPath)
1559 elif curIndex == self.PLUGINPATH_INDEX_VST2:
1560 self.ui.lw_vst.currentItem().setText(newPath)
1561 elif curIndex == self.PLUGINPATH_INDEX_VST3:
1562 self.ui.lw_vst3.currentItem().setText(newPath)
1563 elif curIndex == self.PLUGINPATH_INDEX_SF2:
1564 self.ui.lw_sf2.currentItem().setText(newPath)
1565 elif curIndex == self.PLUGINPATH_INDEX_SFZ:
1566 self.ui.lw_sfz.currentItem().setText(newPath)
1567 elif curIndex == self.PLUGINPATH_INDEX_JSFX:
1568 self.ui.lw_jsfx.currentItem().setText(newPath)
1569 elif curIndex == self.PLUGINPATH_INDEX_CLAP:
1570 self.ui.lw_clap.currentItem().setText(newPath)
1572 # -----------------------------------------------------------------------------------------------------------------
1574 @pyqtSlot(int)
1575 def slot_pluginPathTabChanged(self, index):
1576 if index == self.PLUGINPATH_INDEX_LADSPA:
1577 row = self.ui.lw_ladspa.currentRow()
1578 elif index == self.PLUGINPATH_INDEX_DSSI:
1579 row = self.ui.lw_dssi.currentRow()
1580 elif index == self.PLUGINPATH_INDEX_LV2:
1581 row = self.ui.lw_lv2.currentRow()
1582 elif index == self.PLUGINPATH_INDEX_VST2:
1583 row = self.ui.lw_vst.currentRow()
1584 elif index == self.PLUGINPATH_INDEX_VST3:
1585 row = self.ui.lw_vst3.currentRow()
1586 elif index == self.PLUGINPATH_INDEX_SF2:
1587 row = self.ui.lw_sf2.currentRow()
1588 elif index == self.PLUGINPATH_INDEX_SFZ:
1589 row = self.ui.lw_sfz.currentRow()
1590 elif index == self.PLUGINPATH_INDEX_JSFX:
1591 row = self.ui.lw_jsfx.currentRow()
1592 elif index == self.PLUGINPATH_INDEX_CLAP:
1593 row = self.ui.lw_clap.currentRow()
1594 else:
1595 row = -1
1597 self.slot_pluginPathRowChanged(row)
1599 @pyqtSlot(int)
1600 def slot_pluginPathRowChanged(self, row):
1601 check = bool(row >= 0)
1602 self.ui.b_paths_remove.setEnabled(check)
1603 self.ui.b_paths_change.setEnabled(check)
1605 # -----------------------------------------------------------------------------------------------------------------
1607 @pyqtSlot()
1608 def slot_addFilePath(self):
1609 newPath = QFileDialog.getExistingDirectory(self, self.tr("Add Path"), "", QFileDialog.ShowDirsOnly)
1611 if not newPath:
1612 return
1614 curIndex = self.ui.tw_filepaths.currentIndex()
1616 if curIndex == self.FILEPATH_INDEX_AUDIO:
1617 self.ui.lw_files_audio.addItem(newPath)
1618 elif curIndex == self.FILEPATH_INDEX_MIDI:
1619 self.ui.lw_files_midi.addItem(newPath)
1621 @pyqtSlot()
1622 def slot_removeFilePath(self):
1623 curIndex = self.ui.tw_filepaths.currentIndex()
1625 if curIndex == self.FILEPATH_INDEX_AUDIO:
1626 self.ui.lw_files_audio.takeItem(self.ui.lw_files_audio.currentRow())
1627 elif curIndex == self.FILEPATH_INDEX_MIDI:
1628 self.ui.lw_files_midi.takeItem(self.ui.lw_files_midi.currentRow())
1630 @pyqtSlot()
1631 def slot_changeFilePath(self):
1632 curIndex = self.ui.tw_filepaths.currentIndex()
1634 if curIndex == self.FILEPATH_INDEX_AUDIO:
1635 currentPath = self.ui.lw_files_audio.currentItem().text()
1636 elif curIndex == self.FILEPATH_INDEX_MIDI:
1637 currentPath = self.ui.lw_files_midi.currentItem().text()
1638 else:
1639 currentPath = ""
1641 newPath = QFileDialog.getExistingDirectory(self, self.tr("Add Path"), currentPath, QFileDialog.ShowDirsOnly)
1643 if not newPath:
1644 return
1646 if curIndex == self.FILEPATH_INDEX_AUDIO:
1647 self.ui.lw_files_audio.currentItem().setText(newPath)
1648 elif curIndex == self.FILEPATH_INDEX_MIDI:
1649 self.ui.lw_files_midi.currentItem().setText(newPath)
1651 # -----------------------------------------------------------------------------------------------------------------
1653 @pyqtSlot(int)
1654 def slot_filePathTabChanged(self, index):
1655 if index == self.FILEPATH_INDEX_AUDIO:
1656 row = self.ui.lw_files_audio.currentRow()
1657 elif index == self.FILEPATH_INDEX_MIDI:
1658 row = self.ui.lw_files_midi.currentRow()
1659 else:
1660 row = -1
1662 self.slot_filePathRowChanged(row)
1664 @pyqtSlot(int)
1665 def slot_filePathRowChanged(self, row):
1666 check = bool(row >= 0)
1667 self.ui.b_filepaths_remove.setEnabled(check)
1668 self.ui.b_filepaths_change.setEnabled(check)
1670 # ---------------------------------------------------------------------------------------------------------------------
1671 # Main
1673 if __name__ == '__main__':
1674 from carla_app import CarlaApplication
1675 from carla_host import initHost as _initHost, loadHostSettings as _loadHostSettings
1676 # pylint: disable=ungrouped-imports
1677 from carla_shared import handleInitialCommandLineArguments
1678 # pylint: enable=ungrouped-imports
1680 initName, libPrefix = handleInitialCommandLineArguments(__file__ if "__file__" in dir() else None)
1682 _app = CarlaApplication("Carla2-Settings", libPrefix)
1683 _host = _initHost("Carla2-Settings", libPrefix, False, False, False)
1684 _loadHostSettings(_host)
1686 _gui = CarlaSettingsW(None, _host, True, True)
1687 _gui.show()
1689 _app.exit_exec()
1691 # ---------------------------------------------------------------------------------------------------------------------