diff --git a/c++/carla-backend/carla_backend.hpp b/c++/carla-backend/carla_backend.hpp index 90c82ac..19726a1 100644 --- a/c++/carla-backend/carla_backend.hpp +++ b/c++/carla-backend/carla_backend.hpp @@ -206,7 +206,7 @@ enum OptionsType { /*! * Set the engine processing mode.\n * Default is PROCESS_MODE_MULTIPLE_CLIENTS. - * \see ProcessModeType + * \see ProcessMode */ OPTION_PROCESS_MODE = 1, diff --git a/c++/carla-backend/carla_backend.pro b/c++/carla-backend/carla_backend.pro index 99227a2..8fd765a 100644 --- a/c++/carla-backend/carla_backend.pro +++ b/c++/carla-backend/carla_backend.pro @@ -49,11 +49,6 @@ LIBS += \ QMAKE_CXXFLAGS *= -std=c++0x -# NTK -QMAKE_CXXFLAGS *= `ntk-config --cxxflags` -QMAKE_LFLAGS *= `ntk-config --ldflags` -LIBS += `ntk-config --libs` - unix { LIBS += -ldl -lm } diff --git a/c++/carla-backend/carla_backend_standalone.cpp b/c++/carla-backend/carla_backend_standalone.cpp index ec0b91d..aa1e6c0 100644 --- a/c++/carla-backend/carla_backend_standalone.cpp +++ b/c++/carla-backend/carla_backend_standalone.cpp @@ -1768,7 +1768,7 @@ void nsm_reply_save() // ------------------------------------------------------------------------------------------------------------------- -#ifdef QTCREATOR_TEST +#if 0 //def QTCREATOR_TEST #include #include diff --git a/resources/ui/carla_plugin.ui b/resources/ui/carla_plugin.ui index 8f78308..7caa33b 100644 --- a/resources/ui/carla_plugin.ui +++ b/resources/ui/carla_plugin.ui @@ -6,7 +6,7 @@ 0 0 - 791 + 731 46 @@ -25,7 +25,7 @@ 16777215 - 46 + 16777215 @@ -52,6 +52,12 @@ + + + 0 + 0 + + 0 @@ -178,21 +184,14 @@ - - - - Qt::Horizontal - - - - 40 - 20 - - - - + + + 0 + 0 + + 160 @@ -357,6 +356,12 @@ + + + 0 + 0 + + 0 @@ -594,7 +599,6 @@ frame_controls area_right area_left - horizontalSpacer diff --git a/src/carla.py b/src/carla.py index ee312ef..b7b9f6f 100755 --- a/src/carla.py +++ b/src/carla.py @@ -22,7 +22,7 @@ from PyQt4.QtCore import QThread from PyQt4.QtGui import QApplication, QMainWindow, QTableWidgetItem # 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 shared_settings import * @@ -1053,77 +1053,6 @@ class PluginDatabaseW(QDialog, ui_carla_database.Ui_PluginDatabaseW): QDialog.done(self, r) 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("" - "
Version %s" - "
Carla is a Multi-Plugin Host for JACK.
" - "
Copyright (C) 2011-2012 falkTX
" - "" % 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 \n" - " /set_drywet \n" - " /set_volume \n" - " /set_balance_left \n" - " /set_balance_right \n" - " /set_parameter_value \n" - " /set_parameter_midi_cc \n" - " /set_parameter_midi_channel \n" - " /set_program \n" - " /set_midi_program \n" - " /note_on \n" - " /note_off \n" - ) - - self.l_example.setText("/Carla/2/set_parameter_value 5 1.0") - self.l_example_help.setText("(as in this example, \"2\" is the plugin number and \"5\" the parameter)") - - 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% complete (using custom extensions).
" - "Implemented Feature/Extensions:" - "
    " - "
  • http://lv2plug.in/ns/ext/atom
  • " - "
  • http://lv2plug.in/ns/ext/buf-size
  • " - "
  • http://lv2plug.in/ns/ext/data-access
  • " - #"
  • http://lv2plug.in/ns/ext/dynmanifest
  • " - "
  • http://lv2plug.in/ns/ext/event
  • " - "
  • http://lv2plug.in/ns/ext/instance-access
  • " - "
  • http://lv2plug.in/ns/ext/log
  • " - "
  • http://lv2plug.in/ns/ext/midi
  • " - "
  • http://lv2plug.in/ns/ext/options
  • " - #"
  • http://lv2plug.in/ns/ext/parameters
  • " - "
  • http://lv2plug.in/ns/ext/patch
  • " - #"
  • http://lv2plug.in/ns/ext/port-groups
  • " - "
  • http://lv2plug.in/ns/ext/port-props
  • " - #"
  • http://lv2plug.in/ns/ext/presets
  • " - "
  • http://lv2plug.in/ns/ext/state
  • " - "
  • http://lv2plug.in/ns/ext/time
  • " - "
  • http://lv2plug.in/ns/ext/uri-map
  • " - "
  • http://lv2plug.in/ns/ext/urid
  • " - "
  • http://lv2plug.in/ns/ext/worker
  • " - "
  • http://lv2plug.in/ns/extensions/ui
  • " - "
  • http://lv2plug.in/ns/extensions/units
  • " - "
  • http://kxstudio.sf.net/ns/lv2ext/external-ui
  • " - "
  • http://kxstudio.sf.net/ns/lv2ext/programs
  • " - "
  • http://kxstudio.sf.net/ns/lv2ext/rtmempool
  • " - "
  • http://ll-plugins.nongnu.org/lv2/ext/midimap
  • " - "
  • http://ll-plugins.nongnu.org/lv2/ext/miditype
  • " - "
