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.

1110 lines
45KB

  1. #!/usr/bin/env python3
  2. # -*- coding: utf-8 -*-
  3. # Carla Backend code
  4. # Copyright (C) 2011-2012 Filipe Coelho <falktx@falktx.com>
  5. #
  6. # This program is free software; you can redistribute it and/or modify
  7. # it under the terms of the GNU General Public License as published by
  8. # the Free Software Foundation; either version 2 of the License, or
  9. # 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 COPYING file
  17. # Imports (Global)
  18. from PyQt4.QtGui import QApplication, QMainWindow, QTableWidgetItem
  19. # Imports (Custom Stuff)
  20. import ui_carla, ui_carla_database, ui_carla_refresh
  21. from carla_backend import *
  22. #from shared_settings import *
  23. # set defaults
  24. DEFAULT_PROJECT_FOLDER = HOME
  25. #setDefaultProjectFolder(DEFAULT_PROJECT_FOLDER)
  26. #setDefaultPluginsPaths(LADSPA_PATH, DSSI_PATH, LV2_PATH, VST_PATH, GIG_PATH, SF2_PATH, SFZ_PATH)
  27. # Main Window
  28. class CarlaMainW(QMainWindow):
  29. def __init__(self, parent=None):
  30. QMainWindow.__init__(self, parent)
  31. self.ui = ui_carla.Ui_CarlaMainW()
  32. self.ui.setupUi(self)
  33. # -------------------------------------------------------------
  34. # Load Settings
  35. self.loadSettings(True)
  36. self.loadRDFs()
  37. self.setStyleSheet("""
  38. QWidget#centralwidget {
  39. background-color: qlineargradient(spread:pad,
  40. x1:0.0, y1:0.0,
  41. x2:0.2, y2:1.0,
  42. stop:0 rgb( 7, 7, 7),
  43. stop:1 rgb(28, 28, 28)
  44. );
  45. }
  46. """)
  47. # -------------------------------------------------------------
  48. # Internal stuff
  49. self.fEngineStarted = False
  50. self.fFirstEngineInit = False
  51. #self.m_project_filename = None
  52. #self.m_pluginCount = 0
  53. #self._nsmAnnounce2str = ""
  54. #self._nsmOpen1str = ""
  55. #self._nsmOpen2str = ""
  56. #self.nsm_server = None
  57. #self.nsm_url = None
  58. #self.m_plugin_list = []
  59. #for x in range(MAX_DEFAULT_PLUGINS):
  60. #self.m_plugin_list.append(None)
  61. # -------------------------------------------------------------
  62. # Set-up GUI stuff
  63. self.ui.act_engine_start.setEnabled(False)
  64. self.ui.act_engine_stop.setEnabled(False)
  65. self.ui.act_plugin_remove_all.setEnabled(False)
  66. #self.m_scene = CarlaScene(self, self.graphicsView)
  67. #self.graphicsView.setScene(self.m_scene)
  68. self.resize(self.width(), 0)
  69. #self.m_fakeEdit = PluginEdit(self, -1)
  70. #self.m_curEdit = self.m_fakeEdit
  71. #self.w_edit.layout().addWidget(self.m_curEdit)
  72. #self.w_edit.layout().addStretch()
  73. # -------------------------------------------------------------
  74. # Connect actions to functions
  75. #self.connect(self.act_file_new, SIGNAL("triggered()"), SLOT("slot_file_new()"))
  76. #self.connect(self.act_file_open, SIGNAL("triggered()"), SLOT("slot_file_open()"))
  77. #self.connect(self.act_file_save, SIGNAL("triggered()"), SLOT("slot_file_save()"))
  78. #self.connect(self.act_file_save_as, SIGNAL("triggered()"), SLOT("slot_file_save_as()"))
  79. self.connect(self.ui.act_engine_start, SIGNAL("triggered()"), SLOT("slot_startEngine()"))
  80. self.connect(self.ui.act_engine_stop, SIGNAL("triggered()"), SLOT("slot_stopEngine()"))
  81. self.connect(self.ui.act_plugin_add, SIGNAL("triggered()"), SLOT("slot_addPlugin()"))
  82. #self.connect(self.act_plugin_remove_all, SIGNAL("triggered()"), SLOT("slot_remove_all()"))
  83. #self.connect(self.act_settings_configure, SIGNAL("triggered()"), SLOT("slot_configureCarla()"))
  84. self.connect(self.ui.act_help_about, SIGNAL("triggered()"), SLOT("slot_aboutCarla()"))
  85. self.connect(self.ui.act_help_about_qt, SIGNAL("triggered()"), app, SLOT("aboutQt()"))
  86. #self.connect(self, SIGNAL("SIGUSR1()"), SLOT("slot_handleSIGUSR1()"))
  87. #self.connect(self, SIGNAL("DebugCallback(int, int, int, double, QString)"), SLOT("slot_handleDebugCallback(int, int, int, double, QString)"))
  88. #self.connect(self, SIGNAL("ParameterValueCallback(int, int, double)"), SLOT("slot_handleParameterValueCallback(int, int, double)"))
  89. #self.connect(self, SIGNAL("ParameterMidiChannelCallback(int, int, int)"), SLOT("slot_handleParameterMidiChannelCallback(int, int, int)"))
  90. #self.connect(self, SIGNAL("ParameterMidiCcCallback(int, int, int)"), SLOT("slot_handleParameterMidiCcCallback(int, int, int)"))
  91. #self.connect(self, SIGNAL("ProgramCallback(int, int)"), SLOT("slot_handleProgramCallback(int, int)"))
  92. #self.connect(self, SIGNAL("MidiProgramCallback(int, int)"), SLOT("slot_handleMidiProgramCallback(int, int)"))
  93. #self.connect(self, SIGNAL("NoteOnCallback(int, int, int, int)"), SLOT("slot_handleNoteOnCallback(int, int, int, int)"))
  94. #self.connect(self, SIGNAL("NoteOffCallback(int, int, int)"), SLOT("slot_handleNoteOffCallback(int, int, int)"))
  95. #self.connect(self, SIGNAL("ShowGuiCallback(int, int)"), SLOT("slot_handleShowGuiCallback(int, int)"))
  96. #self.connect(self, SIGNAL("ResizeGuiCallback(int, int, int)"), SLOT("slot_handleResizeGuiCallback(int, int, int)"))
  97. #self.connect(self, SIGNAL("UpdateCallback(int)"), SLOT("slot_handleUpdateCallback(int)"))
  98. #self.connect(self, SIGNAL("ReloadInfoCallback(int)"), SLOT("slot_handleReloadInfoCallback(int)"))
  99. #self.connect(self, SIGNAL("ReloadParametersCallback(int)"), SLOT("slot_handleReloadParametersCallback(int)"))
  100. #self.connect(self, SIGNAL("ReloadProgramsCallback(int)"), SLOT("slot_handleReloadProgramsCallback(int)"))
  101. #self.connect(self, SIGNAL("ReloadAllCallback(int)"), SLOT("slot_handleReloadAllCallback(int)"))
  102. #self.connect(self, SIGNAL("NSM_AnnounceCallback()"), SLOT("slot_handleNSM_AnnounceCallback()"))
  103. #self.connect(self, SIGNAL("NSM_Open1Callback()"), SLOT("slot_handleNSM_Open1Callback()"))
  104. #self.connect(self, SIGNAL("NSM_Open2Callback()"), SLOT("slot_handleNSM_Open2Callback()"))
  105. #self.connect(self, SIGNAL("NSM_SaveCallback()"), SLOT("slot_handleNSM_SaveCallback()"))
  106. #self.connect(self, SIGNAL("ErrorCallback(QString)"), SLOT("slot_handleErrorCallback(QString)"))
  107. #self.connect(self, SIGNAL("QuitCallback()"), SLOT("slot_handleQuitCallback()"))
  108. #self.TIMER_GUI_STUFF = self.startTimer(self.m_savedSettings["Main/RefreshInterval"]) # Peaks
  109. #self.TIMER_GUI_STUFF2 = self.startTimer(self.m_savedSettings["Main/RefreshInterval"] * 2) # LEDs and edit dialog
  110. #NSM_URL = os.getenv("NSM_URL")
  111. #if NSM_URL:
  112. #Carla.host.nsm_announce(NSM_URL, os.getpid())
  113. #else:
  114. QTimer.singleShot(0, self, SLOT("slot_startEngine()"))
  115. #QTimer.singleShot(0, self, SLOT("slot_showInitialWarning()"))
  116. #def loadProjectLater(self):
  117. #QTimer.singleShot(0, self.load_project)
  118. def startEngine(self, clientName = "Carla"):
  119. # ---------------------------------------------
  120. # Engine settings
  121. settings = QSettings()
  122. Carla.processMode = settings.value("Engine/ProcessMode", PROCESS_MODE_MULTIPLE_CLIENTS, type=int)
  123. Carla.maxParameters = settings.value("Engine/MaxParameters", MAX_DEFAULT_PARAMETERS, type=int)
  124. forceStereo = settings.value("Engine/ForceStereo", False, type=bool)
  125. preferPluginBridges = settings.value("Engine/PreferPluginBridges", False, type=bool)
  126. preferUiBridges = settings.value("Engine/PreferUiBridges", True, type=bool)
  127. useDssiVstChunks = settings.value("Engine/UseDssiVstChunks", False, type=bool)
  128. oscUiTimeout = settings.value("Engine/OscUiTimeout", 40, type=int)
  129. preferredBufferSize = settings.value("Engine/PreferredBufferSize", 512, type=int)
  130. preferredSampleRate = settings.value("Engine/PreferredSampleRate", 44100, type=int)
  131. if Carla.processMode == PROCESS_MODE_CONTINUOUS_RACK:
  132. forceStereo = True
  133. elif Carla.processMode == PROCESS_MODE_MULTIPLE_CLIENTS and os.getenv("LADISH_APP_NAME"):
  134. print("LADISH detected but using multiple clients (not allowed), forcing single client now")
  135. Carla.processMode = PROCESS_MODE_SINGLE_CLIENT
  136. Carla.host.set_option(OPTION_PROCESS_MODE, Carla.processMode, "")
  137. Carla.host.set_option(OPTION_MAX_PARAMETERS, Carla.maxParameters, "")
  138. Carla.host.set_option(OPTION_FORCE_STEREO, forceStereo, "")
  139. Carla.host.set_option(OPTION_PREFER_PLUGIN_BRIDGES, preferPluginBridges, "")
  140. Carla.host.set_option(OPTION_PREFER_UI_BRIDGES, preferUiBridges, "")
  141. Carla.host.set_option(OPTION_USE_DSSI_VST_CHUNKS, useDssiVstChunks, "")
  142. Carla.host.set_option(OPTION_OSC_UI_TIMEOUT, oscUiTimeout, "")
  143. Carla.host.set_option(OPTION_PREFERRED_BUFFER_SIZE, preferredBufferSize, "")
  144. Carla.host.set_option(OPTION_PREFERRED_SAMPLE_RATE, preferredSampleRate, "")
  145. # ---------------------------------------------
  146. # start
  147. audioDriver = settings.value("Engine/AudioDriver", "JACK", type=str)
  148. if not Carla.host.engine_init(audioDriver, clientName):
  149. if self.fFirstEngineInit:
  150. self.fFirstEngineInit = False
  151. return
  152. self.ui.act_engine_start.setEnabled(True)
  153. self.ui.act_engine_stop.setEnabled(False)
  154. audioError = cString(Carla.host.get_last_error())
  155. if audioError:
  156. QMessageBox.critical(self, self.tr("Error"), self.tr("Could not connect to Audio backend '%s', possible reasons: %s" % (audioDriver, audioError)))
  157. else:
  158. QMessageBox.critical(self, self.tr("Error"), self.tr("Could not connect to Audio backend '%s'" % audioDriver))
  159. return
  160. self.fEngineStarted = True
  161. self.fFirstEngineInit = False
  162. def stopEngine(self):
  163. #if self.m_pluginCount > 0:
  164. #ask = QMessageBox.question(self, self.tr("Warning"), self.tr("There are still some plugins loaded, you need to remove them to stop the engine.\n"
  165. #"Do you want to do this now?"),
  166. #QMessageBox.Yes | QMessageBox.No, QMessageBox.No)
  167. #if ask == QMessageBox.Yes:
  168. #self.slot_remove_all()
  169. #else:
  170. #return
  171. if Carla.host.is_engine_running() and not Carla.host.engine_close():
  172. print(cString(Carla.host.get_last_error()))
  173. self.fEngineStarted = False
  174. def addPlugin(self, btype, ptype, filename, name, label, extraStuff, activate):
  175. if not self.fEngineStarted:
  176. if activate:
  177. QMessageBox.warning(self, self.tr("Warning"), self.tr("Cannot add new plugins while engine is stopped"))
  178. return -1
  179. if not Carla.host.add_plugin(btype, ptype, filename, name, label, extraStuff):
  180. CustomMessageBox(self, QMessageBox.Critical, self.tr("Error"), self.tr("Failed to load plugin"), cString(Carla.host.get_last_error()), QMessageBox.Ok, QMessageBox.Ok)
  181. return False
  182. else:
  183. print("added plugin!!")
  184. new_plugin_id = 0
  185. pwidget = PluginWidget(self, new_plugin_id)
  186. self.ui.w_plugins.layout().addWidget(pwidget)
  187. #self.m_plugin_list[new_plugin_id] = pwidget
  188. self.ui.act_plugin_remove_all.setEnabled(True)
  189. pwidget.ui.peak_in.setRefreshRate(self.fSavedSettings["Main/RefreshInterval"])
  190. pwidget.ui.peak_out.setRefreshRate(self.fSavedSettings["Main/RefreshInterval"])
  191. if activate:
  192. pwidget.setActive(True, True, True)
  193. #self.m_pluginCount += 1
  194. return True
  195. #def pluginWidgetActivated(self, widget):
  196. #if self.m_curEdit == widget:
  197. #self.keyboard.allNotesOff()
  198. #def pluginWidgetClicked(self, widget):
  199. #if self.m_curEdit == widget:
  200. #return
  201. #self.w_edit.layout().removeWidget(self.m_curEdit)
  202. #self.w_edit.layout().insertWidget(0, widget)
  203. #widget.show()
  204. #self.m_curEdit.hide()
  205. #self.m_curEdit = widget
  206. #@pyqtSlot()
  207. #def slot_showInitialWarning(self):
  208. #QMessageBox.warning(self, self.tr("Carla is incomplete"), self.tr(""
  209. #"The version of Carla you're currently running is incomplete.\n"
  210. #"Although most things work fine, Carla is not yet in a stable state.\n"
  211. #"\n"
  212. #"It will be fully functional for the next Cadence beta release."
  213. #""))
  214. @pyqtSlot()
  215. def slot_startEngine(self):
  216. self.startEngine()
  217. check = Carla.host.is_engine_running()
  218. self.ui.act_file_open.setEnabled(check)
  219. self.ui.act_engine_start.setEnabled(not check)
  220. self.ui.act_engine_stop.setEnabled(check)
  221. @pyqtSlot()
  222. def slot_stopEngine(self):
  223. self.stopEngine()
  224. check = Carla.host.is_engine_running()
  225. self.ui.act_file_open.setEnabled(check)
  226. self.ui.act_engine_start.setEnabled(not check)
  227. self.ui.act_engine_stop.setEnabled(check)
  228. #@pyqtSlot()
  229. #def slot_handleSIGUSR1(self):
  230. #print("Got SIGUSR1 -> Saving project now")
  231. #QTimer.singleShot(0, self, SLOT("slot_file_save()"))
  232. #@pyqtSlot(int, int, int, float, str)
  233. #def slot_handleDebugCallback(self, plugin_id, value1, value2, value3, valueStr):
  234. #print("DEBUG :: %i, %i, %i, %f, \"%s\")" % (plugin_id, value1, value2, value3, valueStr))
  235. #@pyqtSlot(int, int, float)
  236. #def slot_handleParameterValueCallback(self, pluginId, parameterId, value):
  237. #pwidget = self.m_plugin_list[pluginId]
  238. #if pwidget:
  239. #pwidget.m_parameterIconTimer = ICON_STATE_ON
  240. #if parameterId == PARAMETER_ACTIVE:
  241. #pwidget.set_active((value > 0.0), True, False)
  242. #elif parameterId == PARAMETER_DRYWET:
  243. #pwidget.set_drywet(value * 1000, True, False)
  244. #elif parameterId == PARAMETER_VOLUME:
  245. #pwidget.set_volume(value * 1000, True, False)
  246. #elif parameterId == PARAMETER_BALANCE_LEFT:
  247. #pwidget.set_balance_left(value * 1000, True, False)
  248. #elif parameterId == PARAMETER_BALANCE_RIGHT:
  249. #pwidget.set_balance_right(value * 1000, True, False)
  250. #elif parameterId >= 0:
  251. #pwidget.edit_dialog.set_parameter_to_update(parameterId)
  252. #@pyqtSlot(int, int, int)
  253. #def slot_handleParameterMidiChannelCallback(self, pluginId, parameterId, channel):
  254. #pwidget = self.m_plugin_list[pluginId]
  255. #if pwidget:
  256. #pwidget.edit_dialog.set_parameter_midi_channel(parameterId, channel, True)
  257. #@pyqtSlot(int, int, int)
  258. #def slot_handleParameterMidiCcCallback(self, pluginId, parameterId, cc):
  259. #pwidget = self.m_plugin_list[pluginId]
  260. #if pwidget:
  261. #pwidget.edit_dialog.set_parameter_midi_cc(parameterId, cc, True)
  262. #@pyqtSlot(int, int)
  263. #def slot_handleProgramCallback(self, plugin_id, program_id):
  264. #pwidget = self.m_plugin_list[plugin_id]
  265. #if pwidget:
  266. #pwidget.edit_dialog.set_program(program_id)
  267. #pwidget.m_parameterIconTimer = ICON_STATE_ON
  268. #@pyqtSlot(int, int)
  269. #def slot_handleMidiProgramCallback(self, plugin_id, midi_program_id):
  270. #pwidget = self.m_plugin_list[plugin_id]
  271. #if pwidget:
  272. #pwidget.edit_dialog.set_midi_program(midi_program_id)
  273. #pwidget.m_parameterIconTimer = ICON_STATE_ON
  274. #@pyqtSlot(int, int, int, int)
  275. #def slot_handleNoteOnCallback(self, plugin_id, channel, note, velo):
  276. #pwidget = self.m_plugin_list[plugin_id]
  277. #if pwidget:
  278. #pwidget.edit_dialog.keyboard.sendNoteOn(note, False)
  279. #@pyqtSlot(int, int, int)
  280. #def slot_handleNoteOffCallback(self, plugin_id, channel, note):
  281. #pwidget = self.m_plugin_list[plugin_id]
  282. #if pwidget:
  283. #pwidget.edit_dialog.keyboard.sendNoteOff(note, False)
  284. #@pyqtSlot(int, int)
  285. #def slot_handleShowGuiCallback(self, plugin_id, show):
  286. #pwidget = self.m_plugin_list[plugin_id]
  287. #if pwidget:
  288. #if show == 0:
  289. #pwidget.b_gui.setChecked(False)
  290. #pwidget.b_gui.setEnabled(True)
  291. #elif show == 1:
  292. #pwidget.b_gui.setChecked(True)
  293. #pwidget.b_gui.setEnabled(True)
  294. #elif show == -1:
  295. #pwidget.b_gui.setChecked(False)
  296. #pwidget.b_gui.setEnabled(False)
  297. #@pyqtSlot(int, int, int)
  298. #def slot_handleResizeGuiCallback(self, plugin_id, width, height):
  299. #pwidget = self.m_plugin_list[plugin_id]
  300. #if pwidget:
  301. #gui_dialog = pwidget.gui_dialog
  302. #if gui_dialog:
  303. #gui_dialog.setNewSize(width, height)
  304. #@pyqtSlot(int)
  305. #def slot_handleUpdateCallback(self, plugin_id):
  306. #pwidget = self.m_plugin_list[plugin_id]
  307. #if pwidget:
  308. #pwidget.edit_dialog.do_update()
  309. #@pyqtSlot(int)
  310. #def slot_handleReloadInfoCallback(self, plugin_id):
  311. #pwidget = self.m_plugin_list[plugin_id]
  312. #if pwidget:
  313. #pwidget.edit_dialog.do_reload_info()
  314. #@pyqtSlot(int)
  315. #def slot_handleReloadParametersCallback(self, plugin_id):
  316. #pwidget = self.m_plugin_list[plugin_id]
  317. #if pwidget:
  318. #pwidget.edit_dialog.do_reload_parameters()
  319. #@pyqtSlot(int)
  320. #def slot_handleReloadProgramsCallback(self, plugin_id):
  321. #pwidget = self.m_plugin_list[plugin_id]
  322. #if pwidget:
  323. #pwidget.edit_dialog.do_reload_programs()
  324. #@pyqtSlot(int)
  325. #def slot_handleReloadAllCallback(self, plugin_id):
  326. #pwidget = self.m_plugin_list[plugin_id]
  327. #if pwidget:
  328. #pwidget.edit_dialog.do_reload_all()
  329. #@pyqtSlot()
  330. #def slot_handleNSM_AnnounceCallback(self):
  331. #smName = self._nsmAnnounce2str
  332. #self.act_file_new.setEnabled(False)
  333. #self.act_file_open.setEnabled(False)
  334. #self.act_file_save_as.setEnabled(False)
  335. #self.setWindowTitle("Carla (%s)" % smName)
  336. #@pyqtSlot()
  337. #def slot_handleNSM_Open1Callback(self):
  338. #clientId = self._nsmOpen1str
  339. ## remove all previous plugins
  340. #self.slot_remove_all()
  341. ## restart engine
  342. #if Carla.host.is_engine_running():
  343. #self.stopEngine()
  344. #self.startEngine(clientId)
  345. #@pyqtSlot()
  346. #def slot_handleNSM_Open2Callback(self):
  347. #projectPath = self._nsmOpen2str
  348. #self.m_project_filename = projectPath
  349. #if os.path.exists(self.m_project_filename):
  350. #self.load_project()
  351. #else:
  352. #self.save_project()
  353. #self.setWindowTitle("Carla - %s" % os.path.basename(self.m_project_filename))
  354. #Carla.host.nsm_reply_open()
  355. #@pyqtSlot()
  356. #def slot_handleNSM_SaveCallback(self):
  357. #self.save_project()
  358. #Carla.host.nsm_reply_save()
  359. #@pyqtSlot(str)
  360. #def slot_handleErrorCallback(self, error):
  361. #QMessageBox.critical(self, self.tr("Error"), error)
  362. #@pyqtSlot()
  363. #def slot_handleQuitCallback(self):
  364. #CustomMessageBox(self, QMessageBox.Warning, self.tr("Warning"),
  365. #self.tr("JACK has been stopped or crashed.\nPlease start JACK and restart Carla"),
  366. #self.tr("You may want to save your session now..."), QMessageBox.Ok, QMessageBox.Ok)
  367. #def remove_plugin(self, plugin_id, showError):
  368. #pwidget = self.m_plugin_list[plugin_id]
  369. ##if pwidget.edit_dialog == self.m_curEdit:
  370. ##self.w_edit.layout().removeWidget(self.m_curEdit)
  371. ##self.w_edit.layout().insertWidget(0, self.m_fakeEdit)
  372. ##self.m_fakeEdit.show()
  373. ##self.m_curEdit.hide()
  374. ##self.m_curEdit = self.m_fakeEdit
  375. #pwidget.edit_dialog.close()
  376. #if pwidget.gui_dialog:
  377. #pwidget.gui_dialog.close()
  378. #if Carla.host.remove_plugin(plugin_id):
  379. #pwidget.close()
  380. #pwidget.deleteLater()
  381. #self.w_plugins.layout().removeWidget(pwidget)
  382. #self.m_plugin_list[plugin_id] = None
  383. #self.m_pluginCount -= 1
  384. #elif showError:
  385. #CustomMessageBox(self, QMessageBox.Critical, self.tr("Error"), self.tr("Failed to remove plugin"), cString(Carla.host.get_last_error()), QMessageBox.Ok, QMessageBox.Ok)
  386. ## push all plugins 1 slot if rack mode
  387. #if Carla.processMode == PROCESS_MODE_CONTINUOUS_RACK:
  388. #for i in range(MAX_DEFAULT_PLUGINS-1):
  389. #if i < plugin_id: continue
  390. #self.m_plugin_list[i] = self.m_plugin_list[i+1]
  391. #if self.m_plugin_list[i]:
  392. #self.m_plugin_list[i].setId(i)
  393. #self.m_plugin_list[MAX_DEFAULT_PLUGINS-1] = None
  394. ## check if there are still plugins
  395. #for i in range(MAX_DEFAULT_PLUGINS):
  396. #if self.m_plugin_list[i]: break
  397. #else:
  398. #self.act_plugin_remove_all.setEnabled(False)
  399. #def get_extra_stuff(self, plugin):
  400. #ptype = plugin['type']
  401. #if ptype == PLUGIN_LADSPA:
  402. #unique_id = plugin['unique_id']
  403. #for rdf_item in self.ladspa_rdf_list:
  404. #if rdf_item.UniqueID == unique_id:
  405. #return pointer(rdf_item)
  406. #elif ptype == PLUGIN_DSSI:
  407. #if plugin['hints'] & PLUGIN_HAS_GUI:
  408. #gui = findDSSIGUI(plugin['binary'], plugin['name'], plugin['label'])
  409. #if gui:
  410. #return gui.encode("utf-8")
  411. #return c_nullptr
  412. #def save_project(self):
  413. #content = ("<?xml version='1.0' encoding='UTF-8'?>\n"
  414. #"<!DOCTYPE CARLA-PROJECT>\n"
  415. #"<CARLA-PROJECT VERSION='%s'>\n") % (VERSION)
  416. #first_plugin = True
  417. #for pwidget in self.m_plugin_list:
  418. #if pwidget:
  419. #if not first_plugin:
  420. #content += "\n"
  421. #real_plugin_name = cString(Carla.host.get_real_plugin_name(pwidget.m_pluginId))
  422. #if real_plugin_name:
  423. #content += " <!-- %s -->\n" % xmlSafeString(real_plugin_name, True)
  424. #content += " <Plugin>\n"
  425. #content += pwidget.getSaveXMLContent()
  426. #content += " </Plugin>\n"
  427. #first_plugin = False
  428. #content += "</CARLA-PROJECT>\n"
  429. #try:
  430. #fd = uopen(self.m_project_filename, "w")
  431. #fd.write(content)
  432. #fd.close()
  433. #except:
  434. #QMessageBox.critical(self, self.tr("Error"), self.tr("Failed to save project file"))
  435. #def load_project(self):
  436. #try:
  437. #fd = uopen(self.m_project_filename, "r")
  438. #projectRead = fd.read()
  439. #fd.close()
  440. #except:
  441. #projectRead = None
  442. #if not projectRead:
  443. #QMessageBox.critical(self, self.tr("Error"), self.tr("Failed to load project file"))
  444. #return
  445. #xml = QDomDocument()
  446. #xml.setContent(projectRead.encode("utf-8"))
  447. #xml_node = xml.documentElement()
  448. #if xml_node.tagName() != "CARLA-PROJECT":
  449. #QMessageBox.critical(self, self.tr("Error"), self.tr("Not a valid Carla project file"))
  450. #return
  451. #x_internal_plugins = None
  452. #x_ladspa_plugins = None
  453. #x_dssi_plugins = None
  454. #x_lv2_plugins = None
  455. #x_vst_plugins = None
  456. #x_gig_plugins = None
  457. #x_sf2_plugins = None
  458. #x_sfz_plugins = None
  459. #x_failedPlugins = []
  460. #x_saveStates = []
  461. #node = xml_node.firstChild()
  462. #while not node.isNull():
  463. #if node.toElement().tagName() == "Plugin":
  464. #x_saveState = getSaveStateDictFromXML(node)
  465. #x_saveStates.append(x_saveState)
  466. #node = node.nextSibling()
  467. #for x_saveState in x_saveStates:
  468. #ptype = x_saveState['Type']
  469. #label = x_saveState['Label']
  470. #binary = x_saveState['Binary']
  471. #binaryS = os.path.basename(binary)
  472. #unique_id = x_saveState['UniqueID']
  473. #if ptype == "Internal":
  474. #if not x_internal_plugins: x_internal_plugins = toList(self.settings_db.value("Plugins/Internal", []))
  475. #x_plugins = x_internal_plugins
  476. #elif ptype == "LADSPA":
  477. #if not x_ladspa_plugins:
  478. #x_ladspa_plugins = []
  479. #x_ladspa_plugins += toList(self.settings_db.value("Plugins/LADSPA_native", []))
  480. #x_ladspa_plugins += toList(self.settings_db.value("Plugins/LADSPA_posix32", []))
  481. #x_ladspa_plugins += toList(self.settings_db.value("Plugins/LADSPA_posix64", []))
  482. #x_ladspa_plugins += toList(self.settings_db.value("Plugins/LADSPA_win32", []))
  483. #x_ladspa_plugins += toList(self.settings_db.value("Plugins/LADSPA_win64", []))
  484. #x_plugins = x_ladspa_plugins
  485. #elif ptype == "DSSI":
  486. #if not x_dssi_plugins:
  487. #x_dssi_plugins = []
  488. #x_dssi_plugins += toList(self.settings_db.value("Plugins/DSSI_native", []))
  489. #x_dssi_plugins += toList(self.settings_db.value("Plugins/DSSI_posix32", []))
  490. #x_dssi_plugins += toList(self.settings_db.value("Plugins/DSSI_posix64", []))
  491. #x_dssi_plugins += toList(self.settings_db.value("Plugins/DSSI_win32", []))
  492. #x_dssi_plugins += toList(self.settings_db.value("Plugins/DSSI_win64", []))
  493. #x_plugins = x_dssi_plugins
  494. #elif ptype == "LV2":
  495. #if not x_lv2_plugins:
  496. #x_lv2_plugins = []
  497. #x_lv2_plugins += toList(self.settings_db.value("Plugins/LV2_native", []))
  498. #x_lv2_plugins += toList(self.settings_db.value("Plugins/LV2_posix32", []))
  499. #x_lv2_plugins += toList(self.settings_db.value("Plugins/LV2_posix64", []))
  500. #x_lv2_plugins += toList(self.settings_db.value("Plugins/LV2_win32", []))
  501. #x_lv2_plugins += toList(self.settings_db.value("Plugins/LV2_win64", []))
  502. #x_plugins = x_lv2_plugins
  503. #elif ptype == "VST":
  504. #if not x_vst_plugins:
  505. #x_vst_plugins = []
  506. #x_vst_plugins += toList(self.settings_db.value("Plugins/VST_native", []))
  507. #x_vst_plugins += toList(self.settings_db.value("Plugins/VST_posix32", []))
  508. #x_vst_plugins += toList(self.settings_db.value("Plugins/VST_posix64", []))
  509. #x_vst_plugins += toList(self.settings_db.value("Plugins/VST_win32", []))
  510. #x_vst_plugins += toList(self.settings_db.value("Plugins/VST_win64", []))
  511. #x_plugins = x_vst_plugins
  512. #elif ptype == "GIG":
  513. #if not x_gig_plugins: x_gig_plugins = toList(self.settings_db.value("Plugins/GIG", []))
  514. #x_plugins = x_gig_plugins
  515. #elif ptype == "SF2":
  516. #if not x_sf2_plugins: x_sf2_plugins = toList(self.settings_db.value("Plugins/SF2", []))
  517. #x_plugins = x_sf2_plugins
  518. #elif ptype == "SFZ":
  519. #if not x_sfz_plugins: x_sfz_plugins = toList(self.settings_db.value("Plugins/SFZ", []))
  520. #x_plugins = x_sfz_plugins
  521. #else:
  522. #print("load_project() - ptype '%s' not recognized" % ptype)
  523. #x_failedPlugins.append(x_saveState['Name'])
  524. #continue
  525. ## Try UniqueID -> Label -> Binary (full) -> Binary (short)
  526. #plugin_ulB = None
  527. #plugin_ulb = None
  528. #plugin_ul = None
  529. #plugin_uB = None
  530. #plugin_ub = None
  531. #plugin_lB = None
  532. #plugin_lb = None
  533. #plugin_u = None
  534. #plugin_l = None
  535. #plugin_B = None
  536. #for _plugins in x_plugins:
  537. #for x_plugin in _plugins:
  538. #if unique_id == x_plugin['unique_id'] and label == x_plugin['label'] and binary == x_plugin['binary']:
  539. #plugin_ulB = x_plugin
  540. #break
  541. #elif unique_id == x_plugin['unique_id'] and label == x_plugin['label'] and binaryS == os.path.basename(x_plugin['binary']):
  542. #plugin_ulb = x_plugin
  543. #elif unique_id == x_plugin['unique_id'] and label == x_plugin['label']:
  544. #plugin_ul = x_plugin
  545. #elif unique_id == x_plugin['unique_id'] and binary == x_plugin['binary']:
  546. #plugin_uB = x_plugin
  547. #elif unique_id == x_plugin['unique_id'] and binaryS == os.path.basename(x_plugin['binary']):
  548. #plugin_ub = x_plugin
  549. #elif label == x_plugin['label'] and binary == x_plugin['binary']:
  550. #plugin_lB = x_plugin
  551. #elif label == x_plugin['label'] and binaryS == os.path.basename(x_plugin['binary']):
  552. #plugin_lb = x_plugin
  553. #elif unique_id == x_plugin['unique_id']:
  554. #plugin_u = x_plugin
  555. #elif label == x_plugin['label']:
  556. #plugin_l = x_plugin
  557. #elif binary == x_plugin['binary']:
  558. #plugin_B = x_plugin
  559. ## LADSPA uses UniqueID or binary+label
  560. #if ptype == "LADSPA":
  561. #plugin_l = None
  562. #plugin_B = None
  563. ## DSSI uses binary+label (UniqueID ignored)
  564. #elif ptype == "DSSI":
  565. #plugin_ul = None
  566. #plugin_uB = None
  567. #plugin_ub = None
  568. #plugin_u = None
  569. #plugin_l = None
  570. #plugin_B = None
  571. ## LV2 uses URIs (label in this case)
  572. #elif ptype == "LV2":
  573. #plugin_uB = None
  574. #plugin_ub = None
  575. #plugin_u = None
  576. #plugin_B = None
  577. ## VST uses UniqueID
  578. #elif ptype == "VST":
  579. #plugin_lB = None
  580. #plugin_lb = None
  581. #plugin_l = None
  582. #plugin_B = None
  583. ## Sound Kits use binaries
  584. #elif ptype in ("GIG", "SF2", "SFZ"):
  585. #plugin_ul = None
  586. #plugin_u = None
  587. #plugin_l = None
  588. #plugin_B = binary
  589. #if plugin_ulB:
  590. #plugin = plugin_ulB
  591. #elif plugin_ulb:
  592. #plugin = plugin_ulb
  593. #elif plugin_ul:
  594. #plugin = plugin_ul
  595. #elif plugin_uB:
  596. #plugin = plugin_uB
  597. #elif plugin_ub:
  598. #plugin = plugin_ub
  599. #elif plugin_lB:
  600. #plugin = plugin_lB
  601. #elif plugin_lb:
  602. #plugin = plugin_lb
  603. #elif plugin_u:
  604. #plugin = plugin_u
  605. #elif plugin_l:
  606. #plugin = plugin_l
  607. #elif plugin_B:
  608. #plugin = plugin_B
  609. #else:
  610. #plugin = None
  611. #if plugin:
  612. #btype = plugin['build']
  613. #ptype = plugin['type']
  614. #filename = plugin['binary']
  615. #name = x_saveState['Name']
  616. #label = plugin['label']
  617. #extra_stuff = self.get_extra_stuff(plugin)
  618. #new_plugin_id = self.add_plugin(btype, ptype, filename, name, label, extra_stuff, False)
  619. #if new_plugin_id >= 0:
  620. #pwidget = self.m_plugin_list[new_plugin_id]
  621. #pwidget.loadStateDict(x_saveState)
  622. #else:
  623. #x_failedPlugins.append(x_saveState['Name'])
  624. #else:
  625. #x_failedPlugins.append(x_saveState['Name'])
  626. #if len(x_failedPlugins) > 0:
  627. #text = self.tr("The following plugins were not found or failed to initialize:\n")
  628. #for plugin in x_failedPlugins:
  629. #text += " - %s\n" % plugin
  630. #self.statusBar().showMessage("State file loaded with errors")
  631. #QMessageBox.critical(self, self.tr("Error"), text)
  632. #else:
  633. #self.statusBar().showMessage("State file loaded sucessfully!")
  634. #@pyqtSlot()
  635. #def slot_file_new(self):
  636. #self.slot_remove_all()
  637. #self.m_project_filename = None
  638. #self.setWindowTitle("Carla")
  639. #@pyqtSlot()
  640. #def slot_file_open(self):
  641. #fileFilter = self.tr("Carla Project File (*.carxp)")
  642. #filenameTry = QFileDialog.getOpenFileName(self, self.tr("Open Carla Project File"), self.m_savedSettings["Main/DefaultProjectFolder"], filter=fileFilter)
  643. #if filenameTry:
  644. #self.m_project_filename = filenameTry
  645. #self.slot_remove_all()
  646. #self.load_project()
  647. #self.setWindowTitle("Carla - %s" % os.path.basename(self.m_project_filename))
  648. #@pyqtSlot()
  649. #def slot_file_save(self, saveAs=False):
  650. #if self.m_project_filename == None or saveAs:
  651. #fileFilter = self.tr("Carla Project File (*.carxp)")
  652. #filenameTry = QFileDialog.getSaveFileName(self, self.tr("Save Carla Project File"), self.m_savedSettings["Main/DefaultProjectFolder"], filter=fileFilter)
  653. #if filenameTry:
  654. #if not filenameTry.endswith(".carxp"):
  655. #filenameTry += ".carxp"
  656. #self.m_project_filename = filenameTry
  657. #self.save_project()
  658. #self.setWindowTitle("Carla - %s" % os.path.basename(self.m_project_filename))
  659. #else:
  660. #self.save_project()
  661. #@pyqtSlot()
  662. #def slot_file_save_as(self):
  663. #self.slot_file_save(True)
  664. @pyqtSlot()
  665. def slot_addPlugin(self):
  666. dialog = PluginDatabaseW(self)
  667. if dialog.exec_():
  668. btype = dialog.fRetPlugin['build']
  669. ptype = dialog.fRetPlugin['type']
  670. filename = dialog.fRetPlugin['binary']
  671. label = dialog.fRetPlugin['label']
  672. extraStuff = None #self.get_extra_stuff(dialog.ret_plugin)
  673. self.addPlugin(btype, ptype, filename, None, label, extraStuff, True)
  674. #@pyqtSlot()
  675. #def slot_remove_all(self):
  676. #h = 0
  677. #for i in range(MAX_DEFAULT_PLUGINS):
  678. #pwidget = self.m_plugin_list[i]
  679. #if not pwidget:
  680. #continue
  681. #pwidget.setId(i-h)
  682. #pwidget.edit_dialog.close()
  683. #if pwidget.gui_dialog:
  684. #pwidget.gui_dialog.close()
  685. #if Carla.host.remove_plugin(i-h):
  686. #pwidget.close()
  687. #pwidget.deleteLater()
  688. #self.w_plugins.layout().removeWidget(pwidget)
  689. #self.m_plugin_list[i] = None
  690. #if Carla.processMode == PROCESS_MODE_CONTINUOUS_RACK:
  691. #h += 1
  692. #self.m_pluginCount = 0
  693. #self.act_plugin_remove_all.setEnabled(False)
  694. @pyqtSlot()
  695. def slot_aboutCarla(self):
  696. CarlaAboutW(self).exec_()
  697. #@pyqtSlot()
  698. #def slot_configureCarla(self):
  699. #dialog = SettingsW(self, "carla")
  700. #if dialog.exec_():
  701. #self.loadSettings(False)
  702. #for pwidget in self.m_plugin_list:
  703. #if pwidget:
  704. #pwidget.peak_in.setRefreshRate(self.m_savedSettings["Main/RefreshInterval"])
  705. #pwidget.peak_out.setRefreshRate(self.m_savedSettings["Main/RefreshInterval"])
  706. def loadRDFs(self):
  707. # Save RDF info for later
  708. self.fLadspaRdfList = []
  709. if haveLRDF:
  710. settingsDir = os.path.join(HOME, ".config", "Cadence")
  711. frLadspaFile = os.path.join(settingsDir, "ladspa_rdf.db")
  712. if os.path.exists(frLadspaFile):
  713. frLadspa = open(frLadspaFile, 'r')
  714. try:
  715. self.fLadspaRdfList = ladspa_rdf.get_c_ladspa_rdfs(json.load(frLadspa))
  716. except:
  717. pass
  718. frLadspa.close()
  719. def saveSettings(self):
  720. settings = QSettings()
  721. settings.setValue("Geometry", self.saveGeometry())
  722. settings.setValue("ShowToolbar", self.ui.toolBar.isVisible())
  723. def loadSettings(self, geometry):
  724. settings = QSettings()
  725. if geometry:
  726. self.restoreGeometry(settings.value("Geometry", ""))
  727. showToolbar = settings.value("ShowToolbar", True, type=bool)
  728. self.ui.act_settings_show_toolbar.setChecked(showToolbar)
  729. self.ui.toolBar.setVisible(showToolbar)
  730. self.fSavedSettings = {
  731. "Main/DefaultProjectFolder": settings.value("Main/DefaultProjectFolder", DEFAULT_PROJECT_FOLDER, type=str),
  732. "Main/RefreshInterval": settings.value("Main/RefreshInterval", 120, type=int)
  733. }
  734. # ---------------------------------------------
  735. # plugin checks
  736. if settings.value("Engine/DisableChecks", False, type=bool):
  737. os.environ["CARLA_DISCOVERY_NO_PROCESSING_CHECKS"] = "true"
  738. elif os.getenv("CARLA_DISCOVERY_NO_PROCESSING_CHECKS"):
  739. os.environ.pop("CARLA_DISCOVERY_NO_PROCESSING_CHECKS")
  740. # ---------------------------------------------
  741. # plugin paths
  742. global LADSPA_PATH, DSSI_PATH, LV2_PATH, VST_PATH, GIG_PATH, SF2_PATH, SFZ_PATH
  743. LADSPA_PATH = toList(settings.value("Paths/LADSPA", LADSPA_PATH))
  744. DSSI_PATH = toList(settings.value("Paths/DSSI", DSSI_PATH))
  745. LV2_PATH = toList(settings.value("Paths/LV2", LV2_PATH))
  746. VST_PATH = toList(settings.value("Paths/VST", VST_PATH))
  747. GIG_PATH = toList(settings.value("Paths/GIG", GIG_PATH))
  748. SF2_PATH = toList(settings.value("Paths/SF2", SF2_PATH))
  749. SFZ_PATH = toList(settings.value("Paths/SFZ", SFZ_PATH))
  750. os.environ["LADSPA_PATH"] = splitter.join(LADSPA_PATH)
  751. os.environ["DSSI_PATH"] = splitter.join(DSSI_PATH)
  752. os.environ["LV2_PATH"] = splitter.join(LV2_PATH)
  753. os.environ["VST_PATH"] = splitter.join(VST_PATH)
  754. os.environ["GIG_PATH"] = splitter.join(GIG_PATH)
  755. os.environ["SF2_PATH"] = splitter.join(SF2_PATH)
  756. os.environ["SFZ_PATH"] = splitter.join(SFZ_PATH)
  757. #def timerEvent(self, event):
  758. #if event.timerId() == self.TIMER_GUI_STUFF:
  759. #for pwidget in self.m_plugin_list:
  760. #if pwidget: pwidget.check_gui_stuff()
  761. #if self.m_engine_started and self.m_pluginCount > 0:
  762. #Carla.host.idle_guis()
  763. #elif event.timerId() == self.TIMER_GUI_STUFF2:
  764. #for pwidget in self.m_plugin_list:
  765. #if pwidget: pwidget.check_gui_stuff2()
  766. #QMainWindow.timerEvent(self, event)
  767. def closeEvent(self, event):
  768. #if self.nsm_server:
  769. #self.nsm_server.stop()
  770. self.saveSettings()
  771. #self.slot_remove_all()
  772. self.stopEngine()
  773. QMainWindow.closeEvent(self, event)
  774. # ------------------------------------------------------------------------------------------------
  775. def callback_function(ptr, action, pluginId, value1, value2, value3, valueStr):
  776. if pluginId < 0 or not Carla.gui:
  777. return
  778. #if action == CALLBACK_DEBUG:
  779. #Carla.gui.emit(SIGNAL("DebugCallback(int, int, int, double, QString)"), pluginId, value1, value2, value3, cString(valueStr))
  780. #elif action == CALLBACK_PARAMETER_VALUE_CHANGED:
  781. #Carla.gui.emit(SIGNAL("ParameterValueCallback(int, int, double)"), pluginId, value1, value3)
  782. #elif action == CALLBACK_PARAMETER_MIDI_CHANNEL_CHANGED:
  783. #Carla.gui.emit(SIGNAL("ParameterMidiChannelCallback(int, int, int)"), pluginId, value1, value2)
  784. #elif action == CALLBACK_PARAMETER_MIDI_CC_CHANGED:
  785. #Carla.gui.emit(SIGNAL("ParameterMidiCcCallback(int, int, int)"), pluginId, value1, value2)
  786. #elif action == CALLBACK_PROGRAM_CHANGED:
  787. #Carla.gui.emit(SIGNAL("ProgramCallback(int, int)"), pluginId, value1)
  788. #elif action == CALLBACK_MIDI_PROGRAM_CHANGED:
  789. #Carla.gui.emit(SIGNAL("MidiProgramCallback(int, int)"), pluginId, value1)
  790. #elif action == CALLBACK_NOTE_ON:
  791. #Carla.gui.emit(SIGNAL("NoteOnCallback(int, int, int, int)"), pluginId, value1, value2, value3)
  792. #elif action == CALLBACK_NOTE_OFF:
  793. #Carla.gui.emit(SIGNAL("NoteOffCallback(int, int, int)"), pluginId, value1, value2)
  794. #elif action == CALLBACK_SHOW_GUI:
  795. #Carla.gui.emit(SIGNAL("ShowGuiCallback(int, int)"), pluginId, value1)
  796. #elif action == CALLBACK_UPDATE:
  797. #Carla.gui.emit(SIGNAL("UpdateCallback(int)"), pluginId)
  798. #elif action == CALLBACK_RELOAD_INFO:
  799. #Carla.gui.emit(SIGNAL("ReloadInfoCallback(int)"), pluginId)
  800. #elif action == CALLBACK_RELOAD_PARAMETERS:
  801. #Carla.gui.emit(SIGNAL("ReloadParametersCallback(int)"), pluginId)
  802. #elif action == CALLBACK_RELOAD_PROGRAMS:
  803. #Carla.gui.emit(SIGNAL("ReloadProgramsCallback(int)"), pluginId)
  804. #elif action == CALLBACK_RELOAD_ALL:
  805. #Carla.gui.emit(SIGNAL("ReloadAllCallback(int)"), pluginId)
  806. #elif action == CALLBACK_NSM_ANNOUNCE:
  807. #Carla.gui._nsmAnnounce2str = cString(Carla.host.get_last_error())
  808. #Carla.gui.emit(SIGNAL("NSM_AnnounceCallback()"))
  809. #elif action == CALLBACK_NSM_OPEN1:
  810. #Carla.gui._nsmOpen1str = cString(valueStr)
  811. #Carla.gui.emit(SIGNAL("NSM_Open1Callback()"))
  812. #elif action == CALLBACK_NSM_OPEN2:
  813. #Carla.gui._nsmOpen2str = cString(valueStr)
  814. #Carla.gui.emit(SIGNAL("NSM_Open2Callback()"))
  815. #elif action == CALLBACK_NSM_SAVE:
  816. #Carla.gui.emit(SIGNAL("NSM_SaveCallback()"))
  817. #elif action == CALLBACK_ERROR:
  818. #Carla.gui.emit(SIGNAL("ErrorCallback(QString)"), cString(Carla.host.get_last_error()))
  819. #elif action == CALLBACK_QUIT:
  820. #Carla.gui.emit(SIGNAL("QuitCallback()"))
  821. #--------------- main ------------------
  822. if __name__ == '__main__':
  823. # App initialization
  824. app = QApplication(sys.argv)
  825. app.setApplicationName("Carla")
  826. app.setApplicationVersion(VERSION)
  827. app.setOrganizationName("Cadence")
  828. app.setWindowIcon(QIcon(":/scalable/carla.svg"))
  829. libPrefix = None
  830. projectFilename = None
  831. for i in range(len(app.arguments())):
  832. if i == 0: continue
  833. argument = app.arguments()[i]
  834. if argument.startswith("--with-libprefix="):
  835. libPrefix = argument.replace("--with-libprefix=", "")
  836. elif os.path.exists(argument):
  837. projectFilename = argument
  838. # Init backend
  839. Carla.host = Host(libPrefix)
  840. Carla.host.set_callback_function(callback_function)
  841. Carla.host.set_option(OPTION_PROCESS_NAME, 0, "carla")
  842. # Set bridge paths
  843. if carla_bridge_native:
  844. Carla.host.set_option(OPTION_PATH_BRIDGE_NATIVE, 0, carla_bridge_native)
  845. if carla_bridge_posix32:
  846. Carla.host.set_option(OPTION_PATH_BRIDGE_POSIX32, 0, carla_bridge_posix32)
  847. if carla_bridge_posix64:
  848. Carla.host.set_option(OPTION_PATH_BRIDGE_POSIX64, 0, carla_bridge_posix64)
  849. if carla_bridge_win32:
  850. Carla.host.set_option(OPTION_PATH_BRIDGE_WIN32, 0, carla_bridge_win32)
  851. if carla_bridge_win64:
  852. Carla.host.set_option(OPTION_PATH_BRIDGE_WIN64, 0, carla_bridge_win64)
  853. if WINDOWS:
  854. if carla_bridge_lv2_windows:
  855. Carla.host.set_option(OPTION_PATH_BRIDGE_LV2_WINDOWS, 0, carla_bridge_lv2_windows)
  856. if carla_bridge_vst_hwnd:
  857. Carla.host.set_option(OPTION_PATH_BRIDGE_VST_HWND, 0, carla_bridge_vst_hwnd)
  858. elif MACOS:
  859. if carla_bridge_lv2_cocoa:
  860. Carla.host.set_option(OPTION_PATH_BRIDGE_LV2_COCOA, 0, carla_bridge_lv2_cocoa)
  861. if carla_bridge_vst_cocoa:
  862. Carla.host.set_option(OPTION_PATH_BRIDGE_VST_COCOA, 0, carla_bridge_vst_cocoa)
  863. else:
  864. if carla_bridge_lv2_gtk2:
  865. Carla.host.set_option(OPTION_PATH_BRIDGE_LV2_GTK2, 0, carla_bridge_lv2_gtk2)
  866. if carla_bridge_lv2_gtk3:
  867. Carla.host.set_option(OPTION_PATH_BRIDGE_LV2_GTK3, 0, carla_bridge_lv2_gtk3)
  868. if carla_bridge_lv2_qt4:
  869. Carla.host.set_option(OPTION_PATH_BRIDGE_LV2_QT4, 0, carla_bridge_lv2_qt4)
  870. if carla_bridge_lv2_qt5:
  871. Carla.host.set_option(OPTION_PATH_BRIDGE_LV2_QT5, 0, carla_bridge_lv2_qt5)
  872. if carla_bridge_lv2_x11:
  873. Carla.host.set_option(OPTION_PATH_BRIDGE_LV2_X11, 0, carla_bridge_lv2_x11)
  874. if carla_bridge_vst_x11:
  875. Carla.host.set_option(OPTION_PATH_BRIDGE_VST_X11, 0, carla_bridge_vst_x11)
  876. # Create GUI and start engine
  877. Carla.gui = CarlaMainW()
  878. # Set-up custom signal handling
  879. #setUpSignals(Carla.gui)
  880. # Show GUI
  881. Carla.gui.show()
  882. # Load project file if set
  883. #if projectFilename:
  884. #Carla.gui.m_project_filename = projectFilename
  885. #Carla.gui.loadProjectLater()
  886. #Carla.gui.setWindowTitle("Carla - %s" % os.path.basename(projectFilename)) # FIXME - put in loadProject
  887. # App-Loop
  888. ret = app.exec_()
  889. # Exit properly
  890. sys.exit(ret)