Browse Source

Initial work for internal canvas

tags/1.9.4
falkTX 11 years ago
parent
commit
4915a7821b
7 changed files with 423 additions and 72 deletions
  1. +9
    -2
      Makefile
  2. +123
    -48
      resources/ui/carla.ui
  3. +69
    -6
      source/backend/CarlaBackend.hpp
  4. +3
    -0
      source/backend/engine/CarlaEngineJack.cpp
  5. +200
    -8
      source/carla.py
  6. +14
    -6
      source/carla_shared.py
  7. +5
    -2
      source/utils/CarlaThread.hpp

+ 9
- 2
Makefile View File

@@ -68,7 +68,7 @@ source/resources_rc.py: resources/resources.qrc
# ----------------------------------------------------------------------------------------------------------------------------------------- # -----------------------------------------------------------------------------------------------------------------------------------------
# UI code # 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_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_carla_refresh.py source/ui_carla_settings.py \
source/ui_inputdialog_value.py source/ui_inputdialog_value.py
@@ -81,7 +81,14 @@ source/ui_%.py: resources/ui/%.ui
# ----------------------------------------------------------------------------------------------------------------------------------------- # -----------------------------------------------------------------------------------------------------------------------------------------
# Widgets # 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) WIDGETS: $(WIDGETS)




+ 123
- 48
resources/ui/carla.ui View File

@@ -6,28 +6,16 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>756</width>
<height>283</height>
<width>782</width>
<height>482</height>
</rect> </rect>
</property> </property>
<property name="windowTitle"> <property name="windowTitle">
<string>Carla</string> <string>Carla</string>
</property> </property>
<widget class="QWidget" name="centralwidget"> <widget class="QWidget" name="centralwidget">
<layout class="QVBoxLayout" name="verticalLayout">
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>2</number>
</property>
<item>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0" colspan="2">
<widget class="QFrame" name="frame_transport"> <widget class="QFrame" name="frame_transport">
<layout class="QHBoxLayout" name="horizontalLayout"> <layout class="QHBoxLayout" name="horizontalLayout">
<property name="leftMargin"> <property name="leftMargin">
@@ -39,19 +27,6 @@
<property name="bottomMargin"> <property name="bottomMargin">
<number>0</number> <number>0</number>
</property> </property>
<item>
<spacer name="horizontalSpacer_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item> <item>
<widget class="QLabel" name="label"> <widget class="QLabel" name="label">
<property name="text"> <property name="text">
@@ -165,30 +140,122 @@
</layout> </layout>
</widget> </widget>
</item> </item>
<item>
<widget class="QWidget" name="w_plugins" native="true">
<layout class="QVBoxLayout" name="layout">
<property name="spacing">
<number>1</number>
</property>
<property name="margin">
<number>0</number>
</property>
</layout>
<item row="1" column="0" rowspan="2">
<widget class="QTabWidget" name="tabWidget">
<property name="currentIndex">
<number>0</number>
</property>
<widget class="QWidget" name="tab_plugins">
<attribute name="title">
<string>Plugins</string>
</attribute>
<layout class="QVBoxLayout" name="verticalLayout">
<property name="spacing">
<number>1</number>
</property>
<property name="margin">
<number>2</number>
</property>
<item>
<widget class="QWidget" name="w_plugins" native="true">
<layout class="QVBoxLayout" name="layout">
<property name="spacing">
<number>1</number>
</property>
<property name="margin">
<number>0</number>
</property>
</layout>
</widget>
</item>
<item>
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>333</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
<widget class="QWidget" name="tab_patchbay">
<attribute name="title">
<string>Patchbay</string>
</attribute>
<layout class="QVBoxLayout" name="verticalLayout_2">
<property name="spacing">
<number>0</number>
</property>
<property name="margin">
<number>2</number>
</property>
<item>
<widget class="QGraphicsView" name="graphicsView">
<property name="verticalScrollBarPolicy">
<enum>Qt::ScrollBarAlwaysOn</enum>
</property>
<property name="horizontalScrollBarPolicy">
<enum>Qt::ScrollBarAlwaysOn</enum>
</property>
</widget>
</item>
</layout>
</widget>
</widget>
</item>
<item row="1" column="1">
<widget class="QTabWidget" name="tabWidget_2">
<property name="minimumSize">
<size>
<width>210</width>
<height>0</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>210</width>
<height>16777215</height>
</size>
</property>
<property name="tabPosition">
<enum>QTabWidget::East</enum>
</property>
<property name="currentIndex">
<number>0</number>
</property>
<widget class="QWidget" name="disk">
<attribute name="title">
<string>Disk</string>
</attribute>
</widget>
</widget> </widget>
</item> </item>
<item>
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
<item row="2" column="1">
<widget class="CanvasPreviewFrame" name="miniCanvasPreview">
<property name="minimumSize">
<size>
<width>210</width>
<height>162</height>
</size>
</property> </property>
<property name="sizeHint" stdset="0">
<property name="maximumSize">
<size> <size>
<width>20</width>
<height>128</height>
<width>210</width>
<height>162</height>
</size> </size>
</property> </property>
</spacer>
<property name="frameShape">
<enum>QFrame::StyledPanel</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Raised</enum>
</property>
</widget>
</item> </item>
</layout> </layout>
</widget> </widget>
@@ -197,7 +264,7 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>756</width>
<width>782</width>
<height>19</height> <height>19</height>
</rect> </rect>
</property> </property>
@@ -415,6 +482,14 @@
</property> </property>
</action> </action>
</widget> </widget>
<customwidgets>
<customwidget>
<class>CanvasPreviewFrame</class>
<extends>QFrame</extends>
<header>canvaspreviewframe.h</header>
<container>1</container>
</customwidget>
</customwidgets>
<resources> <resources>
<include location="../resources.qrc"/> <include location="../resources.qrc"/>
</resources> </resources>