")) - self.l_vst.setText(self.tr("

About 85% complete (missing vst bank/presets and some minor stuff)

")) - - def done(self, r): - QDialog.done(self, r) - self.close() - # Main Window class CarlaMainW(QMainWindow, ui_carla.Ui_CarlaMainW): 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_stop.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.m_fakeEdit = PluginEdit(self, -1) @@ -1530,6 +1463,7 @@ class CarlaMainW(QMainWindow, ui_carla.Ui_CarlaMainW): else: pwidget = PluginWidget(self, new_plugin_id) self.w_plugins.layout().addWidget(pwidget) + #self.m_scene.addWidget(new_plugin_id, pwidget) self.m_plugin_list[new_plugin_id] = pwidget 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["SFZ_PATH"] = splitter.join(SFZ_PATH) + #def resizeEvent(self, event): + #self.m_scene.resize() + #QMainWindow.resizeEvent(self, event) + def timerEvent(self, event): if event.timerId() == self.TIMER_GUI_STUFF: for pwidget in self.m_plugin_list: diff --git a/src/carla_control.py b/src/carla_control.py index 9c48280..5a781b5 100755 --- a/src/carla_control.py +++ b/src/carla_control.py @@ -23,7 +23,7 @@ from liblo import send as lo_send from liblo import TCP as LO_TCP # Imports (Custom) -import ui_carla_about, ui_carla_control +import ui_carla_control from shared_carla import * global lo_target, lo_targetName @@ -505,23 +505,6 @@ class ControlServer(ServerThread): def fallback(self, 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("" - "
Version %s" - "
Carla is a Multi-Plugin Host for JACK - OSC Bridge Version.
" - "
Copyright (C) 2011-2012 falkTX
" - "" % VERSION)) - - self.l_extended.setVisible(False) # TODO - write about this special OSC version - - self.tabWidget.removeTab(1) - self.tabWidget.removeTab(1) - # Main Window class CarlaControlW(QMainWindow, ui_carla_control.Ui_CarlaControlW): def __init__(self, parent=None): diff --git a/src/shared_carla.py b/src/shared_carla.py index b860efd..dc11402 100644 --- a/src/shared_carla.py +++ b/src/shared_carla.py @@ -22,7 +22,7 @@ from copy import deepcopy from decimal import Decimal from sip import unwrapinstance 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 try: @@ -32,7 +32,7 @@ except: GuiContainer = QWidget # 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 * # Carla Host object @@ -229,6 +229,21 @@ PALETTE_COLOR_ORANGE = 6 PALETTE_COLOR_BROWN = 7 PALETTE_COLOR_PINK = 8 +CarlaStateParameter = { + 'index': 0, + 'name': "", + 'symbol': "", + 'value': 0.0, + 'midiChannel': 1, + 'midiCC': -1 +} + +CarlaStateCustomData = { + 'type': CUSTOM_DATA_INVALID, + 'key': "", + 'value': "" +} + CarlaSaveState = { 'Type': "", 'Name': "", @@ -249,21 +264,6 @@ CarlaSaveState = { 'Chunk': None } -CarlaSaveStateParameter = { - 'index': 0, - 'name': "", - 'symbol': "", - 'value': 0.0, - 'midiChannel': 1, - 'midiCC': -1 -} - -CarlaSaveStateCustomData = { - 'type': CUSTOM_DATA_INVALID, - 'key': "", - 'value': "" -} - def getCustomDataTypeString(dtype): if dtype == CUSTOM_DATA_STRING: return "string" @@ -290,6 +290,7 @@ def getSaveStateDictFromXML(xmlNode): saveState = deepcopy(CarlaSaveState) node = xmlNode.firstChild() + while not node.isNull(): # ------------------------------------------------------ # Info @@ -298,7 +299,7 @@ def getSaveStateDictFromXML(xmlNode): xmlInfo = node.toElement().firstChild() while not xmlInfo.isNull(): - tag = xmlInfo.toElement().tagName() + tag = xmlInfo.toElement().tagName() text = xmlInfo.toElement().text().strip() if tag == "Type": @@ -321,7 +322,7 @@ def getSaveStateDictFromXML(xmlNode): xmlData = node.toElement().firstChild() while not xmlData.isNull(): - tag = xmlData.toElement().tagName() + tag = xmlData.toElement().tagName() text = xmlData.toElement().text().strip() # ---------------------------------------------- @@ -358,53 +359,53 @@ def getSaveStateDictFromXML(xmlNode): # Parameters elif tag == "Parameter": - saveStateParameter = deepcopy(CarlaSaveStateParameter) + stateParameter = deepcopy(CarlaStateParameter) xmlSubData = xmlData.toElement().firstChild() while not xmlSubData.isNull(): - pTag = xmlSubData.toElement().tagName() + pTag = xmlSubData.toElement().tagName() pText = xmlSubData.toElement().text().strip() if pTag == "index": - if pText.isdigit(): saveStateParameter['index'] = int(pText) + if pText.isdigit(): stateParameter['index'] = int(pText) elif pTag == "name": - saveStateParameter['name'] = xmlSafeString(pText, False) + stateParameter['name'] = xmlSafeString(pText, False) elif pTag == "symbol": - saveStateParameter['symbol'] = xmlSafeString(pText, False) + stateParameter['symbol'] = xmlSafeString(pText, False) elif pTag == "value": - if isNumber(pText): saveStateParameter['value'] = float(pText) + if isNumber(pText): stateParameter['value'] = float(pText) elif pTag == "midiChannel": - if pText.isdigit(): saveStateParameter['midiChannel'] = int(pText) + if pText.isdigit(): stateParameter['midiChannel'] = int(pText) elif pTag == "midiCC": - if pText.isdigit(): saveStateParameter['midiCC'] = int(pText) + if pText.isdigit(): stateParameter['midiCC'] = int(pText) xmlSubData = xmlSubData.nextSibling() - saveState['Parameters'].append(saveStateParameter) + saveState['Parameters'].append(stateParameter) # ---------------------------------------------- # Custom Data elif tag == "CustomData": - saveStateCustomData = deepcopy(CarlaSaveStateCustomData) + stateCustomData = deepcopy(CarlaStateCustomData) xmlSubData = xmlData.toElement().firstChild() while not xmlSubData.isNull(): - cTag = xmlSubData.toElement().tagName() + cTag = xmlSubData.toElement().tagName() cText = xmlSubData.toElement().text().strip() if cTag == "type": - saveStateCustomData['type'] = getCustomDataStringType(cText) + stateCustomData['type'] = getCustomDataStringType(cText) elif cTag == "key": - saveStateCustomData['key'] = xmlSafeString(cText, False) + stateCustomData['key'] = xmlSafeString(cText, False) elif cTag == "value": - saveStateCustomData['value'] = xmlSafeString(cText, False) + stateCustomData['value'] = xmlSafeString(cText, False) xmlSubData = xmlSubData.nextSibling() - saveState['CustomData'].append(saveStateCustomData) + saveState['CustomData'].append(stateCustomData) # ---------------------------------------------- # Chunk @@ -429,7 +430,86 @@ def xmlSafeString(string, toXml): return string.replace("&", "&").replace("<","<").replace(">",">").replace("'","'").replace(""","\"") # ------------------------------------------------------------------------------------------------ -# 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("" + "
Version %s" + "
Carla is a Multi-Plugin Host for JACK%s.
" + "
Copyright (C) 2011-2012 falkTX
" + "" % (VERSION, " - OSC Bridge Version" 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 \n" + " /set_drywet \n" + " /set_volume \n" + " /set_balance_left \n" + " /set_balance_right \n" + " /set_parameter_value \n" + " /set_parameter_midi_cc \n" + " /set_parameter_midi_channel \n" + " /set_program \n" + " /set_midi_program \n" + " /note_on \n" + " /note_off \n" + ) + + self.l_example.setText("/Carla/2/set_parameter_value 5 1.0") + self.l_example_help.setText("(as in this example, \"2\" is the plugin number and \"5\" the parameter)") + + 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% complete (using custom extensions).
" + "Implemented Feature/Extensions:" + "
    " + "
  • http://lv2plug.in/ns/ext/atom
  • " + "
  • http://lv2plug.in/ns/ext/buf-size
  • " + "
  • http://lv2plug.in/ns/ext/data-access
  • " + #"
  • http://lv2plug.in/ns/ext/dynmanifest
  • " + "
  • http://lv2plug.in/ns/ext/event
  • " + "
  • http://lv2plug.in/ns/ext/instance-access
  • " + "
  • http://lv2plug.in/ns/ext/log
  • " + "
  • http://lv2plug.in/ns/ext/midi
  • " + "
  • http://lv2plug.in/ns/ext/options
  • " + #"
  • http://lv2plug.in/ns/ext/parameters
  • " + "
  • http://lv2plug.in/ns/ext/patch
  • " + #"
  • http://lv2plug.in/ns/ext/port-groups
  • " + "
  • http://lv2plug.in/ns/ext/port-props
  • " + #"
  • http://lv2plug.in/ns/ext/presets
  • " + "
  • http://lv2plug.in/ns/ext/state
  • " + "
  • http://lv2plug.in/ns/ext/time
  • " + "
  • http://lv2plug.in/ns/ext/uri-map
  • " + "
  • http://lv2plug.in/ns/ext/urid
  • " + "
  • http://lv2plug.in/ns/ext/worker
  • " + "
  • http://lv2plug.in/ns/extensions/ui
  • " + "
  • http://lv2plug.in/ns/extensions/units
  • " + "
  • http://kxstudio.sf.net/ns/lv2ext/external-ui
  • " + "
  • http://kxstudio.sf.net/ns/lv2ext/programs
  • " + "
  • http://kxstudio.sf.net/ns/lv2ext/rtmempool
  • " + "
  • http://ll-plugins.nongnu.org/lv2/ext/midimap
  • " + "
  • http://ll-plugins.nongnu.org/lv2/ext/miditype
  • " + "
