From 4915a7821bee2ddb727c1af50391cea6fbe9a393 Mon Sep 17 00:00:00 2001 From: falkTX Date: Sat, 2 Mar 2013 12:34:46 +0000 Subject: [PATCH] Initial work for internal canvas --- Makefile | 11 +- resources/ui/carla.ui | 171 +++++++++++++----- source/backend/CarlaBackend.hpp | 75 +++++++- source/backend/engine/CarlaEngineJack.cpp | 3 + source/carla.py | 208 +++++++++++++++++++++- source/carla_shared.py | 20 ++- source/utils/CarlaThread.hpp | 7 +- 7 files changed, 423 insertions(+), 72 deletions(-) diff --git a/Makefile b/Makefile index 290b623af..62ca4fdfb 100644 --- a/Makefile +++ b/Makefile @@ -68,7 +68,7 @@ source/resources_rc.py: resources/resources.qrc # ----------------------------------------------------------------------------------------------------------------------------------------- # UI code -UIs = source/ui_carla.py source/ui_carla_control.py\ +UIs = source/ui_carla.py source/ui_carla_control.py \ source/ui_carla_about.py source/ui_carla_database.py source/ui_carla_edit.py source/ui_carla_parameter.py source/ui_carla_plugin.py \ source/ui_carla_refresh.py source/ui_carla_settings.py \ source/ui_inputdialog_value.py @@ -81,7 +81,14 @@ source/ui_%.py: resources/ui/%.ui # ----------------------------------------------------------------------------------------------------------------------------------------- # Widgets -WIDGETS = source/digitalpeakmeter.py source/ledbutton.py source/paramspinbox.py source/pixmapbutton.py source/pixmapdial.py source/pixmapkeyboard.py +WIDGETS = \ + source/canvaspreviewframe.py \ + source/digitalpeakmeter.py \ + source/ledbutton.py \ + source/paramspinbox.py \ + source/pixmapbutton.py \ + source/pixmapdial.py \ + source/pixmapkeyboard.py WIDGETS: $(WIDGETS) diff --git a/resources/ui/carla.ui b/resources/ui/carla.ui index c9ae75dd3..89c1cb77e 100644 --- a/resources/ui/carla.ui +++ b/resources/ui/carla.ui @@ -6,28 +6,16 @@ 0 0 - 756 - 283 + 782 + 482 Carla - - - 0 - - - 0 - - - 0 - - - 2 - - + + @@ -39,19 +27,6 @@ 0 - - - - Qt::Horizontal - - - - 40 - 20 - - - - @@ -165,30 +140,122 @@ - - - - - 1 - - - 0 - - + + + + 0 + + + + Plugins + + + + 1 + + + 2 + + + + + + 1 + + + 0 + + + + + + + + Qt::Vertical + + + + 20 + 333 + + + + + + + + + Patchbay + + + + 0 + + + 2 + + + + + Qt::ScrollBarAlwaysOn + + + Qt::ScrollBarAlwaysOn + + + + + + + + + + + + 210 + 0 + + + + + 210 + 16777215 + + + + QTabWidget::East + + + 0 + + + + Disk + + - - - - Qt::Vertical + + + + + 210 + 162 + - + - 20 - 128 + 210 + 162 - + + QFrame::StyledPanel + + + QFrame::Raised + + @@ -197,7 +264,7 @@ 0 0 - 756 + 782 19 @@ -415,6 +482,14 @@ + + + CanvasPreviewFrame + QFrame +
canvaspreviewframe.h
+ 1 +
+
diff --git a/source/backend/CarlaBackend.hpp b/source/backend/CarlaBackend.hpp index c20e5ca95..f35992688 100644 --- a/source/backend/CarlaBackend.hpp +++ b/source/backend/CarlaBackend.hpp @@ -496,35 +496,98 @@ enum CallbackType { */ CALLBACK_RELOAD_ALL = 16, + /*! + * Canvas client added + * + * \param value1 Client ID + * \param valueStr Client Name + */ + CALLBACK_PATCHBAY_CLIENT_ADDED = 17, + + /*! + * Canvas client removed + * + * \param value1 Client ID + */ + CALLBACK_PATCHBAY_CLIENT_REMOVED = 18, + + /*! + * Canvas client renamed + * + * \param value1 Client ID + * \param valueStr New Client name + */ + CALLBACK_PATCHBAY_CLIENT_RENAMED = 19, + + /*! + * Canvas port added + * + * \param value1 Client ID + * \param value2 Port ID + * \param valueStr Port name + */ + CALLBACK_PATCHBAY_PORT_ADDED = 20, + + /*! + * Canvas port remvoed + * + * \param value1 Port ID + */ + CALLBACK_PATCHBAY_PORT_REMOVED = 21, + + /*! + * Canvas port renamed + * + * \param value1 Port ID + * \param valueStr New Port name + */ + CALLBACK_PATCHBAY_PORT_RENAMED = 22, + + /*! + * Canvas port connection added + * + * \param value1 Output port ID + * \param value2 Input port ID + */ + CALLBACK_PATCHBAY_CONNECTION_ADDED = 23, + + /*! + * Canvas port connection removed + * + * \param value1 Output port ID + * \param value2 Input port ID + */ + CALLBACK_PATCHBAY_CONNECTION_REMOVED = 24, + /*! * Non-Session-Manager Announce message. */ - CALLBACK_NSM_ANNOUNCE = 17, + CALLBACK_NSM_ANNOUNCE = 25, /*! * Non-Session-Manager Open message #1. */ - CALLBACK_NSM_OPEN1 = 18, + CALLBACK_NSM_OPEN1 = 26, /*! * Non-Session-Manager Open message #2. */ - CALLBACK_NSM_OPEN2 = 19, + CALLBACK_NSM_OPEN2 = 27, /*! * Non-Session-Manager Save message. */ - CALLBACK_NSM_SAVE = 20, + CALLBACK_NSM_SAVE = 28, /*! * An error occurred, show last error to user. */ - CALLBACK_ERROR = 21, + CALLBACK_ERROR = 29, /*! * The engine has crashed or malfunctioned and will no longer work. */ - CALLBACK_QUIT = 22 + CALLBACK_QUIT = 30 }; /*! diff --git a/source/backend/engine/CarlaEngineJack.cpp b/source/backend/engine/CarlaEngineJack.cpp index bffe7a2ed..a3d478228 100644 --- a/source/backend/engine/CarlaEngineJack.cpp +++ b/source/backend/engine/CarlaEngineJack.cpp @@ -691,6 +691,9 @@ public: } #endif + static int test = 0; + callback(CALLBACK_PATCHBAY_CLIENT_ADDED, 0, test++, 0, 0, plugin->name()); + return new CarlaEngineJackClient(kEngineTypeJack, fOptions.processMode, client); } diff --git a/source/carla.py b/source/carla.py index 115749dab..12142895f 100755 --- a/source/carla.py +++ b/source/carla.py @@ -19,19 +19,32 @@ # ------------------------------------------------------------------------------------------------------------ # Imports (Global) -from PyQt4.QtCore import Qt, QSize -from PyQt4.QtGui import QApplication, QDialogButtonBox, QMainWindow +from PyQt4.QtCore import Qt, QPointF, QSize +from PyQt4.QtGui import QApplication, QDialogButtonBox, QMainWindow, QResizeEvent # ------------------------------------------------------------------------------------------------------------ # Imports (Custom Stuff) +import patchcanvas import ui_carla import ui_carla_settings from carla_backend import * # FIXME, remove later -#from carla_shared import * +from carla_shared import * # ------------------------------------------------------------------------------------------------------------ -# Global variables +# Try Import OpenGL + +try: + from PyQt4.QtOpenGL import QGLWidget + hasGL = True +except: + hasGL = False + +# ------------------------------------------------------------------------------------------------------------ +# Static Variables + +DEFAULT_CANVAS_WIDTH = 3100 +DEFAULT_CANVAS_HEIGHT = 2400 # Tab indexes TAB_INDEX_MAIN = 0 @@ -545,7 +558,49 @@ class CarlaMainW(QMainWindow): self.ui.act_engine_stop.setEnabled(False) self.ui.act_plugin_remove_all.setEnabled(False) - self.resize(self.width(), 0) + # FIXME: Qt4 needs this so it properly create & resize the canvas + self.ui.tabWidget.setCurrentIndex(1) + self.ui.tabWidget.setCurrentIndex(0) + + # ------------------------------------------------------------- + # Set-up Canvas + + self.scene = patchcanvas.PatchScene(self, self.ui.graphicsView) + self.ui.graphicsView.setScene(self.scene) + #self.ui.graphicsView.setRenderHint(QPainter.Antialiasing, bool(self.fSavedSettings["Canvas/Antialiasing"] == patchcanvas.ANTIALIASING_FULL)) + #if self.fSavedSettings["Canvas/UseOpenGL"] and hasGL: + #self.ui.graphicsView.setViewport(QGLWidget(self.ui.graphicsView)) + #self.ui.graphicsView.setRenderHint(QPainter.HighQualityAntialiasing, self.fSavedSettings["Canvas/HighQualityAntialiasing"]) + + pOptions = patchcanvas.options_t() + pOptions.theme_name = self.fSavedSettings["Canvas/Theme"] + pOptions.auto_hide_groups = self.fSavedSettings["Canvas/AutoHideGroups"] + pOptions.use_bezier_lines = self.fSavedSettings["Canvas/UseBezierLines"] + pOptions.antialiasing = self.fSavedSettings["Canvas/Antialiasing"] + pOptions.eyecandy = self.fSavedSettings["Canvas/EyeCandy"] + + pFeatures = patchcanvas.features_t() + pFeatures.group_info = False + pFeatures.group_rename = False + pFeatures.port_info = False + pFeatures.port_rename = False + pFeatures.handle_group_pos = True + + patchcanvas.setOptions(pOptions) + patchcanvas.setFeatures(pFeatures) + patchcanvas.init("Carla", self.scene, canvasCallback, True) + + patchcanvas.setCanvasSize(0, 0, DEFAULT_CANVAS_WIDTH, DEFAULT_CANVAS_HEIGHT) + patchcanvas.setInitialPos(DEFAULT_CANVAS_WIDTH / 2, DEFAULT_CANVAS_HEIGHT / 2) + self.ui.graphicsView.setSceneRect(0, 0, DEFAULT_CANVAS_WIDTH, DEFAULT_CANVAS_HEIGHT) + + # ------------------------------------------------------------- + # Set-up Canvas Preview + + self.ui.miniCanvasPreview.setRealParent(self) + self.ui.miniCanvasPreview.setViewTheme(patchcanvas.canvas.theme.rubberband_brush, patchcanvas.canvas.theme.rubberband_pen.color()) + self.ui.miniCanvasPreview.init(self.scene, DEFAULT_CANVAS_WIDTH, DEFAULT_CANVAS_HEIGHT) + QTimer.singleShot(100, self, SLOT("slot_miniCanvasInit()")) #self.m_fakeEdit = PluginEdit(self, -1) #self.m_curEdit = self.m_fakeEdit @@ -574,6 +629,14 @@ class CarlaMainW(QMainWindow): self.connect(self.ui.b_transport_play, SIGNAL("clicked(bool)"), SLOT("slot_transportPlayPause(bool)")) self.connect(self.ui.b_transport_stop, SIGNAL("clicked()"), SLOT("slot_transportStop()")) + self.connect(self.ui.miniCanvasPreview, SIGNAL("miniCanvasMoved(double, double)"), SLOT("slot_miniCanvasMoved(double, double)")) + + self.connect(self.ui.graphicsView.horizontalScrollBar(), SIGNAL("valueChanged(int)"), SLOT("slot_horizontalScrollBarChanged(int)")) + self.connect(self.ui.graphicsView.verticalScrollBar(), SIGNAL("valueChanged(int)"), SLOT("slot_verticalScrollBarChanged(int)")) + + self.connect(self.scene, SIGNAL("sceneGroupMoved(int, int, QPointF)"), SLOT("slot_canvasItemMoved(int, int, QPointF)")) + self.connect(self.scene, SIGNAL("scaleChanged(double)"), SLOT("slot_canvasScaleChanged(double)")) + self.connect(self, SIGNAL("SIGUSR1()"), SLOT("slot_handleSIGUSR1()")) self.connect(self, SIGNAL("SIGTERM()"), SLOT("slot_handleSIGTERM()")) @@ -594,6 +657,14 @@ class CarlaMainW(QMainWindow): self.connect(self, SIGNAL("ReloadParametersCallback(int)"), SLOT("slot_handleReloadParametersCallback(int)")) self.connect(self, SIGNAL("ReloadProgramsCallback(int)"), SLOT("slot_handleReloadProgramsCallback(int)")) self.connect(self, SIGNAL("ReloadAllCallback(int)"), SLOT("slot_handleReloadAllCallback(int)")) + self.connect(self, SIGNAL("PatchbayClientAddedCallback(int, QString)"), SLOT("slot_handlePatchbayClientAddedCallback(int, QString)")) + self.connect(self, SIGNAL("PatchbayClientRemovedCallback(int)"), SLOT("slot_handlePatchbayClientRemovedCallback(int)")) + self.connect(self, SIGNAL("PatchbayClientRenamedCallback(int, QString)"), SLOT("slot_handlePatchbayClientRenamedCallback(int, QString)")) + self.connect(self, SIGNAL("PatchbayPortAddedCallback(int, int, QString)"), SLOT("slot_handlePatchbayPortAddedCallback(int, int, QString)")) + self.connect(self, SIGNAL("PatchbayPortRemovedCallback(int)"), SLOT("slot_handlePatchbayPortRemovedCallback(int)")) + self.connect(self, SIGNAL("PatchbayPortRenamedCallback(int, QString)"), SLOT("slot_handlePatchbayPortRenamedCallback(int, QString)")) + self.connect(self, SIGNAL("PatchbayConnectionAddedCallback(int, int)"), SLOT("slot_handlePatchbayConnectionAddedCallback(int, int)")) + self.connect(self, SIGNAL("PatchbayConnectionRemovedCallback(int, int)"), SLOT("slot_handlePatchbayConnectionRemovedCallback(int, int)")) #self.connect(self, SIGNAL("NSM_AnnounceCallback()"), SLOT("slot_handleNSM_AnnounceCallback()")) #self.connect(self, SIGNAL("NSM_Open1Callback()"), SLOT("slot_handleNSM_Open1Callback()")) #self.connect(self, SIGNAL("NSM_Open2Callback()"), SLOT("slot_handleNSM_Open2Callback()")) @@ -608,6 +679,53 @@ class CarlaMainW(QMainWindow): #else: QTimer.singleShot(0, self, SLOT("slot_engineStart()")) + @pyqtSlot(float) + def slot_canvasScaleChanged(self, scale): + self.ui.miniCanvasPreview.setViewScale(scale) + + @pyqtSlot(int, int, QPointF) + def slot_canvasItemMoved(self, group_id, split_mode, pos): + self.ui.miniCanvasPreview.update() + + @pyqtSlot(int) + def slot_horizontalScrollBarChanged(self, value): + maximum = self.ui.graphicsView.horizontalScrollBar().maximum() + if maximum == 0: + xp = 0 + else: + xp = float(value) / maximum + self.ui.miniCanvasPreview.setViewPosX(xp) + + @pyqtSlot(int) + def slot_verticalScrollBarChanged(self, value): + maximum = self.ui.graphicsView.verticalScrollBar().maximum() + if maximum == 0: + yp = 0 + else: + yp = float(value) / maximum + self.ui.miniCanvasPreview.setViewPosY(yp) + + @pyqtSlot() + def slot_miniCanvasInit(self): + settings = QSettings() + self.ui.graphicsView.horizontalScrollBar().setValue(settings.value("HorizontalScrollBarValue", DEFAULT_CANVAS_WIDTH / 3, type=int)) + self.ui.graphicsView.verticalScrollBar().setValue(settings.value("VerticalScrollBarValue", DEFAULT_CANVAS_HEIGHT * 3 / 8, type=int)) + + @pyqtSlot(float, float) + def slot_miniCanvasMoved(self, xp, yp): + self.ui.graphicsView.horizontalScrollBar().setValue(xp * DEFAULT_CANVAS_WIDTH) + self.ui.graphicsView.verticalScrollBar().setValue(yp * DEFAULT_CANVAS_HEIGHT) + + @pyqtSlot() + def slot_miniCanvasCheckAll(self): + self.slot_miniCanvasCheckSize() + self.slot_horizontalScrollBarChanged(self.ui.graphicsView.horizontalScrollBar().value()) + self.slot_verticalScrollBarChanged(self.ui.graphicsView.verticalScrollBar().value()) + + @pyqtSlot() + def slot_miniCanvasCheckSize(self): + self.ui.miniCanvasPreview.setViewSize(float(self.ui.graphicsView.width()) / DEFAULT_CANVAS_WIDTH, float(self.ui.graphicsView.height()) / DEFAULT_CANVAS_HEIGHT) + def startEngine(self, clientName = "Carla"): # --------------------------------------------- # Engine settings @@ -1102,6 +1220,40 @@ class CarlaMainW(QMainWindow): pwidget.ui.edit_dialog.reloadAll() + @pyqtSlot(int, str) + def slot_handlePatchbayClientAddedCallback(self, clientId, clientName): + patchcanvas.addGroup(clientId, clientName) + + @pyqtSlot(int) + def slot_handlePatchbayClientRemovedCallback(self, clientId): + patchcanvas.removeGroup(clientId) + + @pyqtSlot(int, str) + def slot_handlePatchbayClientRenamedCallback(self, clientId, newClientName): + patchcanvas.renameGroup(clientId, newClientName) + + @pyqtSlot(int, int, str) + def slot_handlePatchbayPortAddedCallback(self, clientId, portId, portName): + # FIXME - needs mode and type + patchcanvas.addPort(clientId, portId, portName, 0, 0) + + @pyqtSlot(int) + def slot_handlePatchbayPortRemovedCallback(self, portId): + patchcanvas.removePort(portId) + + @pyqtSlot(int, str) + def slot_handlePatchbayPortRenamedCallback(self, portId, newPortName): + patchcanvas.renamePort(portId, newPortName) + + @pyqtSlot(int, int) + def slot_handlePatchbayConnectionAddedCallback(self, portOutId, portInId): + patchcanvas.connectPorts(0, portOutId, portInId) + + @pyqtSlot(int, int) + def slot_handlePatchbayConnectionRemovedCallback(self, portOutId, portInId): + # FIXME + patchcanvas.disconnectPorts(0) + @pyqtSlot(str) def slot_handleErrorCallback(self, error): QMessageBox.critical(self, self.tr("Error"), error) @@ -1162,6 +1314,8 @@ class CarlaMainW(QMainWindow): settings.setValue("Geometry", self.saveGeometry()) settings.setValue("ShowToolbar", self.ui.toolBar.isVisible()) settings.setValue("ShowTransport", self.ui.frame_transport.isVisible()) + settings.setValue("HorizontalScrollBarValue", self.ui.graphicsView.horizontalScrollBar().value()) + settings.setValue("VerticalScrollBarValue", self.ui.graphicsView.verticalScrollBar().value()) def loadSettings(self, geometry): settings = QSettings() @@ -1179,7 +1333,14 @@ class CarlaMainW(QMainWindow): self.fSavedSettings = { "Main/DefaultProjectFolder": settings.value("Main/DefaultProjectFolder", HOME, type=str), - "Main/RefreshInterval": settings.value("Main/RefreshInterval", 50, type=int) + "Main/RefreshInterval": settings.value("Main/RefreshInterval", 50, type=int), + "Canvas/Theme": settings.value("Canvas/Theme", patchcanvas.getDefaultThemeName(), type=str), + "Canvas/AutoHideGroups": settings.value("Canvas/AutoHideGroups", False, type=bool), + "Canvas/UseBezierLines": settings.value("Canvas/UseBezierLines", True, type=bool), + "Canvas/EyeCandy": settings.value("Canvas/EyeCandy", patchcanvas.EYECANDY_SMALL, type=int), + "Canvas/UseOpenGL": settings.value("Canvas/UseOpenGL", False, type=bool), + "Canvas/Antialiasing": settings.value("Canvas/Antialiasing", patchcanvas.ANTIALIASING_SMALL, type=int), + "Canvas/HighQualityAntialiasing": settings.value("Canvas/HighQualityAntialiasing", False, type=bool) } # --------------------------------------------- @@ -1210,6 +1371,17 @@ class CarlaMainW(QMainWindow): os.environ["SF2_PATH"] = splitter.join(Carla.SF2_PATH) os.environ["SFZ_PATH"] = splitter.join(Carla.SFZ_PATH) + def resizeEvent(self, event): + if self.ui.tabWidget.currentIndex() == 0: + # Force update of 2nd tab + width = self.ui.tab_plugins.width()-4 + height = self.ui.tab_plugins.height()-4 + self.ui.miniCanvasPreview.setViewSize(float(width) / DEFAULT_CANVAS_WIDTH, float(height) / DEFAULT_CANVAS_HEIGHT) + else: + QTimer.singleShot(0, self, SLOT("slot_miniCanvasCheckSize()")) + + QMainWindow.resizeEvent(self, event) + def timerEvent(self, event): if event.timerId() == self.fIdleTimerFast: Carla.host.engine_idle() @@ -1239,11 +1411,15 @@ class CarlaMainW(QMainWindow): self.stopEngine() + patchcanvas.clear() QMainWindow.closeEvent(self, event) # ------------------------------------------------------------------------------------------------ -def callbackFunction(ptr, action, pluginId, value1, value2, value3, valueStr): +def canvasCallback(self, action, value1, value2, valueStr): + print(action, value1, value2, valueStr) + +def engineCallback(ptr, action, pluginId, value1, value2, value3, valueStr): if pluginId < 0 or not Carla.gui: return @@ -1281,6 +1457,22 @@ def callbackFunction(ptr, action, pluginId, value1, value2, value3, valueStr): Carla.gui.emit(SIGNAL("ReloadProgramsCallback(int)"), pluginId) elif action == CALLBACK_RELOAD_ALL: Carla.gui.emit(SIGNAL("ReloadAllCallback(int)"), pluginId) + elif action == CALLBACK_PATCHBAY_CLIENT_ADDED: + Carla.gui.emit(SIGNAL("PatchbayClientAddedCallback(int, QString)"), value1, cString(valueStr)) + elif action == CALLBACK_PATCHBAY_CLIENT_REMOVED: + Carla.gui.emit(SIGNAL("PatchbayClientRemovedCallback(int)"), value1) + elif action == CALLBACK_PATCHBAY_CLIENT_RENAMED: + Carla.gui.emit(SIGNAL("PatchbayClientRenamedCallback(int, QString)"), value1, cString(valueStr)) + elif action == CALLBACK_PATCHBAY_PORT_ADDED: + Carla.gui.emit(SIGNAL("PatchbayPortAddedCallback(int, int, QString)"), value1, value2, cString(valueStr)) + elif action == CALLBACK_PATCHBAY_PORT_REMOVED: + Carla.gui.emit(SIGNAL("PatchbayPortRemovedCallback(int)"), value1) + elif action == CALLBACK_PATCHBAY_PORT_RENAMED: + Carla.gui.emit(SIGNAL("PatchbayPortRenamedCallback(int, QString)"), value1, cString(valueStr)) + elif action == CALLBACK_PATCHBAY_CONNECTION_ADDED: + Carla.gui.emit(SIGNAL("PatchbayConnectionAddedCallback(int, int)"), value1, value2) + elif action == CALLBACK_PATCHBAY_CONNECTION_REMOVED: + Carla.gui.emit(SIGNAL("PatchbayConnectionRemovedCallback(int, int)"), value1, value2) #elif action == CALLBACK_NSM_ANNOUNCE: #Carla.gui._nsmAnnounce2str = cString(Carla.host.get_last_error()) #Carla.gui.emit(SIGNAL("NSM_AnnounceCallback()")) @@ -1321,7 +1513,7 @@ if __name__ == '__main__': # Init backend Carla.host = Host(libPrefix) - Carla.host.set_engine_callback(callbackFunction) + Carla.host.set_engine_callback(engineCallback) Carla.host.set_engine_option(OPTION_PROCESS_NAME, 0, "carla") # Set bridge paths diff --git a/source/carla_shared.py b/source/carla_shared.py index 1a71db219..9c3e8fdc5 100644 --- a/source/carla_shared.py +++ b/source/carla_shared.py @@ -290,12 +290,20 @@ CALLBACK_RELOAD_INFO = 13 CALLBACK_RELOAD_PARAMETERS = 14 CALLBACK_RELOAD_PROGRAMS = 15 CALLBACK_RELOAD_ALL = 16 -CALLBACK_NSM_ANNOUNCE = 17 -CALLBACK_NSM_OPEN1 = 18 -CALLBACK_NSM_OPEN2 = 19 -CALLBACK_NSM_SAVE = 20 -CALLBACK_ERROR = 21 -CALLBACK_QUIT = 22 +CALLBACK_PATCHBAY_CLIENT_ADDED = 17 +CALLBACK_PATCHBAY_CLIENT_REMOVED = 18 +CALLBACK_PATCHBAY_CLIENT_RENAMED = 19 +CALLBACK_PATCHBAY_PORT_ADDED = 20 +CALLBACK_PATCHBAY_PORT_REMOVED = 21 +CALLBACK_PATCHBAY_PORT_RENAMED = 22 +CALLBACK_PATCHBAY_CONNECTION_ADDED = 23 +CALLBACK_PATCHBAY_CONNECTION_REMOVED = 24 +CALLBACK_NSM_ANNOUNCE = 25 +CALLBACK_NSM_OPEN1 = 26 +CALLBACK_NSM_OPEN2 = 27 +CALLBACK_NSM_SAVE = 28 +CALLBACK_ERROR = 29 +CALLBACK_QUIT = 30 # Process Mode PROCESS_MODE_SINGLE_CLIENT = 0 diff --git a/source/utils/CarlaThread.hpp b/source/utils/CarlaThread.hpp index 1f34aea62..8a76bc7a1 100644 --- a/source/utils/CarlaThread.hpp +++ b/source/utils/CarlaThread.hpp @@ -184,8 +184,11 @@ public: cthread = nullptr; } #else - pthread_join(pthreadId, nullptr); - _zero(); + if (! _isNull()) + { + pthread_join(pthreadId, nullptr); + _zero(); + } #endif return false; }