+ 69
- 6
source/backend/CarlaBackend.hpp View File

@@ -496,35 +496,98 @@ enum CallbackType {
*/ */
CALLBACK_RELOAD_ALL = 16, 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. * Non-Session-Manager Announce message.
*/ */
CALLBACK_NSM_ANNOUNCE = 17,
CALLBACK_NSM_ANNOUNCE = 25,


/*! /*!
* Non-Session-Manager Open message #1. * Non-Session-Manager Open message #1.
*/ */
CALLBACK_NSM_OPEN1 = 18,
CALLBACK_NSM_OPEN1 = 26,


/*! /*!
* Non-Session-Manager Open message #2. * Non-Session-Manager Open message #2.
*/ */
CALLBACK_NSM_OPEN2 = 19,
CALLBACK_NSM_OPEN2 = 27,


/*! /*!
* Non-Session-Manager Save message. * Non-Session-Manager Save message.
*/ */
CALLBACK_NSM_SAVE = 20,
CALLBACK_NSM_SAVE = 28,


/*! /*!
* An error occurred, show last error to user. * 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. * The engine has crashed or malfunctioned and will no longer work.
*/ */
CALLBACK_QUIT = 22
CALLBACK_QUIT = 30
}; };


/*! /*!


+ 3
- 0
source/backend/engine/CarlaEngineJack.cpp View File

@@ -691,6 +691,9 @@ public:
} }
#endif #endif


static int test = 0;
callback(CALLBACK_PATCHBAY_CLIENT_ADDED, 0, test++, 0, 0, plugin->name());

return new CarlaEngineJackClient(kEngineTypeJack, fOptions.processMode, client); return new CarlaEngineJackClient(kEngineTypeJack, fOptions.processMode, client);
} }




+ 200
- 8
source/carla.py View File

@@ -19,19 +19,32 @@
# ------------------------------------------------------------------------------------------------------------ # ------------------------------------------------------------------------------------------------------------
# Imports (Global) # 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) # Imports (Custom Stuff)


import patchcanvas
import ui_carla import ui_carla
import ui_carla_settings import ui_carla_settings
from carla_backend import * # FIXME, remove later 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 indexes
TAB_INDEX_MAIN = 0 TAB_INDEX_MAIN = 0
@@ -545,7 +558,49 @@ class CarlaMainW(QMainWindow):
self.ui.act_engine_stop.setEnabled(False) self.ui.act_engine_stop.setEnabled(False)
self.ui.act_plugin_remove_all.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_fakeEdit = PluginEdit(self, -1)
#self.m_curEdit = self.m_fakeEdit #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_play, SIGNAL("clicked(bool)"), SLOT("slot_transportPlayPause(bool)"))
self.connect(self.ui.b_transport_stop, SIGNAL("clicked()"), SLOT("slot_transportStop()")) 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("SIGUSR1()"), SLOT("slot_handleSIGUSR1()"))
self.connect(self, SIGNAL("SIGTERM()"), SLOT("slot_handleSIGTERM()")) 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("ReloadParametersCallback(int)"), SLOT("slot_handleReloadParametersCallback(int)"))
self.connect(self, SIGNAL("ReloadProgramsCallback(int)"), SLOT("slot_handleReloadProgramsCallback(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("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_AnnounceCallback()"), SLOT("slot_handleNSM_AnnounceCallback()"))
#self.connect(self, SIGNAL("NSM_Open1Callback()"), SLOT("slot_handleNSM_Open1Callback()")) #self.connect(self, SIGNAL("NSM_Open1Callback()"), SLOT("slot_handleNSM_Open1Callback()"))
#self.connect(self, SIGNAL("NSM_Open2Callback()"), SLOT("slot_handleNSM_Open2Callback()")) #self.connect(self, SIGNAL("NSM_Open2Callback()"), SLOT("slot_handleNSM_Open2Callback()"))
@@ -608,6 +679,53 @@ class CarlaMainW(QMainWindow):
#else: #else:
QTimer.singleShot(0, self, SLOT("slot_engineStart()")) 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"): def startEngine(self, clientName = "Carla"):
# --------------------------------------------- # ---------------------------------------------
# Engine settings # Engine settings
@@ -1102,6 +1220,40 @@ class CarlaMainW(QMainWindow):


pwidget.ui.edit_dialog.reloadAll() 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) @pyqtSlot(str)
def slot_handleErrorCallback(self, error): def slot_handleErrorCallback(self, error):
QMessageBox.critical(self, self.tr("Error"), error) QMessageBox.critical(self, self.tr("Error"), error)
@@ -1162,6 +1314,8 @@ class CarlaMainW(QMainWindow):
settings.setValue("Geometry", self.saveGeometry()) settings.setValue("Geometry", self.saveGeometry())
settings.setValue("ShowToolbar", self.ui.toolBar.isVisible()) settings.setValue("ShowToolbar", self.ui.toolBar.isVisible())
settings.setValue("ShowTransport", self.ui.frame_transport.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): def loadSettings(self, geometry):
settings = QSettings() settings = QSettings()
@@ -1179,7 +1333,14 @@ class CarlaMainW(QMainWindow):


self.fSavedSettings = { self.fSavedSettings = {
"Main/DefaultProjectFolder": settings.value("Main/DefaultProjectFolder", HOME, type=str), "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["SF2_PATH"] = splitter.join(Carla.SF2_PATH)
os.environ["SFZ_PATH"] = splitter.join(Carla.SFZ_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): def timerEvent(self, event):
if event.timerId() == self.fIdleTimerFast: if event.timerId() == self.fIdleTimerFast:
Carla.host.engine_idle() Carla.host.engine_idle()
@@ -1239,11 +1411,15 @@ class CarlaMainW(QMainWindow):


self.stopEngine() self.stopEngine()


patchcanvas.clear()
QMainWindow.closeEvent(self, event) 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: if pluginId < 0 or not Carla.gui:
return return


@@ -1281,6 +1457,22 @@ def callbackFunction(ptr, action, pluginId, value1, value2, value3, valueStr):
Carla.gui.emit(SIGNAL("ReloadProgramsCallback(int)"), pluginId) Carla.gui.emit(SIGNAL("ReloadProgramsCallback(int)"), pluginId)
elif action == CALLBACK_RELOAD_ALL: elif action == CALLBACK_RELOAD_ALL:
Carla.gui.emit(SIGNAL("ReloadAllCallback(int)"), pluginId) 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: #elif action == CALLBACK_NSM_ANNOUNCE:
#Carla.gui._nsmAnnounce2str = cString(Carla.host.get_last_error()) #Carla.gui._nsmAnnounce2str = cString(Carla.host.get_last_error())
#Carla.gui.emit(SIGNAL("NSM_AnnounceCallback()")) #Carla.gui.emit(SIGNAL("NSM_AnnounceCallback()"))
@@ -1321,7 +1513,7 @@ if __name__ == '__main__':


# Init backend # Init backend
Carla.host = Host(libPrefix) 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") Carla.host.set_engine_option(OPTION_PROCESS_NAME, 0, "carla")


# Set bridge paths # Set bridge paths


+ 14
- 6
source/carla_shared.py View File

@@ -290,12 +290,20 @@ CALLBACK_RELOAD_INFO = 13
CALLBACK_RELOAD_PARAMETERS = 14 CALLBACK_RELOAD_PARAMETERS = 14
CALLBACK_RELOAD_PROGRAMS = 15 CALLBACK_RELOAD_PROGRAMS = 15
CALLBACK_RELOAD_ALL = 16 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
PROCESS_MODE_SINGLE_CLIENT = 0 PROCESS_MODE_SINGLE_CLIENT = 0


+ 5
- 2
source/utils/CarlaThread.hpp View File

@@ -184,8 +184,11 @@ public:
cthread = nullptr; cthread = nullptr;
} }
#else #else
pthread_join(pthreadId, nullptr);
_zero();
if (! _isNull())
{
pthread_join(pthreadId, nullptr);
_zero();
}
#endif #endif
return false; return false;
} }


Loading…
Cancel
Save