Browse Source

Carla: Continue rework, misc fixes

tags/v0.9.0
falkTX 13 years ago
parent
commit
47407734a2
7 changed files with 228 additions and 185 deletions
  1. +1
    -1
      c++/carla-backend/carla_backend.hpp
  2. +0
    -5
      c++/carla-backend/carla_backend.pro
  3. +1
    -1
      c++/carla-backend/carla_backend_standalone.cpp
  4. +20
    -16
      resources/ui/carla_plugin.ui
  5. +10
    -72
      src/carla.py
  6. +1
    -18
      src/carla_control.py
  7. +195
    -72
      src/shared_carla.py

+ 1
- 1
c++/carla-backend/carla_backend.hpp View File

@@ -206,7 +206,7 @@ enum OptionsType {
/*! /*!
* Set the engine processing mode.\n * Set the engine processing mode.\n
* Default is PROCESS_MODE_MULTIPLE_CLIENTS. * Default is PROCESS_MODE_MULTIPLE_CLIENTS.
* \see ProcessModeType
* \see ProcessMode
*/ */
OPTION_PROCESS_MODE = 1, OPTION_PROCESS_MODE = 1,




+ 0
- 5
c++/carla-backend/carla_backend.pro View File

@@ -49,11 +49,6 @@ LIBS += \


QMAKE_CXXFLAGS *= -std=c++0x QMAKE_CXXFLAGS *= -std=c++0x


# NTK
QMAKE_CXXFLAGS *= `ntk-config --cxxflags`
QMAKE_LFLAGS *= `ntk-config --ldflags`
LIBS += `ntk-config --libs`

unix { unix {
LIBS += -ldl -lm LIBS += -ldl -lm
} }

+ 1
- 1
c++/carla-backend/carla_backend_standalone.cpp View File

@@ -1768,7 +1768,7 @@ void nsm_reply_save()


// ------------------------------------------------------------------------------------------------------------------- // -------------------------------------------------------------------------------------------------------------------


#ifdef QTCREATOR_TEST
#if 0 //def QTCREATOR_TEST


#include <QtGui/QApplication> #include <QtGui/QApplication>
#include <QtGui/QDialog> #include <QtGui/QDialog>


+ 20
- 16
resources/ui/carla_plugin.ui View File

@@ -6,7 +6,7 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>791</width>
<width>731</width>
<height>46</height> <height>46</height>
</rect> </rect>
</property> </property>
@@ -25,7 +25,7 @@
<property name="maximumSize"> <property name="maximumSize">
<size> <size>
<width>16777215</width> <width>16777215</width>
<height>46</height>
<height>16777215</height>
</size> </size>
</property> </property>
<property name="windowTitle"> <property name="windowTitle">
@@ -52,6 +52,12 @@
</property> </property>
<item> <item>
<widget class="QWidget" name="area_left" native="true"> <widget class="QWidget" name="area_left" native="true">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_2"> <layout class="QHBoxLayout" name="horizontalLayout_2">
<property name="spacing"> <property name="spacing">
<number>0</number> <number>0</number>
@@ -178,21 +184,14 @@
</layout> </layout>
</widget> </widget>
</item> </item>
<item>
<spacer name="horizontalSpacer">
<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="QFrame" name="frame_controls"> <widget class="QFrame" name="frame_controls">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize"> <property name="minimumSize">
<size> <size>
<width>160</width> <width>160</width>
@@ -357,6 +356,12 @@
</item> </item>
<item> <item>
<widget class="QWidget" name="area_right" native="true"> <widget class="QWidget" name="area_right" native="true">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<layout class="QHBoxLayout" name="horizontalLayout"> <layout class="QHBoxLayout" name="horizontalLayout">
<property name="spacing"> <property name="spacing">
<number>0</number> <number>0</number>
@@ -594,7 +599,6 @@
<zorder>frame_controls</zorder> <zorder>frame_controls</zorder>
<zorder>area_right</zorder> <zorder>area_right</zorder>
<zorder>area_left</zorder> <zorder>area_left</zorder>
<zorder>horizontalSpacer</zorder>
</widget> </widget>
<customwidgets> <customwidgets>
<customwidget> <customwidget>


+ 10
- 72
src/carla.py View File

@@ -22,7 +22,7 @@ from PyQt4.QtCore import QThread
from PyQt4.QtGui import QApplication, QMainWindow, QTableWidgetItem from PyQt4.QtGui import QApplication, QMainWindow, QTableWidgetItem


# Imports (Custom Stuff) # Imports (Custom Stuff)
import ui_carla, ui_carla_about, ui_carla_database, ui_carla_refresh
import ui_carla, ui_carla_database, ui_carla_refresh
from carla_backend import * from carla_backend import *
from shared_settings import * from shared_settings import *


@@ -1053,77 +1053,6 @@ class PluginDatabaseW(QDialog, ui_carla_database.Ui_PluginDatabaseW):
QDialog.done(self, r) QDialog.done(self, r)
self.close() self.close()


# About Carla Dialog
class CarlaAboutW(QDialog, ui_carla_about.Ui_CarlaAboutW):
def __init__(self, parent):
QDialog.__init__(self, parent)
self.setupUi(self)

self.l_about.setText(self.tr(""
"<br>Version %s"
"<br>Carla is a Multi-Plugin Host for JACK.<br>"
"<br>Copyright (C) 2011-2012 falkTX<br>"
"" % VERSION))

self.l_extended.setText(cString(Carla.host.get_extended_license_text()))
self.le_osc_url.setText(cString(Carla.host.get_host_osc_url()))

self.l_osc_cmds.setText(
" /set_active <i-value>\n"
" /set_drywet <f-value>\n"
" /set_volume <f-value>\n"
" /set_balance_left <f-value>\n"
" /set_balance_right <f-value>\n"
" /set_parameter_value <i-index> <f-value>\n"
" /set_parameter_midi_cc <i-index> <i-cc>\n"
" /set_parameter_midi_channel <i-index> <i-channel>\n"
" /set_program <i-index>\n"
" /set_midi_program <i-index>\n"
" /note_on <i-note> <i-velo>\n"
" /note_off <i-note>\n"
)

self.l_example.setText("/Carla/2/set_parameter_value 5 1.0")
self.l_example_help.setText("<i>(as in this example, \"2\" is the plugin number and \"5\" the parameter)</i>")

self.l_ladspa.setText(self.tr("Everything! (Including LRDF)"))
self.l_dssi.setText(self.tr("Everything! (Including CustomData/Chunks)"))
self.l_lv2.setText(self.tr("About 95&#37; complete (using custom extensions).<br/>"
"Implemented Feature/Extensions:"
"<ul>"
"<li>http://lv2plug.in/ns/ext/atom</li>"
"<li>http://lv2plug.in/ns/ext/buf-size</li>"
"<li>http://lv2plug.in/ns/ext/data-access</li>"
#"<li>http://lv2plug.in/ns/ext/dynmanifest</li>"
"<li>http://lv2plug.in/ns/ext/event</li>"
"<li>http://lv2plug.in/ns/ext/instance-access</li>"
"<li>http://lv2plug.in/ns/ext/log</li>"
"<li>http://lv2plug.in/ns/ext/midi</li>"
"<li>http://lv2plug.in/ns/ext/options</li>"
#"<li>http://lv2plug.in/ns/ext/parameters</li>"
"<li>http://lv2plug.in/ns/ext/patch</li>"
#"<li>http://lv2plug.in/ns/ext/port-groups</li>"
"<li>http://lv2plug.in/ns/ext/port-props</li>"
#"<li>http://lv2plug.in/ns/ext/presets</li>"
"<li>http://lv2plug.in/ns/ext/state</li>"
"<li>http://lv2plug.in/ns/ext/time</li>"
"<li>http://lv2plug.in/ns/ext/uri-map</li>"
"<li>http://lv2plug.in/ns/ext/urid</li>"
"<li>http://lv2plug.in/ns/ext/worker</li>"
"<li>http://lv2plug.in/ns/extensions/ui</li>"
"<li>http://lv2plug.in/ns/extensions/units</li>"
"<li>http://kxstudio.sf.net/ns/lv2ext/external-ui</li>"
"<li>http://kxstudio.sf.net/ns/lv2ext/programs</li>"
"<li>http://kxstudio.sf.net/ns/lv2ext/rtmempool</li>"
"<li>http://ll-plugins.nongnu.org/lv2/ext/midimap</li>"
"<li>http://ll-plugins.nongnu.org/lv2/ext/miditype</li>"
"</ul>"))
self.l_vst.setText(self.tr("<p>About 85&#37; complete (missing vst bank/presets and some minor stuff)</p>"))

def done(self, r):
QDialog.done(self, r)
self.close()

# Main Window # Main Window
class CarlaMainW(QMainWindow, ui_carla.Ui_CarlaMainW): class CarlaMainW(QMainWindow, ui_carla.Ui_CarlaMainW):
def __init__(self, parent=None): def __init__(self, parent=None):
@@ -1175,6 +1104,10 @@ class CarlaMainW(QMainWindow, ui_carla.Ui_CarlaMainW):
self.act_engine_start.setEnabled(False) self.act_engine_start.setEnabled(False)
self.act_engine_stop.setEnabled(False) self.act_engine_stop.setEnabled(False)
self.act_plugin_remove_all.setEnabled(False) self.act_plugin_remove_all.setEnabled(False)

#self.m_scene = CarlaScene(self, self.graphicsView)
#self.graphicsView.setScene(self.m_scene)

self.resize(self.width(), 0) self.resize(self.width(), 0)


#self.m_fakeEdit = PluginEdit(self, -1) #self.m_fakeEdit = PluginEdit(self, -1)
@@ -1530,6 +1463,7 @@ class CarlaMainW(QMainWindow, ui_carla.Ui_CarlaMainW):
else: else:
pwidget = PluginWidget(self, new_plugin_id) pwidget = PluginWidget(self, new_plugin_id)
self.w_plugins.layout().addWidget(pwidget) self.w_plugins.layout().addWidget(pwidget)
#self.m_scene.addWidget(new_plugin_id, pwidget)
self.m_plugin_list[new_plugin_id] = pwidget self.m_plugin_list[new_plugin_id] = pwidget
self.act_plugin_remove_all.setEnabled(True) self.act_plugin_remove_all.setEnabled(True)


@@ -2020,6 +1954,10 @@ class CarlaMainW(QMainWindow, ui_carla.Ui_CarlaMainW):
os.environ["SF2_PATH"] = splitter.join(SF2_PATH) os.environ["SF2_PATH"] = splitter.join(SF2_PATH)
os.environ["SFZ_PATH"] = splitter.join(SFZ_PATH) os.environ["SFZ_PATH"] = splitter.join(SFZ_PATH)


#def resizeEvent(self, event):
#self.m_scene.resize()
#QMainWindow.resizeEvent(self, event)

def timerEvent(self, event): def timerEvent(self, event):
if event.timerId() == self.TIMER_GUI_STUFF: if event.timerId() == self.TIMER_GUI_STUFF:
for pwidget in self.m_plugin_list: for pwidget in self.m_plugin_list:


+ 1
- 18
src/carla_control.py View File

@@ -23,7 +23,7 @@ from liblo import send as lo_send
from liblo import TCP as LO_TCP from liblo import TCP as LO_TCP


# Imports (Custom) # Imports (Custom)
import ui_carla_about, ui_carla_control
import ui_carla_control
from shared_carla import * from shared_carla import *


global lo_target, lo_targetName global lo_target, lo_targetName
@@ -505,23 +505,6 @@ class ControlServer(ServerThread):
def fallback(self, path, args): def fallback(self, path, args):
print("ControlServer::fallback(\"%s\") - unknown message, args =" % path, args) print("ControlServer::fallback(\"%s\") - unknown message, args =" % path, args)


# About Carla Dialog
class CarlaAboutW(QDialog, ui_carla_about.Ui_CarlaAboutW):
def __init__(self, parent):
QDialog.__init__(self, parent)
self.setupUi(self)

self.l_about.setText(self.tr(""
"<br>Version %s"
"<br>Carla is a Multi-Plugin Host for JACK - <b>OSC Bridge Version</b>.<br>"
"<br>Copyright (C) 2011-2012 falkTX<br>"
"" % VERSION))

self.l_extended.setVisible(False) # TODO - write about this special OSC version

self.tabWidget.removeTab(1)
self.tabWidget.removeTab(1)

# Main Window # Main Window
class CarlaControlW(QMainWindow, ui_carla_control.Ui_CarlaControlW): class CarlaControlW(QMainWindow, ui_carla_control.Ui_CarlaControlW):
def __init__(self, parent=None): def __init__(self, parent=None):


+ 195
- 72
src/shared_carla.py View File

@@ -22,7 +22,7 @@ from copy import deepcopy
from decimal import Decimal from decimal import Decimal
from sip import unwrapinstance from sip import unwrapinstance
from PyQt4.QtCore import pyqtSlot, Qt, QSettings, QTimer from PyQt4.QtCore import pyqtSlot, Qt, QSettings, QTimer
from PyQt4.QtGui import QColor, QCursor, QDialog, QFontMetrics, QFrame, QInputDialog, QMenu, QPainter, QPainterPath, QVBoxLayout, QWidget
from PyQt4.QtGui import QColor, QCursor, QDialog, QFontMetrics, QFrame, QGraphicsScene, QInputDialog, QLinearGradient, QMenu, QPainter, QPainterPath, QVBoxLayout, QWidget
from PyQt4.QtXml import QDomDocument from PyQt4.QtXml import QDomDocument


try: try:
@@ -32,7 +32,7 @@ except:
GuiContainer = QWidget GuiContainer = QWidget


# Imports (Custom) # Imports (Custom)
import ui_carla_edit, ui_carla_parameter, ui_carla_plugin
import ui_carla_about, ui_carla_edit, ui_carla_parameter, ui_carla_plugin
from shared import * from shared import *


# Carla Host object # Carla Host object
@@ -229,6 +229,21 @@ PALETTE_COLOR_ORANGE = 6
PALETTE_COLOR_BROWN = 7 PALETTE_COLOR_BROWN = 7
PALETTE_COLOR_PINK = 8 PALETTE_COLOR_PINK = 8


CarlaStateParameter = {
'index': 0,
'name': "",
'symbol': "",
'value': 0.0,
'midiChannel': 1,
'midiCC': -1
}

CarlaStateCustomData = {
'type': CUSTOM_DATA_INVALID,
'key': "",
'value': ""
}

CarlaSaveState = { CarlaSaveState = {
'Type': "", 'Type': "",
'Name': "", 'Name': "",
@@ -249,21 +264,6 @@ CarlaSaveState = {
'Chunk': None 'Chunk': None
} }


CarlaSaveStateParameter = {
'index': 0,
'name': "",
'symbol': "",
'value': 0.0,
'midiChannel': 1,
'midiCC': -1
}

CarlaSaveStateCustomData = {
'type': CUSTOM_DATA_INVALID,
'key': "",
'value': ""
}

def getCustomDataTypeString(dtype): def getCustomDataTypeString(dtype):
if dtype == CUSTOM_DATA_STRING: if dtype == CUSTOM_DATA_STRING:
return "string" return "string"
@@ -290,6 +290,7 @@ def getSaveStateDictFromXML(xmlNode):
saveState = deepcopy(CarlaSaveState) saveState = deepcopy(CarlaSaveState)


node = xmlNode.firstChild() node = xmlNode.firstChild()

while not node.isNull(): while not node.isNull():
# ------------------------------------------------------ # ------------------------------------------------------
# Info # Info
@@ -298,7 +299,7 @@ def getSaveStateDictFromXML(xmlNode):
xmlInfo = node.toElement().firstChild() xmlInfo = node.toElement().firstChild()


while not xmlInfo.isNull(): while not xmlInfo.isNull():
tag = xmlInfo.toElement().tagName()
tag = xmlInfo.toElement().tagName()
text = xmlInfo.toElement().text().strip() text = xmlInfo.toElement().text().strip()


if tag == "Type": if tag == "Type":
@@ -321,7 +322,7 @@ def getSaveStateDictFromXML(xmlNode):
xmlData = node.toElement().firstChild() xmlData = node.toElement().firstChild()


while not xmlData.isNull(): while not xmlData.isNull():
tag = xmlData.toElement().tagName()
tag = xmlData.toElement().tagName()
text = xmlData.toElement().text().strip() text = xmlData.toElement().text().strip()


# ---------------------------------------------- # ----------------------------------------------
@@ -358,53 +359,53 @@ def getSaveStateDictFromXML(xmlNode):
# Parameters # Parameters


elif tag == "Parameter": elif tag == "Parameter":
saveStateParameter = deepcopy(CarlaSaveStateParameter)
stateParameter = deepcopy(CarlaStateParameter)


xmlSubData = xmlData.toElement().firstChild() xmlSubData = xmlData.toElement().firstChild()


while not xmlSubData.isNull(): while not xmlSubData.isNull():
pTag = xmlSubData.toElement().tagName()
pTag = xmlSubData.toElement().tagName()
pText = xmlSubData.toElement().text().strip() pText = xmlSubData.toElement().text().strip()


if pTag == "index": if pTag == "index":
if pText.isdigit(): saveStateParameter['index'] = int(pText)
if pText.isdigit(): stateParameter['index'] = int(pText)
elif pTag == "name": elif pTag == "name":
saveStateParameter['name'] = xmlSafeString(pText, False)
stateParameter['name'] = xmlSafeString(pText, False)
elif pTag == "symbol": elif pTag == "symbol":
saveStateParameter['symbol'] = xmlSafeString(pText, False)
stateParameter['symbol'] = xmlSafeString(pText, False)
elif pTag == "value": elif pTag == "value":
if isNumber(pText): saveStateParameter['value'] = float(pText)
if isNumber(pText): stateParameter['value'] = float(pText)
elif pTag == "midiChannel": elif pTag == "midiChannel":
if pText.isdigit(): saveStateParameter['midiChannel'] = int(pText)
if pText.isdigit(): stateParameter['midiChannel'] = int(pText)
elif pTag == "midiCC": elif pTag == "midiCC":
if pText.isdigit(): saveStateParameter['midiCC'] = int(pText)
if pText.isdigit(): stateParameter['midiCC'] = int(pText)


xmlSubData = xmlSubData.nextSibling() xmlSubData = xmlSubData.nextSibling()


saveState['Parameters'].append(saveStateParameter)
saveState['Parameters'].append(stateParameter)


# ---------------------------------------------- # ----------------------------------------------
# Custom Data # Custom Data


elif tag == "CustomData": elif tag == "CustomData":
saveStateCustomData = deepcopy(CarlaSaveStateCustomData)
stateCustomData = deepcopy(CarlaStateCustomData)


xmlSubData = xmlData.toElement().firstChild() xmlSubData = xmlData.toElement().firstChild()


while not xmlSubData.isNull(): while not xmlSubData.isNull():
cTag = xmlSubData.toElement().tagName()
cTag = xmlSubData.toElement().tagName()
cText = xmlSubData.toElement().text().strip() cText = xmlSubData.toElement().text().strip()


if cTag == "type": if cTag == "type":
saveStateCustomData['type'] = getCustomDataStringType(cText)
stateCustomData['type'] = getCustomDataStringType(cText)
elif cTag == "key": elif cTag == "key":
saveStateCustomData['key'] = xmlSafeString(cText, False)
stateCustomData['key'] = xmlSafeString(cText, False)
elif cTag == "value": elif cTag == "value":
saveStateCustomData['value'] = xmlSafeString(cText, False)
stateCustomData['value'] = xmlSafeString(cText, False)


xmlSubData = xmlSubData.nextSibling() xmlSubData = xmlSubData.nextSibling()


saveState['CustomData'].append(saveStateCustomData)
saveState['CustomData'].append(stateCustomData)


# ---------------------------------------------- # ----------------------------------------------
# Chunk # Chunk
@@ -429,7 +430,86 @@ def xmlSafeString(string, toXml):
return string.replace("&amp;", "&").replace("&lt;","<").replace("&gt;",">").replace("&apos;","'").replace("&quot;","\"") return string.replace("&amp;", "&").replace("&lt;","<").replace("&gt;",">").replace("&apos;","'").replace("&quot;","\"")


# ------------------------------------------------------------------------------------------------ # ------------------------------------------------------------------------------------------------
# Common widgets
# carla_about.cpp

class CarlaAboutW(QDialog, ui_carla_about.Ui_CarlaAboutW):
def __init__(self, parent):
QDialog.__init__(self, parent)
self.setupUi(self)

self.l_about.setText(self.tr(""
"<br>Version %s"
"<br>Carla is a Multi-Plugin Host for JACK%s.<br>"
"<br>Copyright (C) 2011-2012 falkTX<br>"
"" % (VERSION, " - <b>OSC Bridge Version</b>" if Carla.isControl else "")))

if Carla.isControl:
self.l_extended.setVisible(False) # TODO - write about this special OSC version
self.tabWidget.removeTab(1)
self.tabWidget.removeTab(1)

else:
self.l_extended.setText(cString(Carla.host.get_extended_license_text()))
self.le_osc_url.setText(cString(Carla.host.get_host_osc_url()) if Carla.host.is_engine_running() else self.tr("(Engine not running)"))

self.l_osc_cmds.setText(
" /set_active <i-value>\n"
" /set_drywet <f-value>\n"
" /set_volume <f-value>\n"
" /set_balance_left <f-value>\n"
" /set_balance_right <f-value>\n"
" /set_parameter_value <i-index> <f-value>\n"
" /set_parameter_midi_cc <i-index> <i-cc>\n"
" /set_parameter_midi_channel <i-index> <i-channel>\n"
" /set_program <i-index>\n"
" /set_midi_program <i-index>\n"
" /note_on <i-note> <i-velo>\n"
" /note_off <i-note>\n"
)

self.l_example.setText("/Carla/2/set_parameter_value 5 1.0")
self.l_example_help.setText("<i>(as in this example, \"2\" is the plugin number and \"5\" the parameter)</i>")

self.l_ladspa.setText(self.tr("Everything! (Including LRDF)"))
self.l_dssi.setText(self.tr("Everything! (Including CustomData/Chunks)"))
self.l_lv2.setText(self.tr("About 95&#37; complete (using custom extensions).<br/>"
"Implemented Feature/Extensions:"
"<ul>"
"<li>http://lv2plug.in/ns/ext/atom</li>"
"<li>http://lv2plug.in/ns/ext/buf-size</li>"
"<li>http://lv2plug.in/ns/ext/data-access</li>"
#"<li>http://lv2plug.in/ns/ext/dynmanifest</li>"
"<li>http://lv2plug.in/ns/ext/event</li>"
"<li>http://lv2plug.in/ns/ext/instance-access</li>"
"<li>http://lv2plug.in/ns/ext/log</li>"
"<li>http://lv2plug.in/ns/ext/midi</li>"
"<li>http://lv2plug.in/ns/ext/options</li>"
#"<li>http://lv2plug.in/ns/ext/parameters</li>"
"<li>http://lv2plug.in/ns/ext/patch</li>"
#"<li>http://lv2plug.in/ns/ext/port-groups</li>"
"<li>http://lv2plug.in/ns/ext/port-props</li>"
#"<li>http://lv2plug.in/ns/ext/presets</li>"
"<li>http://lv2plug.in/ns/ext/state</li>"
"<li>http://lv2plug.in/ns/ext/time</li>"
"<li>http://lv2plug.in/ns/ext/uri-map</li>"
"<li>http://lv2plug.in/ns/ext/urid</li>"
"<li>http://lv2plug.in/ns/ext/worker</li>"
"<li>http://lv2plug.in/ns/extensions/ui</li>"
"<li>http://lv2plug.in/ns/extensions/units</li>"
"<li>http://kxstudio.sf.net/ns/lv2ext/external-ui</li>"
"<li>http://kxstudio.sf.net/ns/lv2ext/programs</li>"
"<li>http://kxstudio.sf.net/ns/lv2ext/rtmempool</li>"
"<li>http://ll-plugins.nongnu.org/lv2/ext/midimap</li>"
"<li>http://ll-plugins.nongnu.org/lv2/ext/miditype</li>"
"</ul>"))
self.l_vst.setText(self.tr("<p>About 85&#37; complete (missing vst bank/presets and some minor stuff)</p>"))

def done(self, r):
QDialog.done(self, r)
self.close()

# ------------------------------------------------------------------------------------------------
# PluginParameter.cpp


# Plugin Parameter # Plugin Parameter
class PluginParameter(QWidget, ui_carla_parameter.Ui_PluginParameter): class PluginParameter(QWidget, ui_carla_parameter.Ui_PluginParameter):
@@ -446,10 +526,11 @@ class PluginParameter(QWidget, ui_carla_parameter.Ui_PluginParameter):
self.m_parameterId = pInfo['index'] self.m_parameterId = pInfo['index']
self.m_tabIndex = tabIndex self.m_tabIndex = tabIndex


self.add_MIDI_CCs_to_ComboBox()

self.label.setText(pInfo['name']) self.label.setText(pInfo['name'])


for MIDI_CC in MIDI_CC_LIST:
self.combo.addItem(MIDI_CC)

if pType == PARAMETER_INPUT: if pType == PARAMETER_INPUT:
self.widget.set_minimum(pInfo['minimum']) self.widget.set_minimum(pInfo['minimum'])
self.widget.set_maximum(pInfo['maximum']) self.widget.set_maximum(pInfo['maximum'])
@@ -497,11 +578,11 @@ class PluginParameter(QWidget, ui_carla_parameter.Ui_PluginParameter):
#self.widget.force_plastique_style() #self.widget.force_plastique_style()


if pHints & PARAMETER_USES_CUSTOM_TEXT: if pHints & PARAMETER_USES_CUSTOM_TEXT:
self.widget.set_text_call(self.textCallFunction)
self.widget.set_text_call(self.textCallBack)


self.widget.updateAll() self.widget.updateAll()


def set_default_value(self, value):
def setDefaultValue(self, value):
self.widget.set_default(value) self.widget.set_default(value)


def set_parameter_value(self, value, send=True): def set_parameter_value(self, value, send=True):
@@ -515,10 +596,6 @@ class PluginParameter(QWidget, ui_carla_parameter.Ui_PluginParameter):
self.m_midiChannel = channel+1 self.m_midiChannel = channel+1
self.sb_channel.setValue(channel+1) self.sb_channel.setValue(channel+1)


def add_MIDI_CCs_to_ComboBox(self):
for MIDI_CC in MIDI_CC_LIST:
self.combo.addItem(MIDI_CC)

def set_MIDI_CC_in_ComboBox(self, cc): def set_MIDI_CC_in_ComboBox(self, cc):
for i in range(len(MIDI_CC_LIST)): for i in range(len(MIDI_CC_LIST)):
ccText = MIDI_CC_LIST[i].split(" ")[0] ccText = MIDI_CC_LIST[i].split(" ")[0]
@@ -533,7 +610,7 @@ class PluginParameter(QWidget, ui_carla_parameter.Ui_PluginParameter):
def tabIndex(self): def tabIndex(self):
return self.m_tabIndex return self.m_tabIndex


def textCallFunction(self):
def textCallBack(self):
return cString(Carla.host.get_parameter_text(self.m_pluginId, self.m_parameterId)) return cString(Carla.host.get_parameter_text(self.m_pluginId, self.m_parameterId))


@pyqtSlot(float) @pyqtSlot(float)
@@ -563,13 +640,14 @@ class PluginParameter(QWidget, ui_carla_parameter.Ui_PluginParameter):
# Plugin Editor (Built-in) # Plugin Editor (Built-in)
class PluginEdit(QDialog, ui_carla_edit.Ui_PluginEdit): class PluginEdit(QDialog, ui_carla_edit.Ui_PluginEdit):
def __init__(self, parent, pluginId): def __init__(self, parent, pluginId):
QDialog.__init__(self, parent)
QDialog.__init__(self, Carla.gui)
self.setupUi(self) self.setupUi(self)


self.m_firstShow = True self.m_firstShow = True
self.m_geometry = None self.m_geometry = None
self.m_pluginId = pluginId self.m_pluginId = pluginId
self.m_pluginInfo = None self.m_pluginInfo = None
self.m_realParent = parent


self.m_parameterCount = 0 self.m_parameterCount = 0
self.m_parameterList = [] # (type, id, widget) self.m_parameterList = [] # (type, id, widget)
@@ -682,7 +760,7 @@ class PluginEdit(QDialog, ui_carla_edit.Ui_PluginEdit):
self.scrollArea.setVisible((pluginHints & PLUGIN_IS_SYNTH) > 0 or (midiCountInfo['ins'] > 0 < midiCountInfo['outs'])) self.scrollArea.setVisible((pluginHints & PLUGIN_IS_SYNTH) > 0 or (midiCountInfo['ins'] > 0 < midiCountInfo['outs']))


# Force-Update parent for new hints (knobs) # Force-Update parent for new hints (knobs)
self.parent().recheck_hints(pluginHints)
self.m_realParent.recheck_hints(pluginHints)


def do_reload_parameters(self): def do_reload_parameters(self):
parameterCount = Carla.host.get_parameter_count(self.m_pluginId) parameterCount = Carla.host.get_parameter_count(self.m_pluginId)
@@ -929,7 +1007,7 @@ class PluginEdit(QDialog, ui_carla_edit.Ui_PluginEdit):
self.m_parameterIdsToUpdate.append(index) self.m_parameterIdsToUpdate.append(index)


#def set_parameter_default_value(self, index, value): #def set_parameter_default_value(self, index, value):
#self.m_parameterList[index].set_default_value(value)
#self.m_parameterList[index].setDefaultValue(value)


def set_parameter_midi_channel(self, index, midiChannel, blockSignals = False): def set_parameter_midi_channel(self, index, midiChannel, blockSignals = False):
for paramType, paramId, paramWidget in self.m_parameterList: for paramType, paramId, paramWidget in self.m_parameterList:
@@ -962,7 +1040,7 @@ class PluginEdit(QDialog, ui_carla_edit.Ui_PluginEdit):
content += "<?xml version='1.0' encoding='UTF-8'?>\n" content += "<?xml version='1.0' encoding='UTF-8'?>\n"
content += "<!DOCTYPE CARLA-PRESET>\n" content += "<!DOCTYPE CARLA-PRESET>\n"
content += "<CARLA-PRESET VERSION='%s'>\n" % VERSION content += "<CARLA-PRESET VERSION='%s'>\n" % VERSION
content += self.parent().getSaveXMLContent()
content += self.m_realParent.getSaveXMLContent()
content += "</CARLA-PRESET>\n" content += "</CARLA-PRESET>\n"


try: try:
@@ -998,7 +1076,7 @@ class PluginEdit(QDialog, ui_carla_edit.Ui_PluginEdit):


saveState = getSaveStateDictFromXML(xmlNode) saveState = getSaveStateDictFromXML(xmlNode)


self.parent().loadStateDict(saveState)
self.m_realParent.loadStateDict(saveState)


def loadStateLV2(self): def loadStateLV2(self):
pass pass
@@ -1027,7 +1105,7 @@ class PluginEdit(QDialog, ui_carla_edit.Ui_PluginEdit):
def updateParametersDefaultValues(self): def updateParametersDefaultValues(self):
for paramType, paramId, paramWidget in self.m_parameterList: for paramType, paramId, paramWidget in self.m_parameterList:
if self.m_pluginInfo["type"] not in (PLUGIN_GIG, PLUGIN_SF2, PLUGIN_SFZ): if self.m_pluginInfo["type"] not in (PLUGIN_GIG, PLUGIN_SF2, PLUGIN_SFZ):
paramWidget.set_default_value(Carla.host.get_default_parameter_value(self.m_pluginId, paramId))
paramWidget.setDefaultValue(Carla.host.get_default_parameter_value(self.m_pluginId, paramId))


def updateParametersInputs(self): def updateParametersInputs(self):
for paramType, paramId, paramWidget in self.m_parameterList: for paramType, paramId, paramWidget in self.m_parameterList:
@@ -1154,11 +1232,11 @@ class PluginEdit(QDialog, ui_carla_edit.Ui_PluginEdit):


@pyqtSlot() @pyqtSlot()
def slot_notesOn(self): def slot_notesOn(self):
self.parent().led_midi.setChecked(True)
self.m_realParent.led_midi.setChecked(True)


@pyqtSlot() @pyqtSlot()
def slot_notesOff(self): def slot_notesOff(self):
self.parent().led_midi.setChecked(False)
self.m_realParent.led_midi.setChecked(False)


@pyqtSlot() @pyqtSlot()
def slot_checkInputControlParameters(self): def slot_checkInputControlParameters(self):
@@ -1166,7 +1244,7 @@ class PluginEdit(QDialog, ui_carla_edit.Ui_PluginEdit):


@pyqtSlot() @pyqtSlot()
def slot_finished(self): def slot_finished(self):
self.parent().b_edit.setChecked(False)
self.m_realParent.b_edit.setChecked(False)


def done(self, r): def done(self, r):
QDialog.done(self, r) QDialog.done(self, r)
@@ -1564,19 +1642,19 @@ class PluginWidget(QFrame, ui_carla_plugin.Ui_PluginWidget):
if parameterData['type'] != PARAMETER_INPUT: if parameterData['type'] != PARAMETER_INPUT:
continue continue


saveStateParameter = deepcopy(CarlaSaveStateParameter)
stateParameter = deepcopy(CarlaStateParameter)


saveStateParameter['index'] = parameterData['index']
saveStateParameter['name'] = cString(parameterInfo['name'])
saveStateParameter['symbol'] = cString(parameterInfo['symbol'])
saveStateParameter['value'] = Carla.host.get_current_parameter_value(self.m_pluginId, parameterData['index'])
saveStateParameter['midiCC'] = parameterData['midiCC']
saveStateParameter['midiChannel'] = parameterData['midiChannel'] + 1
stateParameter['index'] = parameterData['index']
stateParameter['name'] = cString(parameterInfo['name'])
stateParameter['symbol'] = cString(parameterInfo['symbol'])
stateParameter['value'] = Carla.host.get_current_parameter_value(self.m_pluginId, parameterData['index'])
stateParameter['midiCC'] = parameterData['midiCC']
stateParameter['midiChannel'] = parameterData['midiChannel'] + 1


if parameterData['hints'] & PARAMETER_USES_SAMPLERATE: if parameterData['hints'] & PARAMETER_USES_SAMPLERATE:
saveStateParameter['value'] /= sampleRate
stateParameter['value'] /= sampleRate


saveState['Parameters'].append(saveStateParameter)
saveState['Parameters'].append(stateParameter)


# ---------------------------- # ----------------------------
# Custom Data # Custom Data
@@ -1589,13 +1667,13 @@ class PluginWidget(QFrame, ui_carla_plugin.Ui_PluginWidget):
if customData['type'] == CUSTOM_DATA_INVALID: if customData['type'] == CUSTOM_DATA_INVALID:
continue continue


saveStateCustomData = deepcopy(CarlaSaveStateCustomData)
stateCustomData = deepcopy(CarlaStateCustomData)


saveStateCustomData['type'] = getCustomDataTypeString(customData['type'])
saveStateCustomData['key'] = cString(customData['key'])
saveStateCustomData['value'] = cString(customData['value'])
stateCustomData['type'] = getCustomDataTypeString(customData['type'])
stateCustomData['key'] = cString(customData['key'])
stateCustomData['value'] = cString(customData['value'])


saveState['CustomData'].append(saveStateCustomData)
saveState['CustomData'].append(stateCustomData)


# ---------------------------- # ----------------------------
# Chunk # Chunk
@@ -2029,14 +2107,59 @@ class PluginWidget(QFrame, ui_carla_plugin.Ui_PluginWidget):
#painter.drawLine(0, self.height() - 1, self.width(), self.height() - 1) #painter.drawLine(0, self.height() - 1, self.width(), self.height() - 1)
QFrame.paintEvent(self, event) QFrame.paintEvent(self, event)


# Carla Scene
class CarlaScene(QGraphicsScene):
def __init__(self, parent, view):
QGraphicsScene.__init__(self, parent)

self.m_view = view
if not self.m_view:
qFatal("CarlaScene() - invalid view")

self.m_itemList = []
for x in range(MAX_PLUGINS):
self.m_itemList.append(None)

bgGradient = QLinearGradient(0.0, 0.0, 0.2, 1.0)
bgGradient.setColorAt(0, QColor(7, 7, 7))
bgGradient.setColorAt(1, QColor(28, 28, 28))
self.setBackgroundBrush(bgGradient)

def addWidget(self, idx, widget):
newItem = QGraphicsScene.addWidget(self, widget)
newPosY = 0

for item in self.m_itemList:
if item:
newPosY += item.widget().height()
print(item.widget().height())

print("fin", newPosY)
newItem.setPos(0, newPosY)
newItem.resize(widget.width(), widget.height())
self.m_itemList[idx] = newItem

def resize(self):
width = self.m_view.width()
height = self.m_view.height()
print("Resize", 0, 0, width, height)
self.setSceneRect(0, 0, width, height)

for item in self.m_itemList:
if not item:
continue

item.resize(width, item.widget().height())

# Plugin GUI # Plugin GUI
class PluginGUI(QDialog): class PluginGUI(QDialog):
def __init__(self, parent, pluginName, resizable): def __init__(self, parent, pluginName, resizable):
QDialog.__init__(self, parent)
QDialog.__init__(self, Carla.gui)


self.m_firstShow = True
self.m_resizable = resizable
self.m_geometry = None
self.m_firstShow = True
self.m_resizable = resizable
self.m_geometry = None
self.m_realParent = parent


self.vbLayout = QVBoxLayout(self) self.vbLayout = QVBoxLayout(self)
self.vbLayout.setContentsMargins(0, 0, 0, 0) self.vbLayout.setContentsMargins(0, 0, 0, 0)
@@ -2084,7 +2207,7 @@ class PluginGUI(QDialog):


def closeEvent(self, event): def closeEvent(self, event):
if event.spontaneous(): if event.spontaneous():
self.parent().b_gui.setChecked(False)
self.m_realParent.b_gui.setChecked(False)


QDialog.closeEvent(self, event) QDialog.closeEvent(self, event)




Loading…
Cancel
Save