Audio plugin host https://kx.studio/carla
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

carla_settings.py 69KB

11 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
11 years ago
10 years ago
10 years ago
9 years ago
9 years ago
10 years ago
9 years ago
9 years ago
7 years ago
9 years ago
9 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
10 years ago
10 years ago
9 years ago
10 years ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584
  1. #!/usr/bin/env python3
  2. # -*- coding: utf-8 -*-
  3. # Carla settings code
  4. # Copyright (C) 2011-2021 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 (PyQt5)
  19. from PyQt5.QtCore import pyqtSlot, QT_VERSION, Qt
  20. from PyQt5.QtWidgets import QDialog, QDialogButtonBox, QFileDialog
  21. # ---------------------------------------------------------------------------------------------------------------------
  22. # Imports (Custom)
  23. import ui_carla_settings
  24. import ui_carla_settings_driver
  25. from carla_backend import (
  26. LINUX, MACOS, WINDOWS,
  27. ENGINE_DRIVER_DEVICE_HAS_CONTROL_PANEL,
  28. ENGINE_DRIVER_DEVICE_CAN_TRIPLE_BUFFER,
  29. ENGINE_DRIVER_DEVICE_VARIABLE_BUFFER_SIZE,
  30. ENGINE_DRIVER_DEVICE_VARIABLE_SAMPLE_RATE,
  31. ENGINE_PROCESS_MODE_CONTINUOUS_RACK,
  32. ENGINE_OPTION_FILE_PATH,
  33. ENGINE_OPTION_PLUGIN_PATH,
  34. FILE_AUDIO,
  35. FILE_MIDI,
  36. PLUGIN_LADSPA,
  37. PLUGIN_DSSI,
  38. PLUGIN_LV2,
  39. PLUGIN_VST2,
  40. PLUGIN_VST3,
  41. PLUGIN_SF2,
  42. PLUGIN_SFZ
  43. )
  44. from carla_shared import (
  45. CARLA_KEY_MAIN_PROJECT_FOLDER,
  46. CARLA_KEY_MAIN_USE_PRO_THEME,
  47. CARLA_KEY_MAIN_PRO_THEME_COLOR,
  48. CARLA_KEY_MAIN_REFRESH_INTERVAL,
  49. CARLA_KEY_MAIN_CONFIRM_EXIT,
  50. CARLA_KEY_MAIN_CLASSIC_SKIN,
  51. CARLA_KEY_MAIN_SHOW_LOGS,
  52. CARLA_KEY_MAIN_SYSTEM_ICONS,
  53. CARLA_KEY_MAIN_EXPERIMENTAL,
  54. CARLA_KEY_CANVAS_THEME,
  55. CARLA_KEY_CANVAS_SIZE,
  56. CARLA_KEY_CANVAS_USE_BEZIER_LINES,
  57. CARLA_KEY_CANVAS_AUTO_HIDE_GROUPS,
  58. CARLA_KEY_CANVAS_AUTO_SELECT_ITEMS,
  59. CARLA_KEY_CANVAS_EYE_CANDY,
  60. CARLA_KEY_CANVAS_FANCY_EYE_CANDY,
  61. CARLA_KEY_CANVAS_USE_OPENGL,
  62. CARLA_KEY_CANVAS_ANTIALIASING,
  63. CARLA_KEY_CANVAS_HQ_ANTIALIASING,
  64. CARLA_KEY_CANVAS_INLINE_DISPLAYS,
  65. CARLA_KEY_CANVAS_FULL_REPAINTS,
  66. CARLA_KEY_ENGINE_DRIVER_PREFIX,
  67. CARLA_KEY_ENGINE_AUDIO_DRIVER,
  68. CARLA_KEY_ENGINE_PROCESS_MODE,
  69. CARLA_KEY_ENGINE_FORCE_STEREO,
  70. CARLA_KEY_ENGINE_PREFER_PLUGIN_BRIDGES,
  71. CARLA_KEY_ENGINE_PREFER_UI_BRIDGES,
  72. CARLA_KEY_ENGINE_MANAGE_UIS,
  73. CARLA_KEY_ENGINE_UIS_ALWAYS_ON_TOP,
  74. CARLA_KEY_ENGINE_MAX_PARAMETERS,
  75. CARLA_KEY_ENGINE_RESET_XRUNS,
  76. CARLA_KEY_ENGINE_UI_BRIDGES_TIMEOUT,
  77. CARLA_KEY_OSC_ENABLED,
  78. CARLA_KEY_OSC_TCP_PORT_ENABLED,
  79. CARLA_KEY_OSC_TCP_PORT_NUMBER,
  80. CARLA_KEY_OSC_TCP_PORT_RANDOM,
  81. CARLA_KEY_OSC_UDP_PORT_ENABLED,
  82. CARLA_KEY_OSC_UDP_PORT_NUMBER,
  83. CARLA_KEY_OSC_UDP_PORT_RANDOM,
  84. CARLA_KEY_PATHS_AUDIO,
  85. CARLA_KEY_PATHS_MIDI,
  86. CARLA_KEY_PATHS_LADSPA,
  87. CARLA_KEY_PATHS_DSSI,
  88. CARLA_KEY_PATHS_LV2,
  89. CARLA_KEY_PATHS_VST2,
  90. CARLA_KEY_PATHS_VST3,
  91. CARLA_KEY_PATHS_SF2,
  92. CARLA_KEY_PATHS_SFZ,
  93. CARLA_KEY_WINE_EXECUTABLE,
  94. CARLA_KEY_WINE_AUTO_PREFIX,
  95. CARLA_KEY_WINE_FALLBACK_PREFIX,
  96. CARLA_KEY_WINE_RT_PRIO_ENABLED,
  97. CARLA_KEY_WINE_BASE_RT_PRIO,
  98. CARLA_KEY_WINE_SERVER_RT_PRIO,
  99. CARLA_KEY_EXPERIMENTAL_PLUGIN_BRIDGES,
  100. CARLA_KEY_EXPERIMENTAL_WINE_BRIDGES,
  101. CARLA_KEY_EXPERIMENTAL_JACK_APPS,
  102. CARLA_KEY_EXPERIMENTAL_EXPORT_LV2,
  103. CARLA_KEY_EXPERIMENTAL_PREVENT_BAD_BEHAVIOUR,
  104. CARLA_KEY_EXPERIMENTAL_LOAD_LIB_GLOBAL,
  105. CARLA_DEFAULT_MAIN_PROJECT_FOLDER,
  106. CARLA_DEFAULT_MAIN_USE_PRO_THEME,
  107. CARLA_DEFAULT_MAIN_PRO_THEME_COLOR,
  108. CARLA_DEFAULT_MAIN_REFRESH_INTERVAL,
  109. CARLA_DEFAULT_MAIN_CONFIRM_EXIT,
  110. CARLA_DEFAULT_MAIN_CLASSIC_SKIN,
  111. CARLA_DEFAULT_MAIN_SHOW_LOGS,
  112. CARLA_DEFAULT_MAIN_SYSTEM_ICONS,
  113. #CARLA_DEFAULT_MAIN_EXPERIMENTAL,
  114. CARLA_DEFAULT_CANVAS_THEME,
  115. CARLA_DEFAULT_CANVAS_SIZE,
  116. CARLA_DEFAULT_CANVAS_USE_BEZIER_LINES,
  117. CARLA_DEFAULT_CANVAS_AUTO_HIDE_GROUPS,
  118. CARLA_DEFAULT_CANVAS_AUTO_SELECT_ITEMS,
  119. CARLA_DEFAULT_CANVAS_EYE_CANDY,
  120. CARLA_DEFAULT_CANVAS_FANCY_EYE_CANDY,
  121. CARLA_DEFAULT_CANVAS_USE_OPENGL,
  122. CARLA_DEFAULT_CANVAS_ANTIALIASING,
  123. CARLA_DEFAULT_CANVAS_HQ_ANTIALIASING,
  124. CARLA_DEFAULT_CANVAS_INLINE_DISPLAYS,
  125. CARLA_DEFAULT_CANVAS_FULL_REPAINTS,
  126. CARLA_DEFAULT_FORCE_STEREO,
  127. CARLA_DEFAULT_PREFER_PLUGIN_BRIDGES,
  128. CARLA_DEFAULT_PREFER_UI_BRIDGES,
  129. CARLA_DEFAULT_MANAGE_UIS,
  130. CARLA_DEFAULT_UIS_ALWAYS_ON_TOP,
  131. CARLA_DEFAULT_MAX_PARAMETERS,
  132. CARLA_DEFAULT_RESET_XRUNS,
  133. CARLA_DEFAULT_UI_BRIDGES_TIMEOUT,
  134. CARLA_DEFAULT_AUDIO_BUFFER_SIZE,
  135. CARLA_DEFAULT_AUDIO_SAMPLE_RATE,
  136. CARLA_DEFAULT_AUDIO_TRIPLE_BUFFER,
  137. CARLA_DEFAULT_AUDIO_DRIVER,
  138. CARLA_DEFAULT_PROCESS_MODE,
  139. CARLA_DEFAULT_OSC_ENABLED,
  140. CARLA_DEFAULT_OSC_TCP_PORT_ENABLED,
  141. CARLA_DEFAULT_OSC_TCP_PORT_NUMBER,
  142. CARLA_DEFAULT_OSC_TCP_PORT_RANDOM,
  143. CARLA_DEFAULT_OSC_UDP_PORT_ENABLED,
  144. CARLA_DEFAULT_OSC_UDP_PORT_NUMBER,
  145. CARLA_DEFAULT_OSC_UDP_PORT_RANDOM,
  146. CARLA_DEFAULT_WINE_EXECUTABLE,
  147. CARLA_DEFAULT_WINE_AUTO_PREFIX,
  148. CARLA_DEFAULT_WINE_FALLBACK_PREFIX,
  149. CARLA_DEFAULT_WINE_RT_PRIO_ENABLED,
  150. CARLA_DEFAULT_WINE_BASE_RT_PRIO,
  151. CARLA_DEFAULT_WINE_SERVER_RT_PRIO,
  152. CARLA_DEFAULT_EXPERIMENTAL_PLUGIN_BRIDGES,
  153. CARLA_DEFAULT_EXPERIMENTAL_WINE_BRIDGES,
  154. CARLA_DEFAULT_EXPERIMENTAL_JACK_APPS,
  155. CARLA_DEFAULT_EXPERIMENTAL_LV2_EXPORT,
  156. CARLA_DEFAULT_EXPERIMENTAL_PREVENT_BAD_BEHAVIOUR,
  157. CARLA_DEFAULT_EXPERIMENTAL_LOAD_LIB_GLOBAL,
  158. CARLA_DEFAULT_FILE_PATH_AUDIO,
  159. CARLA_DEFAULT_FILE_PATH_MIDI,
  160. CARLA_DEFAULT_LADSPA_PATH,
  161. CARLA_DEFAULT_DSSI_PATH,
  162. CARLA_DEFAULT_LV2_PATH,
  163. CARLA_DEFAULT_VST2_PATH,
  164. CARLA_DEFAULT_VST3_PATH,
  165. CARLA_DEFAULT_SF2_PATH,
  166. CARLA_DEFAULT_SFZ_PATH,
  167. getAndSetPath,
  168. getIcon,
  169. fontMetricsHorizontalAdvance,
  170. splitter,
  171. QSafeSettings
  172. )
  173. from patchcanvas.theme import Theme, getThemeName
  174. # ---------------------------------------------------------------------------------------------------------------------
  175. # ...
  176. BUFFER_SIZE_LIST = (16, 32, 64, 128, 256, 512, 1024, 2048, 4096, 8192)
  177. SAMPLE_RATE_LIST = (22050, 32000, 44100, 48000, 88200, 96000, 176400, 192000)
  178. # ---------------------------------------------------------------------------------------------------------------------
  179. # Driver Settings
  180. class DriverSettingsW(QDialog):
  181. AUTOMATIC_OPTION = "(Auto)"
  182. def __init__(self, parent, host, driverIndex, driverName):
  183. QDialog.__init__(self, parent)
  184. self.host = host
  185. self.ui = ui_carla_settings_driver.Ui_DriverSettingsW()
  186. self.ui.setupUi(self)
  187. # -------------------------------------------------------------------------------------------------------------
  188. # Internal stuff
  189. self.fDriverIndex = driverIndex
  190. self.fDriverName = driverName
  191. self.fDeviceNames = host.get_engine_driver_device_names(driverIndex)
  192. self.fBufferSizes = BUFFER_SIZE_LIST
  193. self.fSampleRates = SAMPLE_RATE_LIST
  194. # -------------------------------------------------------------------------------------------------------------
  195. # Set-up GUI
  196. for name in self.fDeviceNames:
  197. self.ui.cb_device.addItem(name)
  198. self.setWindowFlags(self.windowFlags() & ~Qt.WindowContextHelpButtonHint)
  199. if MACOS:
  200. self.setWindowModality(Qt.WindowModal)
  201. # -------------------------------------------------------------------------------------------------------------
  202. # Load settings
  203. self.loadSettings()
  204. # -------------------------------------------------------------------------------------------------------------
  205. # Set-up connections
  206. self.accepted.connect(self.slot_saveSettings)
  207. self.ui.b_panel.clicked.connect(self.slot_showDevicePanel)
  208. self.ui.cb_device.currentIndexChanged.connect(self.slot_updateDeviceInfo)
  209. # -----------------------------------------------------------------------------------------------------------------
  210. def loadSettings(self):
  211. settings = QSafeSettings("falkTX", "Carla2")
  212. args = (CARLA_KEY_ENGINE_DRIVER_PREFIX, self.fDriverName)
  213. audioDevice = settings.value("%s%s/Device" % args, "", str)
  214. audioBufferSize = settings.value("%s%s/BufferSize" % args, CARLA_DEFAULT_AUDIO_BUFFER_SIZE, int)
  215. audioSampleRate = settings.value("%s%s/SampleRate" % args, CARLA_DEFAULT_AUDIO_SAMPLE_RATE, int)
  216. audioTripleBuffer = settings.value("%s%s/TripleBuffer" % args, CARLA_DEFAULT_AUDIO_TRIPLE_BUFFER, bool)
  217. if audioDevice and audioDevice in self.fDeviceNames:
  218. self.ui.cb_device.setCurrentIndex(self.fDeviceNames.index(audioDevice))
  219. else:
  220. self.ui.cb_device.setCurrentIndex(-1)
  221. # fill combo-boxes first
  222. self.slot_updateDeviceInfo()
  223. if audioBufferSize and audioBufferSize in self.fBufferSizes:
  224. self.ui.cb_buffersize.setCurrentIndex(self.fBufferSizes.index(audioBufferSize))
  225. elif self.fBufferSizes == BUFFER_SIZE_LIST:
  226. self.ui.cb_buffersize.setCurrentIndex(BUFFER_SIZE_LIST.index(CARLA_DEFAULT_AUDIO_BUFFER_SIZE))
  227. else:
  228. self.ui.cb_buffersize.setCurrentIndex(len(self.fBufferSizes)/2)
  229. if audioSampleRate and audioSampleRate in self.fSampleRates:
  230. self.ui.cb_samplerate.setCurrentIndex(self.fSampleRates.index(audioSampleRate))
  231. elif self.fSampleRates == SAMPLE_RATE_LIST:
  232. self.ui.cb_samplerate.setCurrentIndex(SAMPLE_RATE_LIST.index(CARLA_DEFAULT_AUDIO_SAMPLE_RATE))
  233. else:
  234. self.ui.cb_samplerate.setCurrentIndex(len(self.fSampleRates)/2)
  235. self.ui.cb_triple_buffer.setChecked(audioTripleBuffer and self.ui.cb_triple_buffer.isEnabled())
  236. # -----------------------------------------------------------------------------------------------------------------
  237. @pyqtSlot()
  238. def slot_saveSettings(self):
  239. settings = QSafeSettings("falkTX", "Carla2")
  240. bufferSize = self.ui.cb_buffersize.currentText()
  241. sampleRate = self.ui.cb_samplerate.currentText()
  242. if bufferSize == self.AUTOMATIC_OPTION:
  243. bufferSize = "0"
  244. if sampleRate == self.AUTOMATIC_OPTION:
  245. sampleRate = "0"
  246. args = (CARLA_KEY_ENGINE_DRIVER_PREFIX, self.fDriverName)
  247. settings.setValue("%s%s/Device" % args, self.ui.cb_device.currentText())
  248. settings.setValue("%s%s/BufferSize" % args, bufferSize)
  249. settings.setValue("%s%s/SampleRate" % args, sampleRate)
  250. settings.setValue("%s%s/TripleBuffer" % args, self.ui.cb_triple_buffer.isChecked())
  251. # -----------------------------------------------------------------------------------------------------------------
  252. @pyqtSlot()
  253. def slot_showDevicePanel(self):
  254. self.host.show_engine_driver_device_control_panel(self.fDriverIndex, self.ui.cb_device.currentText())
  255. @pyqtSlot()
  256. def slot_updateDeviceInfo(self):
  257. deviceName = self.ui.cb_device.currentText()
  258. oldBufferSize = self.ui.cb_buffersize.currentText()
  259. oldSampleRate = self.ui.cb_samplerate.currentText()
  260. self.ui.cb_buffersize.clear()
  261. self.ui.cb_samplerate.clear()
  262. driverDeviceInfo = self.host.get_engine_driver_device_info(self.fDriverIndex, deviceName)
  263. driverDeviceHints = driverDeviceInfo['hints']
  264. self.fBufferSizes = driverDeviceInfo['bufferSizes']
  265. self.fSampleRates = driverDeviceInfo['sampleRates']
  266. if driverDeviceHints & ENGINE_DRIVER_DEVICE_CAN_TRIPLE_BUFFER:
  267. self.ui.cb_triple_buffer.setEnabled(True)
  268. else:
  269. self.ui.cb_triple_buffer.setEnabled(False)
  270. if driverDeviceHints & ENGINE_DRIVER_DEVICE_HAS_CONTROL_PANEL:
  271. self.ui.b_panel.setEnabled(True)
  272. else:
  273. self.ui.b_panel.setEnabled(False)
  274. if self.fBufferSizes:
  275. for bsize in self.fBufferSizes:
  276. sbsize = str(bsize)
  277. self.ui.cb_buffersize.addItem(sbsize)
  278. if oldBufferSize == sbsize:
  279. self.ui.cb_buffersize.setCurrentIndex(self.ui.cb_buffersize.count()-1)
  280. else:
  281. self.ui.cb_buffersize.addItem(self.AUTOMATIC_OPTION)
  282. self.ui.cb_buffersize.setCurrentIndex(0)
  283. if self.fSampleRates:
  284. for srate in self.fSampleRates:
  285. ssrate = str(int(srate))
  286. self.ui.cb_samplerate.addItem(ssrate)
  287. if oldSampleRate == ssrate:
  288. self.ui.cb_samplerate.setCurrentIndex(self.ui.cb_samplerate.count()-1)
  289. else:
  290. self.ui.cb_samplerate.addItem(self.AUTOMATIC_OPTION)
  291. self.ui.cb_samplerate.setCurrentIndex(0)
  292. # ---------------------------------------------------------------------------------------------------------------------
  293. # Runtime Driver Settings
  294. class RuntimeDriverSettingsW(QDialog):
  295. def __init__(self, parent, host):
  296. QDialog.__init__(self, parent)
  297. self.host = host
  298. self.ui = ui_carla_settings_driver.Ui_DriverSettingsW()
  299. self.ui.setupUi(self)
  300. driverDeviceInfo = host.get_runtime_engine_driver_device_info()
  301. # -------------------------------------------------------------------------------------------------------------
  302. # Set-up GUI
  303. self.ui.cb_device.clear()
  304. self.ui.cb_buffersize.clear()
  305. self.ui.cb_samplerate.clear()
  306. self.ui.cb_triple_buffer.hide()
  307. self.ui.ico_restart.hide()
  308. self.ui.label_restart.hide()
  309. self.ui.layout_triple_buffer.takeAt(2)
  310. self.ui.layout_triple_buffer.takeAt(1)
  311. self.ui.layout_triple_buffer.takeAt(0)
  312. self.ui.verticalLayout.removeItem(self.ui.layout_triple_buffer)
  313. self.ui.layout_restart.takeAt(3)
  314. self.ui.layout_restart.takeAt(2)
  315. self.ui.layout_restart.takeAt(1)
  316. self.ui.layout_restart.takeAt(0)
  317. self.ui.verticalLayout.removeItem(self.ui.layout_restart)
  318. self.adjustSize()
  319. self.setWindowFlags(self.windowFlags() & ~Qt.WindowContextHelpButtonHint)
  320. if MACOS:
  321. self.setWindowModality(Qt.WindowModal)
  322. # -------------------------------------------------------------------------------------------------------------
  323. # Load runtime settings
  324. if host.is_engine_running():
  325. self.ui.cb_device.addItem(driverDeviceInfo['name'])
  326. self.ui.cb_device.setCurrentIndex(0)
  327. self.ui.cb_device.setEnabled(False)
  328. else:
  329. self.ui.cb_device.addItem(driverDeviceInfo['name'])
  330. self.ui.cb_device.setCurrentIndex(0)
  331. if driverDeviceInfo['bufferSizes']:
  332. for bsize in driverDeviceInfo['bufferSizes']:
  333. sbsize = str(bsize)
  334. self.ui.cb_buffersize.addItem(sbsize)
  335. if driverDeviceInfo['bufferSize'] == bsize:
  336. self.ui.cb_buffersize.setCurrentIndex(self.ui.cb_buffersize.count()-1)
  337. else:
  338. self.ui.cb_buffersize.addItem(DriverSettingsW.AUTOMATIC_OPTION)
  339. self.ui.cb_buffersize.setCurrentIndex(0)
  340. if (driverDeviceInfo['hints'] & ENGINE_DRIVER_DEVICE_VARIABLE_BUFFER_SIZE) == 0x0:
  341. self.ui.cb_buffersize.setEnabled(False)
  342. if driverDeviceInfo['sampleRates']:
  343. for srate in driverDeviceInfo['sampleRates']:
  344. ssrate = str(int(srate))
  345. self.ui.cb_samplerate.addItem(ssrate)
  346. if driverDeviceInfo['sampleRate'] == srate:
  347. self.ui.cb_samplerate.setCurrentIndex(self.ui.cb_samplerate.count()-1)
  348. else:
  349. self.ui.cb_samplerate.addItem(DriverSettingsW.AUTOMATIC_OPTION)
  350. self.ui.cb_samplerate.setCurrentIndex(0)
  351. if (driverDeviceInfo['hints'] & ENGINE_DRIVER_DEVICE_VARIABLE_SAMPLE_RATE) == 0x0:
  352. self.ui.cb_samplerate.setEnabled(False)
  353. if (driverDeviceInfo['hints'] & ENGINE_DRIVER_DEVICE_HAS_CONTROL_PANEL) == 0x0:
  354. self.ui.b_panel.setEnabled(False)
  355. # -------------------------------------------------------------------------------------------------------------
  356. # Set-up connections
  357. self.ui.b_panel.clicked.connect(self.slot_showDevicePanel)
  358. # -----------------------------------------------------------------------------------------------------------------
  359. def getValues(self):
  360. audioDevice = self.ui.cb_buffersize.currentText()
  361. bufferSize = self.ui.cb_buffersize.currentText()
  362. sampleRate = self.ui.cb_samplerate.currentText()
  363. if bufferSize == DriverSettingsW.AUTOMATIC_OPTION:
  364. bufferSize = "0"
  365. if sampleRate == DriverSettingsW.AUTOMATIC_OPTION:
  366. sampleRate = "0"
  367. return (audioDevice, int(bufferSize), int(sampleRate))
  368. # -----------------------------------------------------------------------------------------------------------------
  369. @pyqtSlot()
  370. def slot_showDevicePanel(self):
  371. self.host.show_engine_device_control_panel()
  372. # ---------------------------------------------------------------------------------------------------------------------
  373. # Settings Dialog
  374. class CarlaSettingsW(QDialog):
  375. # Tab indexes
  376. TAB_INDEX_MAIN = 0
  377. TAB_INDEX_CANVAS = 1
  378. TAB_INDEX_ENGINE = 2
  379. TAB_INDEX_OSC = 3
  380. TAB_INDEX_FILEPATHS = 4
  381. TAB_INDEX_PLUGINPATHS = 5
  382. TAB_INDEX_WINE = 6
  383. TAB_INDEX_EXPERIMENTAL = 7
  384. TAB_INDEX_NONE = 8
  385. # File Path indexes
  386. FILEPATH_INDEX_AUDIO = 0
  387. FILEPATH_INDEX_MIDI = 1
  388. # Plugin Path indexes
  389. PLUGINPATH_INDEX_LADSPA = 0
  390. PLUGINPATH_INDEX_DSSI = 1
  391. PLUGINPATH_INDEX_LV2 = 2
  392. PLUGINPATH_INDEX_VST2 = 3
  393. PLUGINPATH_INDEX_VST3 = 4
  394. PLUGINPATH_INDEX_SF2 = 5
  395. PLUGINPATH_INDEX_SFZ = 6
  396. # Single and Multiple client mode is only for JACK,
  397. # but we still want to match QComboBox index to backend defines,
  398. # so add +2 pos padding if driverName != "JACK".
  399. PROCESS_MODE_NON_JACK_PADDING = 2
  400. # -----------------------------------------------------------------------------------------------------------------
  401. def __init__(self, parent, host, hasCanvas, hasCanvasGL):
  402. QDialog.__init__(self, parent)
  403. self.host = host
  404. self.ui = ui_carla_settings.Ui_CarlaSettingsW()
  405. self.ui.setupUi(self)
  406. # -------------------------------------------------------------------------------------------------------------
  407. # Set-up GUI
  408. self.ui.lw_page.setFixedWidth(48 + 6*3 +
  409. fontMetricsHorizontalAdvance(self.ui.lw_page.fontMetrics(), " Experimental "))
  410. for i in range(host.get_engine_driver_count()):
  411. self.ui.cb_engine_audio_driver.addItem(host.get_engine_driver_name(i))
  412. for i in range(Theme.THEME_MAX):
  413. self.ui.cb_canvas_theme.addItem(getThemeName(i))
  414. if MACOS:
  415. self.ui.group_main_theme.setEnabled(False)
  416. self.ui.group_main_theme.setVisible(False)
  417. if WINDOWS or host.isControl:
  418. self.ui.ch_main_show_logs.setEnabled(False)
  419. self.ui.ch_main_show_logs.setVisible(False)
  420. if host.isControl:
  421. self.ui.lw_page.hideRow(self.TAB_INDEX_ENGINE)
  422. self.ui.lw_page.hideRow(self.TAB_INDEX_FILEPATHS)
  423. self.ui.lw_page.hideRow(self.TAB_INDEX_PLUGINPATHS)
  424. self.ui.ch_exp_export_lv2.hide()
  425. self.ui.group_experimental_engine.hide()
  426. self.ui.cb_canvas_inline_displays.hide()
  427. elif not hasCanvas:
  428. self.ui.lw_page.hideRow(self.TAB_INDEX_CANVAS)
  429. elif not hasCanvasGL:
  430. self.ui.cb_canvas_use_opengl.setEnabled(False)
  431. self.ui.cb_canvas_render_hq_aa.setEnabled(False)
  432. if host.isPlugin:
  433. self.ui.cb_engine_audio_driver.setEnabled(False)
  434. if host.audioDriverForced is not None:
  435. self.ui.cb_engine_audio_driver.setEnabled(False)
  436. self.ui.tb_engine_driver_config.setEnabled(False)
  437. if host.processModeForced:
  438. self.ui.cb_engine_process_mode_jack.setEnabled(False)
  439. self.ui.cb_engine_process_mode_other.setEnabled(False)
  440. if self.host.processMode == ENGINE_PROCESS_MODE_CONTINUOUS_RACK:
  441. self.ui.ch_engine_force_stereo.setEnabled(False)
  442. if host.isControl or host.isPlugin:
  443. self.ui.ch_main_confirm_exit.hide()
  444. self.ui.ch_exp_load_lib_global.hide()
  445. self.ui.lw_page.hideRow(self.TAB_INDEX_OSC)
  446. self.ui.lw_page.hideRow(self.TAB_INDEX_WINE)
  447. if not LINUX:
  448. self.ui.ch_exp_wine_bridges.setVisible(False)
  449. self.ui.ch_exp_jack_apps.setVisible(False)
  450. self.ui.ch_exp_prevent_bad_behaviour.setVisible(False)
  451. self.ui.lw_page.hideRow(self.TAB_INDEX_WINE)
  452. if not MACOS:
  453. self.ui.label_engine_ui_bridges_mac_note.setVisible(False)
  454. # FIXME, not implemented yet
  455. self.ui.ch_engine_uis_always_on_top.hide()
  456. # FIXME broken in some Qt5 versions
  457. self.ui.cb_canvas_eyecandy.setEnabled(QT_VERSION >= 0x50c00)
  458. self.setWindowFlags(self.windowFlags() & ~Qt.WindowContextHelpButtonHint)
  459. if MACOS:
  460. self.setWindowModality(Qt.WindowModal)
  461. # -------------------------------------------------------------------------------------------------------------
  462. # Load settings
  463. self.loadSettings()
  464. # -------------------------------------------------------------------------------------------------------------
  465. # Set-up Icons
  466. if self.ui.ch_main_system_icons.isChecked():
  467. self.ui.b_main_proj_folder_open.setIcon(getIcon('document-open', 16, 'svgz'))
  468. self.ui.b_filepaths_add.setIcon(getIcon('list-add', 16, 'svgz'))
  469. self.ui.b_filepaths_change.setIcon(getIcon('edit-rename', 16, 'svgz'))
  470. self.ui.b_filepaths_remove.setIcon(getIcon('list-remove', 16, 'svgz'))
  471. self.ui.b_paths_add.setIcon(getIcon('list-add', 16, 'svgz'))
  472. self.ui.b_paths_change.setIcon(getIcon('edit-rename', 16, 'svgz'))
  473. self.ui.b_paths_remove.setIcon(getIcon('list-remove', 16, 'svgz'))
  474. # -------------------------------------------------------------------------------------------------------------
  475. # Set-up connections
  476. self.accepted.connect(self.slot_saveSettings)
  477. self.ui.buttonBox.button(QDialogButtonBox.Reset).clicked.connect(self.slot_resetSettings)
  478. self.ui.b_main_proj_folder_open.clicked.connect(self.slot_getAndSetProjectPath)
  479. self.ui.cb_engine_audio_driver.currentIndexChanged.connect(self.slot_engineAudioDriverChanged)
  480. self.ui.tb_engine_driver_config.clicked.connect(self.slot_showAudioDriverSettings)
  481. self.ui.b_paths_add.clicked.connect(self.slot_addPluginPath)
  482. self.ui.b_paths_remove.clicked.connect(self.slot_removePluginPath)
  483. self.ui.b_paths_change.clicked.connect(self.slot_changePluginPath)
  484. self.ui.cb_paths.currentIndexChanged.connect(self.slot_pluginPathTabChanged)
  485. self.ui.lw_ladspa.currentRowChanged.connect(self.slot_pluginPathRowChanged)
  486. self.ui.lw_dssi.currentRowChanged.connect(self.slot_pluginPathRowChanged)
  487. self.ui.lw_lv2.currentRowChanged.connect(self.slot_pluginPathRowChanged)
  488. self.ui.lw_vst.currentRowChanged.connect(self.slot_pluginPathRowChanged)
  489. self.ui.lw_vst3.currentRowChanged.connect(self.slot_pluginPathRowChanged)
  490. self.ui.lw_sf2.currentRowChanged.connect(self.slot_pluginPathRowChanged)
  491. self.ui.lw_sfz.currentRowChanged.connect(self.slot_pluginPathRowChanged)
  492. self.ui.b_filepaths_add.clicked.connect(self.slot_addFilePath)
  493. self.ui.b_filepaths_remove.clicked.connect(self.slot_removeFilePath)
  494. self.ui.b_filepaths_change.clicked.connect(self.slot_changeFilePath)
  495. self.ui.cb_filepaths.currentIndexChanged.connect(self.slot_filePathTabChanged)
  496. self.ui.lw_files_audio.currentRowChanged.connect(self.slot_filePathRowChanged)
  497. self.ui.lw_files_midi.currentRowChanged.connect(self.slot_filePathRowChanged)
  498. self.ui.ch_main_experimental.toggled.connect(self.slot_enableExperimental)
  499. self.ui.ch_exp_wine_bridges.toggled.connect(self.slot_enableWineBridges)
  500. self.ui.cb_exp_plugin_bridges.toggled.connect(self.slot_pluginBridgesToggled)
  501. self.ui.cb_canvas_eyecandy.toggled.connect(self.slot_canvasEyeCandyToggled)
  502. #self.ui.cb_canvas_fancy_eyecandy.toggled.connect(self.slot_canvasFancyEyeCandyToggled)
  503. self.ui.cb_canvas_use_opengl.toggled.connect(self.slot_canvasOpenGLToggled)
  504. # -------------------------------------------------------------------------------------------------------------
  505. # Post-connect setup
  506. self.ui.lw_ladspa.setCurrentRow(0)
  507. self.ui.lw_dssi.setCurrentRow(0)
  508. self.ui.lw_lv2.setCurrentRow(0)
  509. self.ui.lw_vst.setCurrentRow(0)
  510. self.ui.lw_vst3.setCurrentRow(0)
  511. self.ui.lw_sf2.setCurrentRow(0)
  512. self.ui.lw_sfz.setCurrentRow(0)
  513. self.ui.lw_files_audio.setCurrentRow(0)
  514. self.ui.lw_files_midi.setCurrentRow(0)
  515. self.ui.lw_page.setCurrentCell(0, 0)
  516. self.slot_filePathTabChanged(0)
  517. self.slot_pluginPathTabChanged(0)
  518. self.adjustSize()
  519. # -----------------------------------------------------------------------------------------------------------------
  520. def loadSettings(self):
  521. settings = QSafeSettings()
  522. # -------------------------------------------------------------------------------------------------------------
  523. # Main
  524. self.ui.ch_main_show_logs.setChecked(self.host.showLogs)
  525. self.ui.ch_engine_uis_always_on_top.setChecked(self.host.uisAlwaysOnTop)
  526. self.ui.le_main_proj_folder.setText(
  527. settings.value(CARLA_KEY_MAIN_PROJECT_FOLDER, CARLA_DEFAULT_MAIN_PROJECT_FOLDER, str))
  528. self.ui.ch_main_theme_pro.setChecked(self.ui.group_main_theme.isEnabled() and
  529. settings.value(CARLA_KEY_MAIN_USE_PRO_THEME,
  530. CARLA_DEFAULT_MAIN_USE_PRO_THEME, bool))
  531. self.ui.cb_main_theme_color.setCurrentIndex(
  532. self.ui.cb_main_theme_color.findText(settings.value(CARLA_KEY_MAIN_PRO_THEME_COLOR,
  533. CARLA_DEFAULT_MAIN_PRO_THEME_COLOR, str)))
  534. self.ui.sb_main_refresh_interval.setValue(
  535. settings.value(CARLA_KEY_MAIN_REFRESH_INTERVAL, CARLA_DEFAULT_MAIN_REFRESH_INTERVAL, int))
  536. self.ui.ch_main_confirm_exit.setChecked(
  537. settings.value(CARLA_KEY_MAIN_CONFIRM_EXIT, CARLA_DEFAULT_MAIN_CONFIRM_EXIT, bool))
  538. self.ui.cb_main_classic_skin_default.setChecked(
  539. settings.value(CARLA_KEY_MAIN_CLASSIC_SKIN, CARLA_DEFAULT_MAIN_CLASSIC_SKIN, bool))
  540. self.ui.ch_main_system_icons.setChecked(
  541. settings.value(CARLA_KEY_MAIN_SYSTEM_ICONS, CARLA_DEFAULT_MAIN_SYSTEM_ICONS, bool))
  542. # -------------------------------------------------------------------------------------------------------------
  543. # Canvas
  544. self.ui.cb_canvas_theme.setCurrentIndex(
  545. self.ui.cb_canvas_theme.findText(settings.value(CARLA_KEY_CANVAS_THEME, CARLA_DEFAULT_CANVAS_THEME, str)))
  546. self.ui.cb_canvas_size.setCurrentIndex(
  547. self.ui.cb_canvas_size.findText(settings.value(CARLA_KEY_CANVAS_SIZE, CARLA_DEFAULT_CANVAS_SIZE, str)))
  548. self.ui.cb_canvas_bezier_lines.setChecked(
  549. settings.value(CARLA_KEY_CANVAS_USE_BEZIER_LINES, CARLA_DEFAULT_CANVAS_USE_BEZIER_LINES, bool))
  550. self.ui.cb_canvas_hide_groups.setChecked(
  551. settings.value(CARLA_KEY_CANVAS_AUTO_HIDE_GROUPS, CARLA_DEFAULT_CANVAS_AUTO_HIDE_GROUPS, bool))
  552. self.ui.cb_canvas_auto_select.setChecked(
  553. settings.value(CARLA_KEY_CANVAS_AUTO_SELECT_ITEMS, CARLA_DEFAULT_CANVAS_AUTO_SELECT_ITEMS, bool))
  554. if self.ui.cb_canvas_eyecandy.isEnabled():
  555. self.ui.cb_canvas_eyecandy.setChecked(
  556. settings.value(CARLA_KEY_CANVAS_EYE_CANDY, CARLA_DEFAULT_CANVAS_EYE_CANDY, bool))
  557. self.ui.cb_canvas_fancy_eyecandy.setChecked(
  558. settings.value(CARLA_KEY_CANVAS_FANCY_EYE_CANDY, CARLA_DEFAULT_CANVAS_FANCY_EYE_CANDY, bool))
  559. self.ui.cb_canvas_use_opengl.setChecked(self.ui.cb_canvas_use_opengl.isEnabled() and
  560. settings.value(CARLA_KEY_CANVAS_USE_OPENGL,
  561. CARLA_DEFAULT_CANVAS_USE_OPENGL, bool))
  562. self.ui.cb_canvas_render_aa.setCheckState(
  563. settings.value(CARLA_KEY_CANVAS_ANTIALIASING, CARLA_DEFAULT_CANVAS_ANTIALIASING, int))
  564. self.ui.cb_canvas_render_hq_aa.setChecked(self.ui.cb_canvas_render_hq_aa.isEnabled() and
  565. settings.value(CARLA_KEY_CANVAS_HQ_ANTIALIASING,
  566. CARLA_DEFAULT_CANVAS_HQ_ANTIALIASING, bool))
  567. self.ui.cb_canvas_full_repaints.setChecked(
  568. settings.value(CARLA_KEY_CANVAS_FULL_REPAINTS, CARLA_DEFAULT_CANVAS_FULL_REPAINTS, bool))
  569. self.ui.cb_canvas_inline_displays.setChecked(
  570. settings.value(CARLA_KEY_CANVAS_INLINE_DISPLAYS, CARLA_DEFAULT_CANVAS_INLINE_DISPLAYS, bool))
  571. # -------------------------------------------------------------------------------------------------------------
  572. settings = QSafeSettings("falkTX", "Carla2")
  573. # -------------------------------------------------------------------------------------------------------------
  574. # Main
  575. self.ui.ch_main_experimental.setChecked(self.host.experimental)
  576. if not self.host.experimental:
  577. self.ui.lw_page.hideRow(self.TAB_INDEX_EXPERIMENTAL)
  578. self.ui.lw_page.hideRow(self.TAB_INDEX_WINE)
  579. elif not self.host.showWineBridges:
  580. self.ui.lw_page.hideRow(self.TAB_INDEX_WINE)
  581. # -------------------------------------------------------------------------------------------------------------
  582. # Engine
  583. if self.host.isPlugin:
  584. audioDriver = "Plugin"
  585. self.ui.cb_engine_audio_driver.setCurrentIndex(0)
  586. elif self.host.audioDriverForced:
  587. audioDriver = self.host.audioDriverForced
  588. self.ui.cb_engine_audio_driver.setCurrentIndex(0)
  589. else:
  590. audioDriver = settings.value(CARLA_KEY_ENGINE_AUDIO_DRIVER, CARLA_DEFAULT_AUDIO_DRIVER, str)
  591. for i in range(self.ui.cb_engine_audio_driver.count()):
  592. if self.ui.cb_engine_audio_driver.itemText(i) == audioDriver:
  593. self.ui.cb_engine_audio_driver.setCurrentIndex(i)
  594. break
  595. else:
  596. self.ui.cb_engine_audio_driver.setCurrentIndex(-1)
  597. if audioDriver == "JACK":
  598. self.ui.sw_engine_process_mode.setCurrentIndex(0)
  599. else:
  600. self.ui.sw_engine_process_mode.setCurrentIndex(1)
  601. self.ui.tb_engine_driver_config.setEnabled(self.host.audioDriverForced is None and not self.host.isPlugin)
  602. self.ui.cb_engine_process_mode_jack.setCurrentIndex(self.host.nextProcessMode)
  603. if self.host.nextProcessMode >= self.PROCESS_MODE_NON_JACK_PADDING:
  604. self.ui.cb_engine_process_mode_other.setCurrentIndex(self.host.nextProcessMode -
  605. self.PROCESS_MODE_NON_JACK_PADDING)
  606. else:
  607. self.ui.cb_engine_process_mode_other.setCurrentIndex(0)
  608. self.ui.sb_engine_max_params.setValue(self.host.maxParameters)
  609. self.ui.cb_engine_reset_xruns.setChecked(self.host.resetXruns)
  610. self.ui.ch_engine_manage_uis.setChecked(self.host.manageUIs)
  611. self.ui.ch_engine_prefer_ui_bridges.setChecked(self.host.preferUIBridges)
  612. self.ui.sb_engine_ui_bridges_timeout.setValue(self.host.uiBridgesTimeout)
  613. self.ui.ch_engine_force_stereo.setChecked(self.host.forceStereo or
  614. not self.ui.ch_engine_force_stereo.isEnabled())
  615. self.ui.ch_engine_prefer_plugin_bridges.setChecked(self.host.preferPluginBridges)
  616. self.ui.ch_exp_export_lv2.setChecked(self.host.exportLV2)
  617. self.ui.cb_exp_plugin_bridges.setChecked(self.host.showPluginBridges)
  618. self.ui.ch_exp_wine_bridges.setChecked(self.host.showWineBridges)
  619. # -------------------------------------------------------------------------------------------------------------
  620. # OSC
  621. self.ui.ch_osc_enable.setChecked(
  622. settings.value(CARLA_KEY_OSC_ENABLED, CARLA_DEFAULT_OSC_ENABLED, bool))
  623. self.ui.group_osc_tcp_port.setChecked(
  624. settings.value(CARLA_KEY_OSC_TCP_PORT_ENABLED, CARLA_DEFAULT_OSC_TCP_PORT_ENABLED, bool))
  625. self.ui.group_osc_udp_port.setChecked(
  626. settings.value(CARLA_KEY_OSC_UDP_PORT_ENABLED, CARLA_DEFAULT_OSC_UDP_PORT_ENABLED, bool))
  627. self.ui.sb_osc_tcp_port_number.setValue(
  628. settings.value(CARLA_KEY_OSC_TCP_PORT_NUMBER, CARLA_DEFAULT_OSC_TCP_PORT_NUMBER, int))
  629. self.ui.sb_osc_udp_port_number.setValue(
  630. settings.value(CARLA_KEY_OSC_UDP_PORT_NUMBER, CARLA_DEFAULT_OSC_UDP_PORT_NUMBER, int))
  631. if settings.value(CARLA_KEY_OSC_TCP_PORT_RANDOM, CARLA_DEFAULT_OSC_TCP_PORT_RANDOM, bool):
  632. self.ui.rb_osc_tcp_port_specific.setChecked(False)
  633. self.ui.rb_osc_tcp_port_random.setChecked(True)
  634. else:
  635. self.ui.rb_osc_tcp_port_random.setChecked(False)
  636. self.ui.rb_osc_tcp_port_specific.setChecked(True)
  637. if settings.value(CARLA_KEY_OSC_UDP_PORT_RANDOM, CARLA_DEFAULT_OSC_UDP_PORT_RANDOM, bool):
  638. self.ui.rb_osc_udp_port_specific.setChecked(False)
  639. self.ui.rb_osc_udp_port_random.setChecked(True)
  640. else:
  641. self.ui.rb_osc_udp_port_random.setChecked(False)
  642. self.ui.rb_osc_udp_port_specific.setChecked(True)
  643. # -------------------------------------------------------------------------------------------------------------
  644. # File Paths
  645. audioPaths = settings.value(CARLA_KEY_PATHS_AUDIO, CARLA_DEFAULT_FILE_PATH_AUDIO, list)
  646. midiPaths = settings.value(CARLA_KEY_PATHS_MIDI, CARLA_DEFAULT_FILE_PATH_MIDI, list)
  647. audioPaths.sort()
  648. midiPaths.sort()
  649. for audioPath in audioPaths:
  650. if not audioPath:
  651. continue
  652. self.ui.lw_files_audio.addItem(audioPath)
  653. for midiPath in midiPaths:
  654. if not midiPath:
  655. continue
  656. self.ui.lw_files_midi.addItem(midiPath)
  657. # -------------------------------------------------------------------------------------------------------------
  658. # Plugin Paths
  659. ladspas = settings.value(CARLA_KEY_PATHS_LADSPA, CARLA_DEFAULT_LADSPA_PATH, list)
  660. dssis = settings.value(CARLA_KEY_PATHS_DSSI, CARLA_DEFAULT_DSSI_PATH, list)
  661. lv2s = settings.value(CARLA_KEY_PATHS_LV2, CARLA_DEFAULT_LV2_PATH, list)
  662. vst2s = settings.value(CARLA_KEY_PATHS_VST2, CARLA_DEFAULT_VST2_PATH, list)
  663. vst3s = settings.value(CARLA_KEY_PATHS_VST3, CARLA_DEFAULT_VST3_PATH, list)
  664. sf2s = settings.value(CARLA_KEY_PATHS_SF2, CARLA_DEFAULT_SF2_PATH, list)
  665. sfzs = settings.value(CARLA_KEY_PATHS_SFZ, CARLA_DEFAULT_SFZ_PATH, list)
  666. ladspas.sort()
  667. dssis.sort()
  668. lv2s.sort()
  669. vst2s.sort()
  670. vst3s.sort()
  671. sf2s.sort()
  672. sfzs.sort()
  673. for ladspa in ladspas:
  674. if not ladspa:
  675. continue
  676. self.ui.lw_ladspa.addItem(ladspa)
  677. for dssi in dssis:
  678. if not dssi:
  679. continue
  680. self.ui.lw_dssi.addItem(dssi)
  681. for lv2 in lv2s:
  682. if not lv2:
  683. continue
  684. self.ui.lw_lv2.addItem(lv2)
  685. for vst2 in vst2s:
  686. if not vst2:
  687. continue
  688. self.ui.lw_vst.addItem(vst2)
  689. for vst3 in vst3s:
  690. if not vst3:
  691. continue
  692. self.ui.lw_vst3.addItem(vst3)
  693. for sf2 in sf2s:
  694. if not sf2:
  695. continue
  696. self.ui.lw_sf2.addItem(sf2)
  697. for sfz in sfzs:
  698. if not sfz:
  699. continue
  700. self.ui.lw_sfz.addItem(sfz)
  701. # -------------------------------------------------------------------------------------------------------------
  702. # Wine
  703. self.ui.le_wine_exec.setText(
  704. settings.value(CARLA_KEY_WINE_EXECUTABLE, CARLA_DEFAULT_WINE_EXECUTABLE, str))
  705. self.ui.cb_wine_prefix_detect.setChecked(
  706. settings.value(CARLA_KEY_WINE_AUTO_PREFIX, CARLA_DEFAULT_WINE_AUTO_PREFIX, bool))
  707. self.ui.le_wine_prefix_fallback.setText(
  708. settings.value(CARLA_KEY_WINE_FALLBACK_PREFIX, CARLA_DEFAULT_WINE_FALLBACK_PREFIX, str))
  709. self.ui.group_wine_realtime.setChecked(
  710. settings.value(CARLA_KEY_WINE_RT_PRIO_ENABLED, CARLA_DEFAULT_WINE_RT_PRIO_ENABLED, bool))
  711. self.ui.sb_wine_base_prio.setValue(
  712. settings.value(CARLA_KEY_WINE_BASE_RT_PRIO, CARLA_DEFAULT_WINE_BASE_RT_PRIO, int))
  713. self.ui.sb_wine_server_prio.setValue(
  714. settings.value(CARLA_KEY_WINE_SERVER_RT_PRIO, CARLA_DEFAULT_WINE_SERVER_RT_PRIO, int))
  715. # -------------------------------------------------------------------------------------------------------------
  716. # Experimental
  717. self.ui.ch_exp_jack_apps.setChecked(
  718. settings.value(CARLA_KEY_EXPERIMENTAL_JACK_APPS, CARLA_DEFAULT_EXPERIMENTAL_JACK_APPS, bool))
  719. self.ui.ch_exp_export_lv2.setChecked(
  720. settings.value(CARLA_KEY_EXPERIMENTAL_EXPORT_LV2, CARLA_DEFAULT_EXPERIMENTAL_LV2_EXPORT, bool))
  721. self.ui.ch_exp_load_lib_global.setChecked(
  722. settings.value(CARLA_KEY_EXPERIMENTAL_LOAD_LIB_GLOBAL, CARLA_DEFAULT_EXPERIMENTAL_LOAD_LIB_GLOBAL, bool))
  723. self.ui.ch_exp_prevent_bad_behaviour.setChecked(
  724. settings.value(CARLA_KEY_EXPERIMENTAL_PREVENT_BAD_BEHAVIOUR,
  725. CARLA_DEFAULT_EXPERIMENTAL_PREVENT_BAD_BEHAVIOUR, bool))
  726. # -----------------------------------------------------------------------------------------------------------------
  727. @pyqtSlot()
  728. def slot_saveSettings(self):
  729. settings = QSafeSettings()
  730. self.host.experimental = self.ui.ch_main_experimental.isChecked()
  731. if not self.host.experimental:
  732. self.resetExperimentalSettings()
  733. # -------------------------------------------------------------------------------------------------------------
  734. # Main
  735. settings.setValue(CARLA_KEY_MAIN_PROJECT_FOLDER, self.ui.le_main_proj_folder.text())
  736. settings.setValue(CARLA_KEY_MAIN_CONFIRM_EXIT, self.ui.ch_main_confirm_exit.isChecked())
  737. settings.setValue(CARLA_KEY_MAIN_CLASSIC_SKIN, self.ui.cb_main_classic_skin_default.isChecked())
  738. settings.setValue(CARLA_KEY_MAIN_USE_PRO_THEME, self.ui.ch_main_theme_pro.isChecked())
  739. settings.setValue(CARLA_KEY_MAIN_PRO_THEME_COLOR, self.ui.cb_main_theme_color.currentText())
  740. settings.setValue(CARLA_KEY_MAIN_REFRESH_INTERVAL, self.ui.sb_main_refresh_interval.value())
  741. settings.setValue(CARLA_KEY_MAIN_SYSTEM_ICONS, self.ui.ch_main_system_icons.isChecked())
  742. # -------------------------------------------------------------------------------------------------------------
  743. # Canvas
  744. settings.setValue(CARLA_KEY_CANVAS_THEME, self.ui.cb_canvas_theme.currentText())
  745. settings.setValue(CARLA_KEY_CANVAS_SIZE, self.ui.cb_canvas_size.currentText())
  746. settings.setValue(CARLA_KEY_CANVAS_USE_BEZIER_LINES, self.ui.cb_canvas_bezier_lines.isChecked())
  747. settings.setValue(CARLA_KEY_CANVAS_AUTO_HIDE_GROUPS, self.ui.cb_canvas_hide_groups.isChecked())
  748. settings.setValue(CARLA_KEY_CANVAS_AUTO_SELECT_ITEMS, self.ui.cb_canvas_auto_select.isChecked())
  749. settings.setValue(CARLA_KEY_CANVAS_EYE_CANDY, self.ui.cb_canvas_eyecandy.isChecked())
  750. settings.setValue(CARLA_KEY_CANVAS_FANCY_EYE_CANDY, self.ui.cb_canvas_fancy_eyecandy.isChecked())
  751. settings.setValue(CARLA_KEY_CANVAS_USE_OPENGL, self.ui.cb_canvas_use_opengl.isChecked())
  752. settings.setValue(CARLA_KEY_CANVAS_HQ_ANTIALIASING, self.ui.cb_canvas_render_hq_aa.isChecked())
  753. # NOTE: checkState() 0, 1, 2 match their enum variants
  754. settings.setValue(CARLA_KEY_CANVAS_ANTIALIASING, self.ui.cb_canvas_render_aa.checkState())
  755. settings.setValue(CARLA_KEY_CANVAS_FULL_REPAINTS, self.ui.cb_canvas_full_repaints.isChecked())
  756. settings.setValue(CARLA_KEY_CANVAS_INLINE_DISPLAYS, self.ui.cb_canvas_inline_displays.isChecked())
  757. # -------------------------------------------------------------------------------------------------------------
  758. settings = QSafeSettings("falkTX", "Carla2")
  759. # -------------------------------------------------------------------------------------------------------------
  760. # Main
  761. settings.setValue(CARLA_KEY_MAIN_EXPERIMENTAL, self.host.experimental)
  762. # -------------------------------------------------------------------------------------------------------------
  763. # Engine
  764. audioDriver = self.ui.cb_engine_audio_driver.currentText()
  765. if audioDriver and self.host.audioDriverForced is None and not self.host.isPlugin:
  766. settings.setValue(CARLA_KEY_ENGINE_AUDIO_DRIVER, audioDriver)
  767. if not self.host.processModeForced:
  768. # engine sends callback if processMode really changes
  769. if audioDriver == "JACK":
  770. self.host.nextProcessMode = self.ui.cb_engine_process_mode_jack.currentIndex()
  771. else:
  772. self.host.nextProcessMode = (self.ui.cb_engine_process_mode_other.currentIndex() +
  773. self.PROCESS_MODE_NON_JACK_PADDING)
  774. settings.setValue(CARLA_KEY_ENGINE_PROCESS_MODE, self.host.nextProcessMode)
  775. self.host.exportLV2 = self.ui.ch_exp_export_lv2.isChecked()
  776. self.host.forceStereo = self.ui.ch_engine_force_stereo.isChecked()
  777. self.host.resetXruns = self.ui.cb_engine_reset_xruns.isChecked()
  778. self.host.maxParameters = self.ui.sb_engine_max_params.value()
  779. self.host.manageUIs = self.ui.ch_engine_manage_uis.isChecked()
  780. self.host.preferPluginBridges = self.ui.ch_engine_prefer_plugin_bridges.isChecked()
  781. self.host.preferUIBridges = self.ui.ch_engine_prefer_ui_bridges.isChecked()
  782. self.host.showLogs = self.ui.ch_main_show_logs.isChecked()
  783. self.host.showPluginBridges = self.ui.cb_exp_plugin_bridges.isChecked()
  784. self.host.showWineBridges = self.ui.ch_exp_wine_bridges.isChecked()
  785. self.host.uiBridgesTimeout = self.ui.sb_engine_ui_bridges_timeout.value()
  786. self.host.uisAlwaysOnTop = self.ui.ch_engine_uis_always_on_top.isChecked()
  787. if self.ui.ch_engine_force_stereo.isEnabled():
  788. settings.setValue(CARLA_KEY_ENGINE_FORCE_STEREO, self.host.forceStereo)
  789. settings.setValue(CARLA_KEY_MAIN_SHOW_LOGS, self.host.showLogs)
  790. settings.setValue(CARLA_KEY_ENGINE_MAX_PARAMETERS, self.host.maxParameters)
  791. settings.setValue(CARLA_KEY_ENGINE_RESET_XRUNS, self.host.resetXruns)
  792. settings.setValue(CARLA_KEY_ENGINE_MANAGE_UIS, self.host.manageUIs)
  793. settings.setValue(CARLA_KEY_ENGINE_PREFER_PLUGIN_BRIDGES, self.host.preferPluginBridges)
  794. settings.setValue(CARLA_KEY_ENGINE_PREFER_UI_BRIDGES, self.host.preferUIBridges)
  795. settings.setValue(CARLA_KEY_ENGINE_UI_BRIDGES_TIMEOUT, self.host.uiBridgesTimeout)
  796. settings.setValue(CARLA_KEY_ENGINE_UIS_ALWAYS_ON_TOP, self.host.uisAlwaysOnTop)
  797. settings.setValue(CARLA_KEY_EXPERIMENTAL_EXPORT_LV2, self.host.exportLV2)
  798. settings.setValue(CARLA_KEY_EXPERIMENTAL_PLUGIN_BRIDGES, self.host.showPluginBridges)
  799. settings.setValue(CARLA_KEY_EXPERIMENTAL_WINE_BRIDGES, self.host.showWineBridges)
  800. # -------------------------------------------------------------------------------------------------------------
  801. # OSC
  802. settings.setValue(CARLA_KEY_OSC_ENABLED, self.ui.ch_osc_enable.isChecked())
  803. settings.setValue(CARLA_KEY_OSC_TCP_PORT_ENABLED, self.ui.group_osc_tcp_port.isChecked())
  804. settings.setValue(CARLA_KEY_OSC_UDP_PORT_ENABLED, self.ui.group_osc_udp_port.isChecked())
  805. settings.setValue(CARLA_KEY_OSC_TCP_PORT_RANDOM, self.ui.rb_osc_tcp_port_random.isChecked())
  806. settings.setValue(CARLA_KEY_OSC_UDP_PORT_RANDOM, self.ui.rb_osc_udp_port_random.isChecked())
  807. settings.setValue(CARLA_KEY_OSC_TCP_PORT_NUMBER, self.ui.sb_osc_tcp_port_number.value())
  808. settings.setValue(CARLA_KEY_OSC_UDP_PORT_NUMBER, self.ui.sb_osc_udp_port_number.value())
  809. # -------------------------------------------------------------------------------------------------------------
  810. # File Paths
  811. audioPaths = []
  812. midiPaths = []
  813. for i in range(self.ui.lw_files_audio.count()):
  814. audioPaths.append(self.ui.lw_files_audio.item(i).text())
  815. for i in range(self.ui.lw_files_midi.count()):
  816. midiPaths.append(self.ui.lw_files_midi.item(i).text())
  817. self.host.set_engine_option(ENGINE_OPTION_FILE_PATH, FILE_AUDIO, splitter.join(audioPaths))
  818. self.host.set_engine_option(ENGINE_OPTION_FILE_PATH, FILE_MIDI, splitter.join(midiPaths))
  819. settings.setValue(CARLA_KEY_PATHS_AUDIO, audioPaths)
  820. settings.setValue(CARLA_KEY_PATHS_MIDI, midiPaths)
  821. # -------------------------------------------------------------------------------------------------------------
  822. # Plugin Paths
  823. ladspas = []
  824. dssis = []
  825. lv2s = []
  826. vst2s = []
  827. vst3s = []
  828. sf2s = []
  829. sfzs = []
  830. for i in range(self.ui.lw_ladspa.count()):
  831. ladspas.append(self.ui.lw_ladspa.item(i).text())
  832. for i in range(self.ui.lw_dssi.count()):
  833. dssis.append(self.ui.lw_dssi.item(i).text())
  834. for i in range(self.ui.lw_lv2.count()):
  835. lv2s.append(self.ui.lw_lv2.item(i).text())
  836. for i in range(self.ui.lw_vst.count()):
  837. vst2s.append(self.ui.lw_vst.item(i).text())
  838. for i in range(self.ui.lw_vst3.count()):
  839. vst3s.append(self.ui.lw_vst3.item(i).text())
  840. for i in range(self.ui.lw_sf2.count()):
  841. sf2s.append(self.ui.lw_sf2.item(i).text())
  842. for i in range(self.ui.lw_sfz.count()):
  843. sfzs.append(self.ui.lw_sfz.item(i).text())
  844. self.host.set_engine_option(ENGINE_OPTION_PLUGIN_PATH, PLUGIN_LADSPA, splitter.join(ladspas))
  845. self.host.set_engine_option(ENGINE_OPTION_PLUGIN_PATH, PLUGIN_DSSI, splitter.join(dssis))
  846. self.host.set_engine_option(ENGINE_OPTION_PLUGIN_PATH, PLUGIN_LV2, splitter.join(lv2s))
  847. self.host.set_engine_option(ENGINE_OPTION_PLUGIN_PATH, PLUGIN_VST2, splitter.join(vst2s))
  848. self.host.set_engine_option(ENGINE_OPTION_PLUGIN_PATH, PLUGIN_VST3, splitter.join(vst3s))
  849. self.host.set_engine_option(ENGINE_OPTION_PLUGIN_PATH, PLUGIN_SF2, splitter.join(sf2s))
  850. self.host.set_engine_option(ENGINE_OPTION_PLUGIN_PATH, PLUGIN_SFZ, splitter.join(sfzs))
  851. settings.setValue(CARLA_KEY_PATHS_LADSPA, ladspas)
  852. settings.setValue(CARLA_KEY_PATHS_DSSI, dssis)
  853. settings.setValue(CARLA_KEY_PATHS_LV2, lv2s)
  854. settings.setValue(CARLA_KEY_PATHS_VST2, vst2s)
  855. settings.setValue(CARLA_KEY_PATHS_VST3, vst3s)
  856. settings.setValue(CARLA_KEY_PATHS_SF2, sf2s)
  857. settings.setValue(CARLA_KEY_PATHS_SFZ, sfzs)
  858. # -------------------------------------------------------------------------------------------------------------
  859. # Wine
  860. settings.setValue(CARLA_KEY_WINE_EXECUTABLE, self.ui.le_wine_exec.text())
  861. settings.setValue(CARLA_KEY_WINE_AUTO_PREFIX, self.ui.cb_wine_prefix_detect.isChecked())
  862. settings.setValue(CARLA_KEY_WINE_FALLBACK_PREFIX, self.ui.le_wine_prefix_fallback.text())
  863. settings.setValue(CARLA_KEY_WINE_RT_PRIO_ENABLED, self.ui.group_wine_realtime.isChecked())
  864. settings.setValue(CARLA_KEY_WINE_BASE_RT_PRIO, self.ui.sb_wine_base_prio.value())
  865. settings.setValue(CARLA_KEY_WINE_SERVER_RT_PRIO, self.ui.sb_wine_server_prio.value())
  866. # -------------------------------------------------------------------------------------------------------------
  867. # Experimental
  868. settings.setValue(CARLA_KEY_EXPERIMENTAL_JACK_APPS, self.ui.ch_exp_jack_apps.isChecked())
  869. settings.setValue(CARLA_KEY_EXPERIMENTAL_LOAD_LIB_GLOBAL, self.ui.ch_exp_load_lib_global.isChecked())
  870. settings.setValue(CARLA_KEY_EXPERIMENTAL_PREVENT_BAD_BEHAVIOUR,
  871. self.ui.ch_exp_prevent_bad_behaviour.isChecked())
  872. # -----------------------------------------------------------------------------------------------------------------
  873. @pyqtSlot()
  874. def slot_resetSettings(self):
  875. currentRow = self.ui.lw_page.currentRow()
  876. # -------------------------------------------------------------------------------------------------------------
  877. # Main
  878. if currentRow == self.TAB_INDEX_MAIN:
  879. self.ui.le_main_proj_folder.setText(CARLA_DEFAULT_MAIN_PROJECT_FOLDER)
  880. self.ui.ch_main_theme_pro.setChecked(CARLA_DEFAULT_MAIN_USE_PRO_THEME and
  881. self.ui.group_main_theme.isEnabled())
  882. self.ui.cb_main_theme_color.setCurrentIndex(
  883. self.ui.cb_main_theme_color.findText(CARLA_DEFAULT_MAIN_PRO_THEME_COLOR))
  884. self.ui.sb_main_refresh_interval.setValue(CARLA_DEFAULT_MAIN_REFRESH_INTERVAL)
  885. self.ui.ch_main_confirm_exit.setChecked(CARLA_DEFAULT_MAIN_CONFIRM_EXIT)
  886. self.ui.cb_main_classic_skin_default(CARLA_DEFAULT_MAIN_CLASSIC_SKIN)
  887. self.ui.ch_main_show_logs.setChecked(CARLA_DEFAULT_MAIN_SHOW_LOGS)
  888. # -------------------------------------------------------------------------------------------------------------
  889. # Canvas
  890. elif currentRow == self.TAB_INDEX_CANVAS:
  891. self.ui.cb_canvas_theme.setCurrentIndex(self.ui.cb_canvas_theme.findText(CARLA_DEFAULT_CANVAS_THEME))
  892. self.ui.cb_canvas_size.setCurrentIndex(self.ui.cb_canvas_size.findText(CARLA_DEFAULT_CANVAS_SIZE))
  893. self.ui.cb_canvas_bezier_lines.setChecked(CARLA_DEFAULT_CANVAS_USE_BEZIER_LINES)
  894. self.ui.cb_canvas_hide_groups.setChecked(CARLA_DEFAULT_CANVAS_AUTO_HIDE_GROUPS)
  895. self.ui.cb_canvas_auto_select.setChecked(CARLA_DEFAULT_CANVAS_AUTO_SELECT_ITEMS)
  896. self.ui.cb_canvas_eyecandy.setChecked(CARLA_DEFAULT_CANVAS_EYE_CANDY and self.ui.cb_canvas_eyecandy.isEnabled())
  897. self.ui.cb_canvas_render_aa.setCheckState(Qt.PartiallyChecked) # CARLA_DEFAULT_CANVAS_ANTIALIASING
  898. self.ui.cb_canvas_full_repaints.setChecked(CARLA_DEFAULT_CANVAS_FULL_REPAINTS)
  899. # -------------------------------------------------------------------------------------------------------------
  900. # Engine
  901. elif currentRow == self.TAB_INDEX_ENGINE:
  902. if not self.host.isPlugin:
  903. self.ui.cb_engine_audio_driver.setCurrentIndex(0)
  904. if not self.host.processModeForced:
  905. if self.ui.cb_engine_audio_driver.currentText() == "JACK":
  906. self.ui.cb_engine_process_mode_jack.setCurrentIndex(CARLA_DEFAULT_PROCESS_MODE)
  907. self.ui.sw_engine_process_mode.setCurrentIndex(0) # show all modes
  908. else:
  909. self.ui.cb_engine_process_mode_other.setCurrentIndex(CARLA_DEFAULT_PROCESS_MODE -
  910. self.PROCESS_MODE_NON_JACK_PADDING)
  911. self.ui.sw_engine_process_mode.setCurrentIndex(1) # hide single+multi client modes
  912. self.ui.sb_engine_max_params.setValue(CARLA_DEFAULT_MAX_PARAMETERS)
  913. self.ui.cb_engine_reset_xruns.setChecked(CARLA_DEFAULT_RESET_XRUNS)
  914. self.ui.ch_engine_uis_always_on_top.setChecked(CARLA_DEFAULT_UIS_ALWAYS_ON_TOP)
  915. self.ui.ch_engine_prefer_ui_bridges.setChecked(CARLA_DEFAULT_PREFER_UI_BRIDGES)
  916. self.ui.sb_engine_ui_bridges_timeout.setValue(CARLA_DEFAULT_UI_BRIDGES_TIMEOUT)
  917. self.ui.ch_engine_manage_uis.setChecked(CARLA_DEFAULT_MANAGE_UIS)
  918. # -------------------------------------------------------------------------------------------------------------
  919. # OSC
  920. elif currentRow == self.TAB_INDEX_OSC:
  921. self.ui.ch_osc_enable.setChecked(CARLA_DEFAULT_OSC_ENABLED)
  922. self.ui.group_osc_tcp_port.setChecked(CARLA_DEFAULT_OSC_TCP_PORT_ENABLED)
  923. self.ui.group_osc_udp_port.setChecked(CARLA_DEFAULT_OSC_UDP_PORT_ENABLED)
  924. self.ui.sb_osc_tcp_port_number.setValue(CARLA_DEFAULT_OSC_TCP_PORT_NUMBER)
  925. self.ui.sb_osc_udp_port_number.setValue(CARLA_DEFAULT_OSC_UDP_PORT_NUMBER)
  926. if CARLA_DEFAULT_OSC_TCP_PORT_RANDOM:
  927. self.ui.rb_osc_tcp_port_specific.setChecked(False)
  928. self.ui.rb_osc_tcp_port_random.setChecked(True)
  929. else:
  930. self.ui.rb_osc_tcp_port_random.setChecked(False)
  931. self.ui.rb_osc_tcp_port_specific.setChecked(True)
  932. if CARLA_DEFAULT_OSC_UDP_PORT_RANDOM:
  933. self.ui.rb_osc_udp_port_specific.setChecked(False)
  934. self.ui.rb_osc_udp_port_random.setChecked(True)
  935. else:
  936. self.ui.rb_osc_udp_port_random.setChecked(False)
  937. self.ui.rb_osc_udp_port_specific.setChecked(True)
  938. # -------------------------------------------------------------------------------------------------------------
  939. # Plugin Paths
  940. elif currentRow == self.TAB_INDEX_FILEPATHS:
  941. curIndex = self.ui.tw_filepaths.currentIndex()
  942. if curIndex == self.FILEPATH_INDEX_AUDIO:
  943. self.ui.lw_files_audio.clear()
  944. elif curIndex == self.FILEPATH_INDEX_MIDI:
  945. self.ui.lw_files_midi.clear()
  946. # -------------------------------------------------------------------------------------------------------------
  947. # Plugin Paths
  948. elif currentRow == self.TAB_INDEX_PLUGINPATHS:
  949. curIndex = self.ui.tw_paths.currentIndex()
  950. if curIndex == self.PLUGINPATH_INDEX_LADSPA:
  951. paths = CARLA_DEFAULT_LADSPA_PATH
  952. paths.sort()
  953. self.ui.lw_ladspa.clear()
  954. for path in paths:
  955. if not path:
  956. continue
  957. self.ui.lw_ladspa.addItem(path)
  958. elif curIndex == self.PLUGINPATH_INDEX_DSSI:
  959. paths = CARLA_DEFAULT_DSSI_PATH
  960. paths.sort()
  961. self.ui.lw_dssi.clear()
  962. for path in paths:
  963. if not path:
  964. continue
  965. self.ui.lw_dssi.addItem(path)
  966. elif curIndex == self.PLUGINPATH_INDEX_LV2:
  967. paths = CARLA_DEFAULT_LV2_PATH
  968. paths.sort()
  969. self.ui.lw_lv2.clear()
  970. for path in paths:
  971. if not path:
  972. continue
  973. self.ui.lw_lv2.addItem(path)
  974. elif curIndex == self.PLUGINPATH_INDEX_VST2:
  975. paths = CARLA_DEFAULT_VST2_PATH
  976. paths.sort()
  977. self.ui.lw_vst.clear()
  978. for path in paths:
  979. if not path:
  980. continue
  981. self.ui.lw_vst.addItem(path)
  982. elif curIndex == self.PLUGINPATH_INDEX_VST3:
  983. paths = CARLA_DEFAULT_VST3_PATH
  984. paths.sort()
  985. self.ui.lw_vst3.clear()
  986. for path in paths:
  987. if not path:
  988. continue
  989. self.ui.lw_vst3.addItem(path)
  990. elif curIndex == self.PLUGINPATH_INDEX_SF2:
  991. paths = CARLA_DEFAULT_SF2_PATH
  992. paths.sort()
  993. self.ui.lw_sf2.clear()
  994. for path in paths:
  995. if not path:
  996. continue
  997. self.ui.lw_sf2.addItem(path)
  998. elif curIndex == self.PLUGINPATH_INDEX_SFZ:
  999. paths = CARLA_DEFAULT_SFZ_PATH
  1000. paths.sort()
  1001. self.ui.lw_sfz.clear()
  1002. for path in paths:
  1003. if not path:
  1004. continue
  1005. self.ui.lw_sfz.addItem(path)
  1006. # -------------------------------------------------------------------------------------------------------------
  1007. # Wine
  1008. elif currentRow == self.TAB_INDEX_WINE:
  1009. self.ui.le_wine_exec.setText(CARLA_DEFAULT_WINE_EXECUTABLE)
  1010. self.ui.cb_wine_prefix_detect.setChecked(CARLA_DEFAULT_WINE_AUTO_PREFIX)
  1011. self.ui.le_wine_prefix_fallback.setText(CARLA_DEFAULT_WINE_FALLBACK_PREFIX)
  1012. self.ui.group_wine_realtime.setChecked(CARLA_DEFAULT_WINE_RT_PRIO_ENABLED)
  1013. self.ui.sb_wine_base_prio.setValue(CARLA_DEFAULT_WINE_BASE_RT_PRIO)
  1014. self.ui.sb_wine_server_prio.setValue(CARLA_DEFAULT_WINE_SERVER_RT_PRIO)
  1015. # -------------------------------------------------------------------------------------------------------------
  1016. # Experimental
  1017. elif currentRow == self.TAB_INDEX_EXPERIMENTAL:
  1018. self.resetExperimentalSettings()
  1019. def resetExperimentalSettings(self):
  1020. # Forever experimental
  1021. self.ui.cb_exp_plugin_bridges.setChecked(CARLA_DEFAULT_EXPERIMENTAL_PLUGIN_BRIDGES)
  1022. self.ui.ch_exp_wine_bridges.setChecked(CARLA_DEFAULT_EXPERIMENTAL_WINE_BRIDGES)
  1023. self.ui.ch_exp_jack_apps.setChecked(CARLA_DEFAULT_EXPERIMENTAL_JACK_APPS)
  1024. self.ui.ch_exp_export_lv2.setChecked(CARLA_DEFAULT_EXPERIMENTAL_LV2_EXPORT)
  1025. self.ui.ch_exp_load_lib_global.setChecked(CARLA_DEFAULT_EXPERIMENTAL_LOAD_LIB_GLOBAL)
  1026. self.ui.ch_exp_prevent_bad_behaviour.setChecked(CARLA_DEFAULT_EXPERIMENTAL_PREVENT_BAD_BEHAVIOUR)
  1027. # Temporary, until stable
  1028. self.ui.ch_main_system_icons.setChecked(CARLA_DEFAULT_MAIN_SYSTEM_ICONS)
  1029. self.ui.cb_canvas_fancy_eyecandy.setChecked(CARLA_DEFAULT_CANVAS_FANCY_EYE_CANDY)
  1030. self.ui.cb_canvas_use_opengl.setChecked(CARLA_DEFAULT_CANVAS_USE_OPENGL and
  1031. self.ui.cb_canvas_use_opengl.isEnabled())
  1032. self.ui.cb_canvas_render_hq_aa.setChecked(CARLA_DEFAULT_CANVAS_HQ_ANTIALIASING and
  1033. self.ui.cb_canvas_render_hq_aa.isEnabled())
  1034. self.ui.cb_canvas_inline_displays.setChecked(CARLA_DEFAULT_CANVAS_INLINE_DISPLAYS)
  1035. self.ui.ch_engine_force_stereo.setChecked(CARLA_DEFAULT_FORCE_STEREO)
  1036. self.ui.ch_engine_prefer_plugin_bridges.setChecked(CARLA_DEFAULT_PREFER_PLUGIN_BRIDGES)
  1037. # -----------------------------------------------------------------------------------------------------------------
  1038. @pyqtSlot(bool)
  1039. def slot_enableExperimental(self, toggled):
  1040. if toggled:
  1041. self.ui.lw_page.showRow(self.TAB_INDEX_EXPERIMENTAL)
  1042. if self.ui.ch_exp_wine_bridges.isChecked() and not self.host.isControl:
  1043. self.ui.lw_page.showRow(self.TAB_INDEX_WINE)
  1044. else:
  1045. self.ui.lw_page.hideRow(self.TAB_INDEX_EXPERIMENTAL)
  1046. self.ui.lw_page.hideRow(self.TAB_INDEX_WINE)
  1047. @pyqtSlot(bool)
  1048. def slot_enableWineBridges(self, toggled):
  1049. if toggled and not self.host.isControl:
  1050. self.ui.lw_page.showRow(self.TAB_INDEX_WINE)
  1051. else:
  1052. self.ui.lw_page.hideRow(self.TAB_INDEX_WINE)
  1053. @pyqtSlot(bool)
  1054. def slot_pluginBridgesToggled(self, toggled):
  1055. if not toggled:
  1056. self.ui.ch_exp_wine_bridges.setChecked(False)
  1057. self.ui.ch_engine_prefer_plugin_bridges.setChecked(False)
  1058. self.ui.lw_page.hideRow(self.TAB_INDEX_WINE)
  1059. @pyqtSlot(bool)
  1060. def slot_canvasEyeCandyToggled(self, toggled):
  1061. if not toggled:
  1062. # disable fancy eyecandy too
  1063. self.ui.cb_canvas_fancy_eyecandy.setChecked(False)
  1064. @pyqtSlot(bool)
  1065. def slot_canvasFancyEyeCandyToggled(self, toggled):
  1066. if toggled:
  1067. # make sure normal eyecandy is enabled too
  1068. self.ui.cb_canvas_eyecandy.setChecked(True)
  1069. @pyqtSlot(bool)
  1070. def slot_canvasOpenGLToggled(self, toggled):
  1071. if not toggled:
  1072. # uncheck GL specific option
  1073. self.ui.cb_canvas_render_hq_aa.setChecked(False)
  1074. # -----------------------------------------------------------------------------------------------------------------
  1075. @pyqtSlot()
  1076. def slot_getAndSetProjectPath(self):
  1077. # FIXME
  1078. getAndSetPath(self, self.ui.le_main_proj_folder)
  1079. # -----------------------------------------------------------------------------------------------------------------
  1080. @pyqtSlot()
  1081. def slot_engineAudioDriverChanged(self):
  1082. if self.ui.cb_engine_audio_driver.currentText() == "JACK":
  1083. self.ui.sw_engine_process_mode.setCurrentIndex(0)
  1084. else:
  1085. self.ui.sw_engine_process_mode.setCurrentIndex(1)
  1086. @pyqtSlot()
  1087. def slot_showAudioDriverSettings(self):
  1088. driverIndex = self.ui.cb_engine_audio_driver.currentIndex()
  1089. driverName = self.ui.cb_engine_audio_driver.currentText()
  1090. DriverSettingsW(self, self.host, driverIndex, driverName).exec_()
  1091. # -----------------------------------------------------------------------------------------------------------------
  1092. @pyqtSlot()
  1093. def slot_addPluginPath(self):
  1094. newPath = QFileDialog.getExistingDirectory(self, self.tr("Add Path"), "", QFileDialog.ShowDirsOnly)
  1095. if not newPath:
  1096. return
  1097. curIndex = self.ui.tw_paths.currentIndex()
  1098. if curIndex == self.PLUGINPATH_INDEX_LADSPA:
  1099. self.ui.lw_ladspa.addItem(newPath)
  1100. elif curIndex == self.PLUGINPATH_INDEX_DSSI:
  1101. self.ui.lw_dssi.addItem(newPath)
  1102. elif curIndex == self.PLUGINPATH_INDEX_LV2:
  1103. self.ui.lw_lv2.addItem(newPath)
  1104. elif curIndex == self.PLUGINPATH_INDEX_VST2:
  1105. self.ui.lw_vst.addItem(newPath)
  1106. elif curIndex == self.PLUGINPATH_INDEX_VST3:
  1107. self.ui.lw_vst3.addItem(newPath)
  1108. elif curIndex == self.PLUGINPATH_INDEX_SF2:
  1109. self.ui.lw_sf2.addItem(newPath)
  1110. elif curIndex == self.PLUGINPATH_INDEX_SFZ:
  1111. self.ui.lw_sfz.addItem(newPath)
  1112. @pyqtSlot()
  1113. def slot_removePluginPath(self):
  1114. curIndex = self.ui.tw_paths.currentIndex()
  1115. if curIndex == self.PLUGINPATH_INDEX_LADSPA:
  1116. self.ui.lw_ladspa.takeItem(self.ui.lw_ladspa.currentRow())
  1117. elif curIndex == self.PLUGINPATH_INDEX_DSSI:
  1118. self.ui.lw_dssi.takeItem(self.ui.lw_dssi.currentRow())
  1119. elif curIndex == self.PLUGINPATH_INDEX_LV2:
  1120. self.ui.lw_lv2.takeItem(self.ui.lw_lv2.currentRow())
  1121. elif curIndex == self.PLUGINPATH_INDEX_VST2:
  1122. self.ui.lw_vst.takeItem(self.ui.lw_vst.currentRow())
  1123. elif curIndex == self.PLUGINPATH_INDEX_VST3:
  1124. self.ui.lw_vst3.takeItem(self.ui.lw_vst3.currentRow())
  1125. elif curIndex == self.PLUGINPATH_INDEX_SF2:
  1126. self.ui.lw_sf2.takeItem(self.ui.lw_sf2.currentRow())
  1127. elif curIndex == self.PLUGINPATH_INDEX_SFZ:
  1128. self.ui.lw_sfz.takeItem(self.ui.lw_sfz.currentRow())
  1129. @pyqtSlot()
  1130. def slot_changePluginPath(self):
  1131. curIndex = self.ui.tw_paths.currentIndex()
  1132. if curIndex == self.PLUGINPATH_INDEX_LADSPA:
  1133. currentPath = self.ui.lw_ladspa.currentItem().text()
  1134. elif curIndex == self.PLUGINPATH_INDEX_DSSI:
  1135. currentPath = self.ui.lw_dssi.currentItem().text()
  1136. elif curIndex == self.PLUGINPATH_INDEX_LV2:
  1137. currentPath = self.ui.lw_lv2.currentItem().text()
  1138. elif curIndex == self.PLUGINPATH_INDEX_VST2:
  1139. currentPath = self.ui.lw_vst.currentItem().text()
  1140. elif curIndex == self.PLUGINPATH_INDEX_VST3:
  1141. currentPath = self.ui.lw_vst3.currentItem().text()
  1142. elif curIndex == self.PLUGINPATH_INDEX_SF2:
  1143. currentPath = self.ui.lw_sf2.currentItem().text()
  1144. elif curIndex == self.PLUGINPATH_INDEX_SFZ:
  1145. currentPath = self.ui.lw_sfz.currentItem().text()
  1146. else:
  1147. currentPath = ""
  1148. newPath = QFileDialog.getExistingDirectory(self, self.tr("Add Path"), currentPath, QFileDialog.ShowDirsOnly)
  1149. if not newPath:
  1150. return
  1151. if curIndex == self.PLUGINPATH_INDEX_LADSPA:
  1152. self.ui.lw_ladspa.currentItem().setText(newPath)
  1153. elif curIndex == self.PLUGINPATH_INDEX_DSSI:
  1154. self.ui.lw_dssi.currentItem().setText(newPath)
  1155. elif curIndex == self.PLUGINPATH_INDEX_LV2:
  1156. self.ui.lw_lv2.currentItem().setText(newPath)
  1157. elif curIndex == self.PLUGINPATH_INDEX_VST2:
  1158. self.ui.lw_vst.currentItem().setText(newPath)
  1159. elif curIndex == self.PLUGINPATH_INDEX_VST3:
  1160. self.ui.lw_vst3.currentItem().setText(newPath)
  1161. elif curIndex == self.PLUGINPATH_INDEX_SF2:
  1162. self.ui.lw_sf2.currentItem().setText(newPath)
  1163. elif curIndex == self.PLUGINPATH_INDEX_SFZ:
  1164. self.ui.lw_sfz.currentItem().setText(newPath)
  1165. # -----------------------------------------------------------------------------------------------------------------
  1166. @pyqtSlot(int)
  1167. def slot_pluginPathTabChanged(self, index):
  1168. if index == self.PLUGINPATH_INDEX_LADSPA:
  1169. row = self.ui.lw_ladspa.currentRow()
  1170. elif index == self.PLUGINPATH_INDEX_DSSI:
  1171. row = self.ui.lw_dssi.currentRow()
  1172. elif index == self.PLUGINPATH_INDEX_LV2:
  1173. row = self.ui.lw_lv2.currentRow()
  1174. elif index == self.PLUGINPATH_INDEX_VST2:
  1175. row = self.ui.lw_vst.currentRow()
  1176. elif index == self.PLUGINPATH_INDEX_VST3:
  1177. row = self.ui.lw_vst3.currentRow()
  1178. elif index == self.PLUGINPATH_INDEX_SF2:
  1179. row = self.ui.lw_sf2.currentRow()
  1180. elif index == self.PLUGINPATH_INDEX_SFZ:
  1181. row = self.ui.lw_sfz.currentRow()
  1182. else:
  1183. row = -1
  1184. self.slot_pluginPathRowChanged(row)
  1185. @pyqtSlot(int)
  1186. def slot_pluginPathRowChanged(self, row):
  1187. check = bool(row >= 0)
  1188. self.ui.b_paths_remove.setEnabled(check)
  1189. self.ui.b_paths_change.setEnabled(check)
  1190. # -----------------------------------------------------------------------------------------------------------------
  1191. @pyqtSlot()
  1192. def slot_addFilePath(self):
  1193. newPath = QFileDialog.getExistingDirectory(self, self.tr("Add Path"), "", QFileDialog.ShowDirsOnly)
  1194. if not newPath:
  1195. return
  1196. curIndex = self.ui.tw_filepaths.currentIndex()
  1197. if curIndex == self.FILEPATH_INDEX_AUDIO:
  1198. self.ui.lw_files_audio.addItem(newPath)
  1199. elif curIndex == self.FILEPATH_INDEX_MIDI:
  1200. self.ui.lw_files_midi.addItem(newPath)
  1201. @pyqtSlot()
  1202. def slot_removeFilePath(self):
  1203. curIndex = self.ui.tw_filepaths.currentIndex()
  1204. if curIndex == self.FILEPATH_INDEX_AUDIO:
  1205. self.ui.lw_files_audio.takeItem(self.ui.lw_files_audio.currentRow())
  1206. elif curIndex == self.FILEPATH_INDEX_MIDI:
  1207. self.ui.lw_files_midi.takeItem(self.ui.lw_files_midi.currentRow())
  1208. @pyqtSlot()
  1209. def slot_changeFilePath(self):
  1210. curIndex = self.ui.tw_filepaths.currentIndex()
  1211. if curIndex == self.FILEPATH_INDEX_AUDIO:
  1212. currentPath = self.ui.lw_files_audio.currentItem().text()
  1213. elif curIndex == self.FILEPATH_INDEX_MIDI:
  1214. currentPath = self.ui.lw_files_midi.currentItem().text()
  1215. else:
  1216. currentPath = ""
  1217. newPath = QFileDialog.getExistingDirectory(self, self.tr("Add Path"), currentPath, QFileDialog.ShowDirsOnly)
  1218. if not newPath:
  1219. return
  1220. if curIndex == self.FILEPATH_INDEX_AUDIO:
  1221. self.ui.lw_files_audio.currentItem().setText(newPath)
  1222. elif curIndex == self.FILEPATH_INDEX_MIDI:
  1223. self.ui.lw_files_midi.currentItem().setText(newPath)
  1224. # -----------------------------------------------------------------------------------------------------------------
  1225. @pyqtSlot(int)
  1226. def slot_filePathTabChanged(self, index):
  1227. if index == self.FILEPATH_INDEX_AUDIO:
  1228. row = self.ui.lw_files_audio.currentRow()
  1229. elif index == self.FILEPATH_INDEX_MIDI:
  1230. row = self.ui.lw_files_midi.currentRow()
  1231. else:
  1232. row = -1
  1233. self.slot_filePathRowChanged(row)
  1234. @pyqtSlot(int)
  1235. def slot_filePathRowChanged(self, row):
  1236. check = bool(row >= 0)
  1237. self.ui.b_filepaths_remove.setEnabled(check)
  1238. self.ui.b_filepaths_change.setEnabled(check)
  1239. # ---------------------------------------------------------------------------------------------------------------------
  1240. # Main
  1241. if __name__ == '__main__':
  1242. from carla_app import CarlaApplication
  1243. from carla_host import initHost as _initHost, loadHostSettings as _loadHostSettings
  1244. # pylint: disable=ungrouped-imports
  1245. from carla_shared import handleInitialCommandLineArguments
  1246. # pylint: enable=ungrouped-imports
  1247. initName, libPrefix = handleInitialCommandLineArguments(__file__ if "__file__" in dir() else None)
  1248. _app = CarlaApplication("Carla2-Settings", libPrefix)
  1249. _host = _initHost("Carla2-Settings", libPrefix, False, False, False)
  1250. _loadHostSettings(_host)
  1251. _gui = CarlaSettingsW(None, _host, True, True)
  1252. _gui.show()
  1253. _app.exit_exec()
  1254. # ---------------------------------------------------------------------------------------------------------------------