")) + self.l_vst.setText(self.tr("

About 85% complete (missing vst bank/presets and some minor stuff)

")) + + def done(self, r): + QDialog.done(self, r) + self.close() + +# ------------------------------------------------------------------------------------------------ +# PluginParameter.cpp # Plugin Parameter 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_tabIndex = tabIndex - self.add_MIDI_CCs_to_ComboBox() - self.label.setText(pInfo['name']) + for MIDI_CC in MIDI_CC_LIST: + self.combo.addItem(MIDI_CC) + if pType == PARAMETER_INPUT: self.widget.set_minimum(pInfo['minimum']) self.widget.set_maximum(pInfo['maximum']) @@ -497,11 +578,11 @@ class PluginParameter(QWidget, ui_carla_parameter.Ui_PluginParameter): #self.widget.force_plastique_style() if pHints & PARAMETER_USES_CUSTOM_TEXT: - self.widget.set_text_call(self.textCallFunction) + self.widget.set_text_call(self.textCallBack) self.widget.updateAll() - def set_default_value(self, value): + def setDefaultValue(self, value): self.widget.set_default(value) 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.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): for i in range(len(MIDI_CC_LIST)): ccText = MIDI_CC_LIST[i].split(" ")[0] @@ -533,7 +610,7 @@ class PluginParameter(QWidget, ui_carla_parameter.Ui_PluginParameter): def tabIndex(self): return self.m_tabIndex - def textCallFunction(self): + def textCallBack(self): return cString(Carla.host.get_parameter_text(self.m_pluginId, self.m_parameterId)) @pyqtSlot(float) @@ -563,13 +640,14 @@ class PluginParameter(QWidget, ui_carla_parameter.Ui_PluginParameter): # Plugin Editor (Built-in) class PluginEdit(QDialog, ui_carla_edit.Ui_PluginEdit): def __init__(self, parent, pluginId): - QDialog.__init__(self, parent) + QDialog.__init__(self, Carla.gui) self.setupUi(self) self.m_firstShow = True self.m_geometry = None self.m_pluginId = pluginId self.m_pluginInfo = None + self.m_realParent = parent self.m_parameterCount = 0 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'])) # Force-Update parent for new hints (knobs) - self.parent().recheck_hints(pluginHints) + self.m_realParent.recheck_hints(pluginHints) def do_reload_parameters(self): 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) #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): for paramType, paramId, paramWidget in self.m_parameterList: @@ -962,7 +1040,7 @@ class PluginEdit(QDialog, ui_carla_edit.Ui_PluginEdit): content += "\n" content += "\n" content += "\n" % VERSION - content += self.parent().getSaveXMLContent() + content += self.m_realParent.getSaveXMLContent() content += "\n" try: @@ -998,7 +1076,7 @@ class PluginEdit(QDialog, ui_carla_edit.Ui_PluginEdit): saveState = getSaveStateDictFromXML(xmlNode) - self.parent().loadStateDict(saveState) + self.m_realParent.loadStateDict(saveState) def loadStateLV2(self): pass @@ -1027,7 +1105,7 @@ class PluginEdit(QDialog, ui_carla_edit.Ui_PluginEdit): def updateParametersDefaultValues(self): for paramType, paramId, paramWidget in self.m_parameterList: 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): for paramType, paramId, paramWidget in self.m_parameterList: @@ -1154,11 +1232,11 @@ class PluginEdit(QDialog, ui_carla_edit.Ui_PluginEdit): @pyqtSlot() def slot_notesOn(self): - self.parent().led_midi.setChecked(True) + self.m_realParent.led_midi.setChecked(True) @pyqtSlot() def slot_notesOff(self): - self.parent().led_midi.setChecked(False) + self.m_realParent.led_midi.setChecked(False) @pyqtSlot() def slot_checkInputControlParameters(self): @@ -1166,7 +1244,7 @@ class PluginEdit(QDialog, ui_carla_edit.Ui_PluginEdit): @pyqtSlot() def slot_finished(self): - self.parent().b_edit.setChecked(False) + self.m_realParent.b_edit.setChecked(False) def done(self, r): QDialog.done(self, r) @@ -1564,19 +1642,19 @@ class PluginWidget(QFrame, ui_carla_plugin.Ui_PluginWidget): if parameterData['type'] != PARAMETER_INPUT: 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: - saveStateParameter['value'] /= sampleRate + stateParameter['value'] /= sampleRate - saveState['Parameters'].append(saveStateParameter) + saveState['Parameters'].append(stateParameter) # ---------------------------- # Custom Data @@ -1589,13 +1667,13 @@ class PluginWidget(QFrame, ui_carla_plugin.Ui_PluginWidget): if customData['type'] == CUSTOM_DATA_INVALID: 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 @@ -2029,14 +2107,59 @@ class PluginWidget(QFrame, ui_carla_plugin.Ui_PluginWidget): #painter.drawLine(0, self.height() - 1, self.width(), self.height() - 1) 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 class PluginGUI(QDialog): 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.setContentsMargins(0, 0, 0, 0) @@ -2084,7 +2207,7 @@ class PluginGUI(QDialog): def closeEvent(self, event): if event.spontaneous(): - self.parent().b_gui.setChecked(False) + self.m_realParent.b_gui.setChecked(False) QDialog.closeEvent(self, event)