Browse Source

More work

tags/1.9.4
falkTX 12 years ago
parent
commit
29694514ca
21 changed files with 817 additions and 824 deletions
  1. +19
    -22
      resources/ui/carla.ui
  2. +337
    -147
      resources/ui/carla_edit.ui
  3. +0
    -176
      resources/ui/carla_plugin.ui
  4. +5
    -4
      source/backend/Makefile.mk
  5. +27
    -19
      source/backend/carla_backend.hpp
  6. +1
    -11
      source/backend/carla_plugin.hpp
  7. +14
    -26
      source/backend/engine/carla_engine.cpp
  8. +0
    -40
      source/backend/engine/carla_engine_osc.cpp
  9. +2
    -2
      source/backend/engine/plugin.cpp
  10. +9
    -9
      source/backend/plugin/Makefile
  11. +46
    -46
      source/backend/plugin/carla_plugin_thread.cpp
  12. +3
    -3
      source/backend/plugin/dssi.cpp
  13. +2
    -2
      source/backend/plugin/fluidsynth.cpp
  14. +4
    -4
      source/backend/plugin/linuxsampler.cpp
  15. +2
    -2
      source/backend/plugin/lv2.cpp
  16. +1
    -1
      source/backend/plugin/native.cpp
  17. +2
    -2
      source/backend/plugin/vst.cpp
  18. +6
    -0
      source/backend/standalone/carla_standalone.cpp
  19. +188
    -161
      source/carla.py
  20. +137
    -141
      source/carla_shared.py
  21. +12
    -6
      source/widgets/pixmapdial.py

+ 19
- 22
resources/ui/carla.ui View File

@@ -28,29 +28,26 @@
<number>2</number> <number>2</number>
</property> </property>
<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>
</widget>
</item>
<item>
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
<widget class="QListWidget" name="listWidget">
<property name="verticalScrollBarPolicy">
<enum>Qt::ScrollBarAlwaysOn</enum>
</property>
<property name="horizontalScrollBarPolicy">
<enum>Qt::ScrollBarAlwaysOff</enum>
</property>
<property name="editTriggers">
<set>QAbstractItemView::NoEditTriggers</set>
</property> </property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
<property name="showDropIndicator" stdset="0">
<bool>false</bool>
</property> </property>
</spacer>
<property name="dragDropMode">
<enum>QAbstractItemView::NoDragDrop</enum>
</property>
<property name="selectionMode">
<enum>QAbstractItemView::NoSelection</enum>
</property>
</widget>
</item> </item>
</layout> </layout>
</widget> </widget>
@@ -254,7 +251,7 @@
</action> </action>
<action name="act_engine_configure"> <action name="act_engine_configure">
<property name="enabled"> <property name="enabled">
<bool>false</bool>
<bool>true</bool>
</property> </property>
<property name="icon"> <property name="icon">
<iconset resource="../resources.qrc"> <iconset resource="../resources.qrc">


+ 337
- 147
resources/ui/carla_edit.ui View File

@@ -6,8 +6,8 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>726</width>
<height>476</height>
<width>720</width>
<height>550</height>
</rect> </rect>
</property> </property>
<property name="windowTitle"> <property name="windowTitle">
@@ -22,11 +22,11 @@
<property name="currentIndex"> <property name="currentIndex">
<number>0</number> <number>0</number>
</property> </property>
<widget class="QWidget" name="tab_params">
<widget class="QWidget" name="tabInfo">
<attribute name="title"> <attribute name="title">
<string>Information</string> <string>Information</string>
</attribute> </attribute>
<layout class="QGridLayout" name="gridLayout_3">
<layout class="QGridLayout" name="gridLayout_2">
<item row="0" column="0" colspan="2"> <item row="0" column="0" colspan="2">
<layout class="QHBoxLayout" name="horizontalLayout"> <layout class="QHBoxLayout" name="horizontalLayout">
<item> <item>
@@ -101,7 +101,7 @@ Plugin Name
</item> </item>
</layout> </layout>
</item> </item>
<item row="1" column="0" rowspan="3">
<item row="1" column="0">
<widget class="QGroupBox" name="group_meta"> <widget class="QGroupBox" name="group_meta">
<property name="sizePolicy"> <property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Expanding"> <sizepolicy hsizetype="Preferred" vsizetype="Expanding">
@@ -110,21 +110,28 @@ Plugin Name
</sizepolicy> </sizepolicy>
</property> </property>
<property name="title"> <property name="title">
<string>Meta-Data</string>
<string>Information</string>
</property> </property>
<layout class="QGridLayout" name="gridLayout"> <layout class="QGridLayout" name="gridLayout">
<item row="0" column="0">
<widget class="QLabel" name="label_real_name">
<item row="4" column="0">
<widget class="QLabel" name="label_unique_id">
<property name="text"> <property name="text">
<string>Name:</string>
<string>Unique ID:</string>
</property> </property>
<property name="alignment"> <property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property> </property>
</widget> </widget>
</item> </item>
<item row="0" column="1">
<widget class="QLineEdit" name="le_name">
<item row="3" column="1">
<widget class="QLineEdit" name="le_copyright">
<property name="readOnly">
<bool>true</bool>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QLineEdit" name="le_maker">
<property name="readOnly"> <property name="readOnly">
<bool>true</bool> <bool>true</bool>
</property> </property>
@@ -140,6 +147,30 @@ Plugin Name
</property> </property>
</widget> </widget>
</item> </item>
<item row="0" column="1">
<widget class="QLineEdit" name="le_name">
<property name="readOnly">
<bool>true</bool>
</property>
</widget>
</item>
<item row="5" column="0">
<widget class="QLabel" name="label_type">
<property name="text">
<string>Type:</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="8" column="1">
<widget class="QLineEdit" name="le_params">
<property name="readOnly">
<bool>true</bool>
</property>
</widget>
</item>
<item row="1" column="1"> <item row="1" column="1">
<widget class="QLineEdit" name="le_label"> <widget class="QLineEdit" name="le_label">
<property name="readOnly"> <property name="readOnly">
@@ -157,8 +188,8 @@ Plugin Name
</property> </property>
</widget> </widget>
</item> </item>
<item row="2" column="1">
<widget class="QLineEdit" name="le_maker">
<item row="4" column="1">
<widget class="QLineEdit" name="le_unique_id">
<property name="readOnly"> <property name="readOnly">
<bool>true</bool> <bool>true</bool>
</property> </property>
@@ -174,63 +205,38 @@ Plugin Name
</property> </property>
</widget> </widget>
</item> </item>
<item row="3" column="1">
<widget class="QLineEdit" name="le_copyright">
<property name="readOnly">
<bool>true</bool>
</property>
</widget>
</item>
<item row="4" column="0">
<widget class="QLabel" name="label_unique_id">
<item row="0" column="0">
<widget class="QLabel" name="label_real_name">
<property name="text"> <property name="text">
<string>Unique ID:</string>
<string>Name:</string>
</property> </property>
<property name="alignment"> <property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property> </property>
</widget> </widget>
</item> </item>
<item row="4" column="1">
<widget class="QLineEdit" name="le_unique_id">
<item row="5" column="1">
<widget class="QLineEdit" name="le_type">
<property name="readOnly"> <property name="readOnly">
<bool>true</bool> <bool>true</bool>
</property> </property>
</widget> </widget>
</item> </item>
<item row="5" column="0">
<widget class="QLabel" name="label_type">
<property name="text">
<string>Type:</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
<item row="7" column="1">
<widget class="QLineEdit" name="le_aouts">
<property name="readOnly">
<bool>true</bool>
</property> </property>
</widget> </widget>
</item> </item>
<item row="5" column="1">
<widget class="QLineEdit" name="le_type">
<item row="6" column="1">
<widget class="QLineEdit" name="le_ains">
<property name="readOnly"> <property name="readOnly">
<bool>true</bool> <bool>true</bool>
</property> </property>
</widget> </widget>
</item> </item>
</layout>
</widget>
</item>
<item row="1" column="1">
<widget class="QGroupBox" name="group_proc">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="title">
<string>Processing Data</string>
</property>
<layout class="QGridLayout" name="gridLayout_2">
<item row="0" column="0">
<item row="6" column="0">
<widget class="QLabel" name="label_ains"> <widget class="QLabel" name="label_ains">
<property name="text"> <property name="text">
<string>Audio Inputs:</string> <string>Audio Inputs:</string>
@@ -240,14 +246,7 @@ Plugin Name
</property> </property>
</widget> </widget>
</item> </item>
<item row="0" column="1">
<widget class="QLineEdit" name="le_ains">
<property name="readOnly">
<bool>true</bool>
</property>
</widget>
</item>
<item row="1" column="0">
<item row="7" column="0">
<widget class="QLabel" name="label_aouts"> <widget class="QLabel" name="label_aouts">
<property name="text"> <property name="text">
<string>Audio Outputs:</string> <string>Audio Outputs:</string>
@@ -257,137 +256,323 @@ Plugin Name
</property> </property>
</widget> </widget>
</item> </item>
<item row="1" column="1">
<widget class="QLineEdit" name="le_aouts">
<property name="readOnly">
<bool>true</bool>
<item row="8" column="0">
<widget class="QLabel" name="label_params">
<property name="text">
<string>Parameters:</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property> </property>
</widget> </widget>
</item> </item>
<item row="2" column="0">
<widget class="QLabel" name="label_params">
<item row="9" column="0">
<widget class="QLabel" name="label_latency">
<property name="text"> <property name="text">
<string>Parameters:</string>
<string>Latency</string>
</property> </property>
<property name="alignment"> <property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property> </property>
</widget> </widget>
</item> </item>
<item row="2" column="1">
<widget class="QLineEdit" name="le_params">
<item row="9" column="1">
<widget class="QLineEdit" name="le_latency">
<property name="readOnly"> <property name="readOnly">
<bool>true</bool> <bool>true</bool>
</property> </property>
</widget> </widget>
</item> </item>
<item row="4" column="0">
<widget class="QLabel" name="label_is_synth">
</layout>
</widget>
</item>
<item row="1" column="1">
<widget class="QGroupBox" name="groupBox">
<property name="title">
<string>Configuration</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_2">
<item>
<widget class="QCheckBox" name="checkBox">
<property name="text"> <property name="text">
<string>Is Synth:</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
<string>Fixed-size buffer</string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="4" column="1">
<widget class="QLineEdit" name="le_is_synth">
<property name="readOnly">
<bool>true</bool>
<item>
<widget class="QCheckBox" name="checkBox_2">
<property name="text">
<string>Force Stereo</string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="5" column="0">
<widget class="QLabel" name="label_has_gui">
<item>
<widget class="QCheckBox" name="checkBox_3">
<property name="text"> <property name="text">
<string>Has External GUI:</string>
<string>Self-automation</string>
</property> </property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</widget>
</item>
<item>
<widget class="QCheckBox" name="checkBox_4">
<property name="text">
<string>Use chunks</string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="5" column="1">
<widget class="QLineEdit" name="le_has_gui">
<property name="readOnly">
<bool>true</bool>
<item>
<widget class="QCheckBox" name="checkBox_5">
<property name="text">
<string>Send All Sound/Notes Off</string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="3" column="1">
<widget class="QLineEdit" name="le_couts">
<property name="readOnly">
<bool>true</bool>
<item>
<widget class="QCheckBox" name="checkBox_6">
<property name="text">
<string>Send Note-Off Velocity</string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="3" column="0">
<widget class="QLabel" name="label_couts">
<item>
<widget class="QCheckBox" name="checkBox_7">
<property name="text"> <property name="text">
<string>Control Outputs:</string>
<string>Send Note Aftertouch</string>
</property> </property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</widget>
</item>
<item>
<widget class="QCheckBox" name="checkBox_8">
<property name="text">
<string>Send Pitchbend</string>
</property> </property>
</widget> </widget>
</item> </item>
</layout>
</widget>
</item>
<item row="2" column="1">
<widget class="QTabWidget" name="tab_programs">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="currentIndex">
<number>0</number>
</property>
<widget class="QWidget" name="programs">
<attribute name="title">
<string>Programs</string>
</attribute>
<layout class="QHBoxLayout" name="horizontalLayout_3">
<item>
<widget class="QComboBox" name="cb_programs"/>
</item>
<item>
<widget class="QToolButton" name="b_reload_program">
<property name="text">
<string/>
<item>
<widget class="QFrame" name="frame">
<property name="frameShape">
<enum>QFrame::StyledPanel</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Raised</enum>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_5">
<property name="topMargin">
<number>0</number>
</property> </property>
<property name="icon">
<iconset resource="../resources.qrc">
<normaloff>:/16x16/document-open.png</normaloff>:/16x16/document-open.png</iconset>
<property name="bottomMargin">
<number>0</number>
</property> </property>
<item>
<widget class="QLabel" name="label_5">
<property name="text">
<string>MIDI Control Channel:</string>
</property>
</widget>
</item>
<item>
<widget class="QSpinBox" name="spinBox">
<property name="minimum">
<number>1</number>
</property>
<property name="maximum">
<number>16</number>
</property>
</widget>
</item>
<item>
<widget class="PixmapDial" name="dial_vol">
<property name="minimumSize">
<size>
<width>34</width>
<height>34</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>34</width>
<height>34</height>
</size>
</property>
<property name="contextMenuPolicy">
<enum>Qt::CustomContextMenu</enum>
</property>
<property name="statusTip">
<string>Output volume (100%)</string>
</property>
<property name="maximum">
<number>1270</number>
</property>
<property name="value">
<number>1000</number>
</property>
</widget>
</item>
<item>
<widget class="PixmapDial" name="dial_drywet">
<property name="minimumSize">
<size>
<width>34</width>
<height>34</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>34</width>
<height>34</height>
</size>
</property>
<property name="contextMenuPolicy">
<enum>Qt::CustomContextMenu</enum>
</property>
<property name="statusTip">
<string>Output dry/wet (100%)</string>
</property>
<property name="maximum">
<number>1000</number>
</property>
<property name="value">
<number>1000</number>
</property>
</widget>
</item>
<item>
<widget class="PixmapDial" name="dial_b_left">
<property name="minimumSize">
<size>
<width>26</width>
<height>26</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>26</width>
<height>26</height>
</size>
</property>
<property name="contextMenuPolicy">
<enum>Qt::CustomContextMenu</enum>
</property>
<property name="statusTip">
<string>Balance Left (0%)</string>
</property>
<property name="minimum">
<number>-1000</number>
</property>
<property name="maximum">
<number>1000</number>
</property>
<property name="value">
<number>-1000</number>
</property>
</widget>
</item>
<item>
<widget class="PixmapDial" name="dial_b_right">
<property name="minimumSize">
<size>
<width>26</width>
<height>26</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>26</width>
<height>26</height>
</size>
</property>
<property name="contextMenuPolicy">
<enum>Qt::CustomContextMenu</enum>
</property>
<property name="statusTip">
<string>Balance Right (0%)</string>
</property>
<property name="minimum">
<number>-1000</number>
</property>
<property name="maximum">
<number>1000</number>
</property>
<property name="value">
<number>1000</number>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QTabWidget" name="tab_programs">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="tabPosition">
<enum>QTabWidget::South</enum>
</property>
<property name="currentIndex">
<number>0</number>
</property>
<widget class="QWidget" name="programs">
<attribute name="title">
<string>Programs</string>
</attribute>
<layout class="QHBoxLayout" name="horizontalLayout_3">
<item>
<widget class="QComboBox" name="cb_programs"/>
</item>
<item>
<widget class="QToolButton" name="b_reload_program">
<property name="text">
<string/>
</property>
<property name="icon">
<iconset resource="../resources.qrc">
<normaloff>:/16x16/document-open.png</normaloff>:/16x16/document-open.png</iconset>
</property>
</widget>
</item>
</layout>
</widget> </widget>
</item>
</layout>
</widget>
<widget class="QWidget" name="midi_programs">
<attribute name="title">
<string>MIDI Programs</string>
</attribute>
<layout class="QHBoxLayout" name="horizontalLayout_4">
<item>
<widget class="QComboBox" name="cb_midi_programs"/>
</item>
<item>
<widget class="QToolButton" name="b_reload_midi_program">
<property name="text">
<string/>
</property>
<property name="icon">
<iconset resource="../resources.qrc">
<normaloff>:/16x16/document-open.png</normaloff>:/16x16/document-open.png</iconset>
</property>
<widget class="QWidget" name="midi_programs">
<attribute name="title">
<string>MIDI Programs</string>
</attribute>
<layout class="QHBoxLayout" name="horizontalLayout_4">
<item>
<widget class="QComboBox" name="cb_midi_programs"/>
</item>
<item>
<widget class="QToolButton" name="b_reload_midi_program">
<property name="text">
<string/>
</property>
<property name="icon">
<iconset resource="../resources.qrc">
<normaloff>:/16x16/document-open.png</normaloff>:/16x16/document-open.png</iconset>
</property>
</widget>
</item>
</layout>
</widget> </widget>
</item>
</layout>
</widget>
</widget>
</item>
<item>
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget> </widget>
</item> </item>
</layout> </layout>
@@ -486,6 +671,11 @@ Plugin Name
<header>pixmapkeyboard.h</header> <header>pixmapkeyboard.h</header>
<container>1</container> <container>1</container>
</customwidget> </customwidget>
<customwidget>
<class>PixmapDial</class>
<extends>QDial</extends>
<header>pixmapdial.h</header>
</customwidget>
</customwidgets> </customwidgets>
<resources> <resources>
<include location="../resources.qrc"/> <include location="../resources.qrc"/>


+ 0
- 176
resources/ui/carla_plugin.ui View File

@@ -184,176 +184,6 @@
</layout> </layout>
</widget> </widget>
</item> </item>
<item>
<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">
<size>
<width>160</width>
<height>40</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>160</width>
<height>40</height>
</size>
</property>
<property name="frameShape">
<enum>QFrame::StyledPanel</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Raised</enum>
</property>
<widget class="PixmapDial" name="dial_drywet">
<property name="geometry">
<rect>
<x>8</x>
<y>0</y>
<width>34</width>
<height>34</height>
</rect>
</property>
<property name="minimumSize">
<size>
<width>34</width>
<height>34</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>34</width>
<height>34</height>
</size>
</property>
<property name="contextMenuPolicy">
<enum>Qt::CustomContextMenu</enum>
</property>
<property name="statusTip">
<string>Output dry/wet (100%)</string>
</property>
<property name="maximum">
<number>1000</number>
</property>
<property name="value">
<number>1000</number>
</property>
</widget>
<widget class="PixmapDial" name="dial_vol">
<property name="geometry">
<rect>
<x>57</x>
<y>0</y>
<width>34</width>
<height>34</height>
</rect>
</property>
<property name="minimumSize">
<size>
<width>34</width>
<height>34</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>34</width>
<height>34</height>
</size>
</property>
<property name="contextMenuPolicy">
<enum>Qt::CustomContextMenu</enum>
</property>
<property name="statusTip">
<string>Output volume (100%)</string>
</property>
<property name="maximum">
<number>1270</number>
</property>
<property name="value">
<number>1000</number>
</property>
</widget>
<widget class="PixmapDial" name="dial_b_left">
<property name="geometry">
<rect>
<x>103</x>
<y>0</y>
<width>26</width>
<height>26</height>
</rect>
</property>
<property name="minimumSize">
<size>
<width>26</width>
<height>26</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>26</width>
<height>26</height>
</size>
</property>
<property name="contextMenuPolicy">
<enum>Qt::CustomContextMenu</enum>
</property>
<property name="statusTip">
<string>Balance Left (0%)</string>
</property>
<property name="minimum">
<number>-1000</number>
</property>
<property name="maximum">
<number>1000</number>
</property>
<property name="value">
<number>-1000</number>
</property>
</widget>
<widget class="PixmapDial" name="dial_b_right">
<property name="geometry">
<rect>
<x>130</x>
<y>0</y>
<width>26</width>
<height>26</height>
</rect>
</property>
<property name="minimumSize">
<size>
<width>26</width>
<height>26</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>26</width>
<height>26</height>
</size>
</property>
<property name="contextMenuPolicy">
<enum>Qt::CustomContextMenu</enum>
</property>
<property name="statusTip">
<string>Balance Right (0%)</string>
</property>
<property name="minimum">
<number>-1000</number>
</property>
<property name="maximum">
<number>1000</number>
</property>
<property name="value">
<number>1000</number>
</property>
</widget>
</widget>
</item>
<item> <item>
<widget class="QWidget" name="area_right" native="true"> <widget class="QWidget" name="area_right" native="true">
<property name="sizePolicy"> <property name="sizePolicy">
@@ -596,16 +426,10 @@
</widget> </widget>
</item> </item>
</layout> </layout>
<zorder>frame_controls</zorder>
<zorder>area_right</zorder> <zorder>area_right</zorder>
<zorder>area_left</zorder> <zorder>area_left</zorder>
</widget> </widget>
<customwidgets> <customwidgets>
<customwidget>
<class>PixmapDial</class>
<extends>QDial</extends>
<header>pixmapdial.h</header>
</customwidget>
<customwidget> <customwidget>
<class>DigitalPeakMeter</class> <class>DigitalPeakMeter</class>
<extends>QWidget</extends> <extends>QWidget</extends>


+ 5
- 4
source/backend/Makefile.mk View File

@@ -17,8 +17,9 @@ LINK_FLAGS += $(shell pkg-config --libs QtCore)
# -------------------------------------------------------------- # --------------------------------------------------------------


ifeq ($(CARLA_PLUGIN_SUPPORT),true) ifeq ($(CARLA_PLUGIN_SUPPORT),true)
BUILD_C_FLAGS += -DWANT_LV2
BUILD_CXX_FLAGS += -DWANT_LADSPA -DWANT_DSSI -DWANT_LV2 -DWANT_VST
# BUILD_C_FLAGS += -DWANT_LV2
# BUILD_CXX_FLAGS += -DWANT_LADSPA -DWANT_DSSI -DWANT_LV2 -DWANT_VST
BUILD_CXX_FLAGS += -DWANT_LADSPA
endif endif


ifeq ($(CARLA_RTAUDIO_SUPPORT),true) ifeq ($(CARLA_RTAUDIO_SUPPORT),true)
@@ -32,11 +33,11 @@ BUILD_CXX_FLAGS += -DWANT_JACK
endif endif


ifeq ($(HAVE_FLUIDSYNTH),true) ifeq ($(HAVE_FLUIDSYNTH),true)
BUILD_CXX_FLAGS += -DWANT_FLUIDSYNTH
# BUILD_CXX_FLAGS += -DWANT_FLUIDSYNTH
endif endif


ifeq ($(HAVE_LINUXSAMPLER),true) ifeq ($(HAVE_LINUXSAMPLER),true)
BUILD_CXX_FLAGS += -DWANT_LINUXSAMPLER
# BUILD_CXX_FLAGS += -DWANT_LINUXSAMPLER
endif endif


ifeq ($(HAVE_SUIL),true) ifeq ($(HAVE_SUIL),true)


+ 27
- 19
source/backend/carla_backend.hpp View File

@@ -407,20 +407,28 @@ enum CallbackType {
CALLBACK_PLUGIN_REMOVED = 2, CALLBACK_PLUGIN_REMOVED = 2,


/*! /*!
* A parameter has been changed.
* A parameter value has been changed.
* *
* \param value1 Parameter index * \param value1 Parameter index
* \param value3 Value * \param value3 Value
*/ */
CALLBACK_PARAMETER_VALUE_CHANGED = 3, CALLBACK_PARAMETER_VALUE_CHANGED = 3,


/*!
* A parameter default has been changed.
*
* \param value1 Parameter index
* \param value3 Default value
*/
CALLBACK_PARAMETER_DEFAULT_CHANGED = 4,

/*! /*!
* A parameter's MIDI channel has been changed. * A parameter's MIDI channel has been changed.
* *
* \param value1 Parameter index * \param value1 Parameter index
* \param value2 MIDI channel * \param value2 MIDI channel
*/ */
CALLBACK_PARAMETER_MIDI_CHANNEL_CHANGED = 4,
CALLBACK_PARAMETER_MIDI_CHANNEL_CHANGED = 5,


/*! /*!
* A parameter's MIDI CC has been changed. * A parameter's MIDI CC has been changed.
@@ -428,14 +436,14 @@ enum CallbackType {
* \param value1 Parameter index * \param value1 Parameter index
* \param value2 MIDI CC * \param value2 MIDI CC
*/ */
CALLBACK_PARAMETER_MIDI_CC_CHANGED = 5,
CALLBACK_PARAMETER_MIDI_CC_CHANGED = 6,


/*! /*!
* The current program has has been changed. * The current program has has been changed.
* *
* \param value1 Program index * \param value1 Program index
*/ */
CALLBACK_PROGRAM_CHANGED = 6,
CALLBACK_PROGRAM_CHANGED = 7,


/*! /*!
* The current MIDI program has been changed. * The current MIDI program has been changed.
@@ -443,7 +451,7 @@ enum CallbackType {
* \param value1 MIDI bank * \param value1 MIDI bank
* \param value2 MIDI program * \param value2 MIDI program
*/ */
CALLBACK_MIDI_PROGRAM_CHANGED = 7,
CALLBACK_MIDI_PROGRAM_CHANGED = 8,


/*! /*!
* A note has been pressed. * A note has been pressed.
@@ -452,7 +460,7 @@ enum CallbackType {
* \param value2 Note * \param value2 Note
* \param value3 Velocity * \param value3 Velocity
*/ */
CALLBACK_NOTE_ON = 8,
CALLBACK_NOTE_ON = 9,


/*! /*!
* A note has been released. * A note has been released.
@@ -460,7 +468,7 @@ enum CallbackType {
* \param value1 Channel * \param value1 Channel
* \param value2 Note * \param value2 Note
*/ */
CALLBACK_NOTE_OFF = 9,
CALLBACK_NOTE_OFF = 10,


/*! /*!
* The plugin's custom GUI state has changed. * The plugin's custom GUI state has changed.
@@ -470,62 +478,62 @@ enum CallbackType {
* 1: GUI has been shown\n * 1: GUI has been shown\n
* -1: GUI has crashed and should not be shown again * -1: GUI has crashed and should not be shown again
*/ */
CALLBACK_SHOW_GUI = 10,
CALLBACK_SHOW_GUI = 11,


/*! /*!
* The plugin needs update. * The plugin needs update.
*/ */
CALLBACK_UPDATE = 11,
CALLBACK_UPDATE = 12,


/*! /*!
* The plugin's data/information has changed. * The plugin's data/information has changed.
*/ */
CALLBACK_RELOAD_INFO = 12,
CALLBACK_RELOAD_INFO = 13,


/*! /*!
* The plugin's parameters have changed. * The plugin's parameters have changed.
*/ */
CALLBACK_RELOAD_PARAMETERS = 13,
CALLBACK_RELOAD_PARAMETERS = 14,


/*! /*!
* The plugin's programs have changed. * The plugin's programs have changed.
*/ */
CALLBACK_RELOAD_PROGRAMS = 14,
CALLBACK_RELOAD_PROGRAMS = 15,


/*! /*!
* The plugin's state has changed. * The plugin's state has changed.
*/ */
CALLBACK_RELOAD_ALL = 15,
CALLBACK_RELOAD_ALL = 16,


/*! /*!
* Non-Session-Manager Announce message. * Non-Session-Manager Announce message.
*/ */
CALLBACK_NSM_ANNOUNCE = 16,
CALLBACK_NSM_ANNOUNCE = 17,


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


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


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


/*! /*!
* An error occurred, show last error to user. * An error occurred, show last error to user.
*/ */
CALLBACK_ERROR = 20,
CALLBACK_ERROR = 21,


/*! /*!
* The engine has crashed or malfunctioned and will no longer work. * The engine has crashed or malfunctioned and will no longer work.
*/ */
CALLBACK_QUIT = 21
CALLBACK_QUIT = 22
}; };


/*! /*!


+ 1
- 11
source/backend/carla_plugin.hpp View File

@@ -756,23 +756,13 @@ public:
static CarlaPlugin* newNative(const Initializer& init); static CarlaPlugin* newNative(const Initializer& init);
static CarlaPlugin* newBridge(const Initializer& init, const BinaryType btype, const PluginType ptype, const char* const bridgeFilename); static CarlaPlugin* newBridge(const Initializer& init, const BinaryType btype, const PluginType ptype, const char* const bridgeFilename);
#endif #endif
#ifdef WANT_LADSPA
static CarlaPlugin* newLADSPA(const Initializer& init, const LADSPA_RDF_Descriptor* const rdfDescriptor); static CarlaPlugin* newLADSPA(const Initializer& init, const LADSPA_RDF_Descriptor* const rdfDescriptor);
#endif
#ifdef WANT_DSSI
static CarlaPlugin* newDSSI(const Initializer& init, const char* const guiFilename); static CarlaPlugin* newDSSI(const Initializer& init, const char* const guiFilename);
#endif
#ifdef WANT_LV2
static CarlaPlugin* newLV2(const Initializer& init); static CarlaPlugin* newLV2(const Initializer& init);
#endif
#ifdef WANT_VST
static CarlaPlugin* newVST(const Initializer& init); static CarlaPlugin* newVST(const Initializer& init);
#endif
#ifdef WANT_LINUXSAMPLER
#ifndef BUILD_BRIDGE
static CarlaPlugin* newGIG(const Initializer& init); static CarlaPlugin* newGIG(const Initializer& init);
static CarlaPlugin* newSFZ(const Initializer& init); static CarlaPlugin* newSFZ(const Initializer& init);
#endif
#ifdef WANT_FLUIDSYNTH
static CarlaPlugin* newSF2(const Initializer& init); static CarlaPlugin* newSF2(const Initializer& init);
#endif #endif




+ 14
- 26
source/backend/engine/carla_engine.cpp View File

@@ -770,6 +770,7 @@ bool CarlaEngine::addPlugin(const BinaryType btype, const PluginType ptype, cons
#if 0 #if 0
plugin = CarlaPlugin::newBridge(init, btype, ptype, bridgeBinary); plugin = CarlaPlugin::newBridge(init, btype, ptype, bridgeBinary);
#endif #endif
setLastError("Bridged plugins are not implemented yet");
} }
else else
#endif // BUILD_BRIDGE #endif // BUILD_BRIDGE
@@ -786,51 +787,32 @@ bool CarlaEngine::addPlugin(const BinaryType btype, const PluginType ptype, cons
#endif #endif


case PLUGIN_LADSPA: case PLUGIN_LADSPA:
#ifdef WANT_LADSPA
plugin = CarlaPlugin::newLADSPA(init, (const LADSPA_RDF_Descriptor*)extra); plugin = CarlaPlugin::newLADSPA(init, (const LADSPA_RDF_Descriptor*)extra);
#endif
break; break;


#if 0
case PLUGIN_DSSI: case PLUGIN_DSSI:
#ifdef WANT_DSSI
plugin = CarlaPlugin::newDSSI(init, extra);
#endif
plugin = CarlaPlugin::newDSSI(init, (const char*)extra);
break; break;


case PLUGIN_LV2: case PLUGIN_LV2:
#ifdef WANT_LV2
plugin = CarlaPlugin::newLV2(init); plugin = CarlaPlugin::newLV2(init);
#endif
break; break;


case PLUGIN_VST: case PLUGIN_VST:
#ifdef WANT_VST
plugin = CarlaPlugin::newVST(init); plugin = CarlaPlugin::newVST(init);
#endif
break; break;


case PLUGIN_GIG: case PLUGIN_GIG:
#ifdef WANT_LINUXSAMPLER
plugin = CarlaPlugin::newGIG(init); plugin = CarlaPlugin::newGIG(init);
#endif
break; break;


case PLUGIN_SF2: case PLUGIN_SF2:
#ifdef WANT_FLUIDSYNTH
plugin = CarlaPlugin::newSF2(init); plugin = CarlaPlugin::newSF2(init);
#endif
break; break;


case PLUGIN_SFZ: case PLUGIN_SFZ:
#ifdef WANT_LINUXSAMPLER
plugin = CarlaPlugin::newSFZ(init); plugin = CarlaPlugin::newSFZ(init);
#endif
break;
#else
default:
break; break;
#endif
} }
} }


@@ -1209,20 +1191,26 @@ void CarlaEngine::bufferSizeChanged(const uint32_t newBufferSize)
{ {
qDebug("CarlaEngine::bufferSizeChanged(%i)", newBufferSize); qDebug("CarlaEngine::bufferSizeChanged(%i)", newBufferSize);


#if 0
for (unsigned short i=0; i < data->maxPluginNumber; i++)
for (unsigned int i=0; i < fData->curPluginCount; i++)
{ {
if (data->carlaPlugins[i] && data->carlaPlugins[i]->enabled() /*&& ! data->carlaPlugins[i]->data->processHighPrecision*/)
data->carlaPlugins[i]->bufferSizeChanged(newBufferSize);
CarlaPlugin* const plugin = getPluginUnchecked(i);

if (plugin != nullptr && plugin->enabled())
plugin->bufferSizeChanged(newBufferSize);
} }
#endif
} }


void CarlaEngine::sampleRateChanged(const double newSampleRate) void CarlaEngine::sampleRateChanged(const double newSampleRate)
{ {
qDebug("CarlaEngine::sampleRateChanged(%g)", newSampleRate); qDebug("CarlaEngine::sampleRateChanged(%g)", newSampleRate);


// TODO
for (unsigned int i=0; i < fData->curPluginCount; i++)
{
CarlaPlugin* const plugin = getPluginUnchecked(i);

if (plugin != nullptr && plugin->enabled())
plugin->sampleRateChanged(newSampleRate);
}
} }


void CarlaEngine::proccessPendingEvents() void CarlaEngine::proccessPendingEvents()


+ 0
- 40
source/backend/engine/carla_engine_osc.cpp View File

@@ -492,7 +492,6 @@ int CarlaEngineOsc::handleMsgMidi(CARLA_ENGINE_OSC_HANDLE_ARGS2)


if (plugin->midiInCount() > 0) if (plugin->midiInCount() > 0)
{ {
#if 0
const uint8_t* const data = argv[0]->m; const uint8_t* const data = argv[0]->m;
uint8_t status = data[1]; uint8_t status = data[1];
uint8_t channel = status & 0x0F; uint8_t channel = status & 0x0F;
@@ -512,7 +511,6 @@ int CarlaEngineOsc::handleMsgMidi(CARLA_ENGINE_OSC_HANDLE_ARGS2)
uint8_t velo = data[3]; uint8_t velo = data[3];
plugin->sendMidiSingleNote(channel, note, velo, false, true, true); plugin->sendMidiSingleNote(channel, note, velo, false, true, true);
} }
#endif


return 0; return 0;
} }
@@ -541,10 +539,8 @@ int CarlaEngineOsc::handleMsgSetActive(CARLA_ENGINE_OSC_HANDLE_ARGS2)
qDebug("CarlaEngineOsc::handleMsgSetActive()"); qDebug("CarlaEngineOsc::handleMsgSetActive()");
CARLA_ENGINE_OSC_CHECK_OSC_TYPES(1, "i"); CARLA_ENGINE_OSC_CHECK_OSC_TYPES(1, "i");


#if 0
const bool active = (bool)argv[0]->i; const bool active = (bool)argv[0]->i;
plugin->setActive(active, false, true); plugin->setActive(active, false, true);
#endif


return 0; return 0;
} }
@@ -554,10 +550,8 @@ int CarlaEngineOsc::handleMsgSetDryWet(CARLA_ENGINE_OSC_HANDLE_ARGS2)
qDebug("CarlaEngineOsc::handleMsgSetDryWet()"); qDebug("CarlaEngineOsc::handleMsgSetDryWet()");
CARLA_ENGINE_OSC_CHECK_OSC_TYPES(1, "f"); CARLA_ENGINE_OSC_CHECK_OSC_TYPES(1, "f");


#if 0
const float value = argv[0]->f; const float value = argv[0]->f;
plugin->setDryWet(value, false, true); plugin->setDryWet(value, false, true);
#endif


return 0; return 0;
} }
@@ -567,10 +561,8 @@ int CarlaEngineOsc::handleMsgSetVolume(CARLA_ENGINE_OSC_HANDLE_ARGS2)
qDebug("CarlaEngineOsc::handleMsgSetVolume()"); qDebug("CarlaEngineOsc::handleMsgSetVolume()");
CARLA_ENGINE_OSC_CHECK_OSC_TYPES(1, "f"); CARLA_ENGINE_OSC_CHECK_OSC_TYPES(1, "f");


#if 0
const float value = argv[0]->f; const float value = argv[0]->f;
plugin->setVolume(value, false, true); plugin->setVolume(value, false, true);
#endif


return 0; return 0;
} }
@@ -580,10 +572,8 @@ int CarlaEngineOsc::handleMsgSetBalanceLeft(CARLA_ENGINE_OSC_HANDLE_ARGS2)
qDebug("CarlaEngineOsc::handleMsgSetBalanceLeft()"); qDebug("CarlaEngineOsc::handleMsgSetBalanceLeft()");
CARLA_ENGINE_OSC_CHECK_OSC_TYPES(1, "f"); CARLA_ENGINE_OSC_CHECK_OSC_TYPES(1, "f");


#if 0
const float value = argv[0]->f; const float value = argv[0]->f;
plugin->setBalanceLeft(value, false, true); plugin->setBalanceLeft(value, false, true);
#endif


return 0; return 0;
} }
@@ -593,10 +583,8 @@ int CarlaEngineOsc::handleMsgSetBalanceRight(CARLA_ENGINE_OSC_HANDLE_ARGS2)
qDebug("CarlaEngineOsc::handleMsgSetBalanceRight()"); qDebug("CarlaEngineOsc::handleMsgSetBalanceRight()");
CARLA_ENGINE_OSC_CHECK_OSC_TYPES(1, "f"); CARLA_ENGINE_OSC_CHECK_OSC_TYPES(1, "f");


#if 0
const float value = argv[0]->f; const float value = argv[0]->f;
plugin->setBalanceRight(value, false, true); plugin->setBalanceRight(value, false, true);
#endif


return 0; return 0;
} }
@@ -606,11 +594,9 @@ int CarlaEngineOsc::handleMsgSetParameterValue(CARLA_ENGINE_OSC_HANDLE_ARGS2)
qDebug("CarlaEngineOsc::handleMsgSetParameterValue()"); qDebug("CarlaEngineOsc::handleMsgSetParameterValue()");
CARLA_ENGINE_OSC_CHECK_OSC_TYPES(2, "if"); CARLA_ENGINE_OSC_CHECK_OSC_TYPES(2, "if");


#if 0
const int32_t index = argv[0]->i; const int32_t index = argv[0]->i;
const float value = argv[1]->f; const float value = argv[1]->f;
plugin->setParameterValue(index, value, true, false, true); plugin->setParameterValue(index, value, true, false, true);
#endif


return 0; return 0;
} }
@@ -620,11 +606,9 @@ int CarlaEngineOsc::handleMsgSetParameterMidiCC(CARLA_ENGINE_OSC_HANDLE_ARGS2)
qDebug("CarlaEngineOsc::handleMsgSetParameterMidiCC()"); qDebug("CarlaEngineOsc::handleMsgSetParameterMidiCC()");
CARLA_ENGINE_OSC_CHECK_OSC_TYPES(2, "ii"); CARLA_ENGINE_OSC_CHECK_OSC_TYPES(2, "ii");


#if 0
const int32_t index = argv[0]->i; const int32_t index = argv[0]->i;
const int32_t cc = argv[1]->i; const int32_t cc = argv[1]->i;
plugin->setParameterMidiCC(index, cc, false, true); plugin->setParameterMidiCC(index, cc, false, true);
#endif


return 0; return 0;
} }
@@ -634,11 +618,9 @@ int CarlaEngineOsc::handleMsgSetParameterMidiChannel(CARLA_ENGINE_OSC_HANDLE_ARG
qDebug("CarlaEngineOsc::handleMsgSetParameterMidiChannel()"); qDebug("CarlaEngineOsc::handleMsgSetParameterMidiChannel()");
CARLA_ENGINE_OSC_CHECK_OSC_TYPES(2, "ii"); CARLA_ENGINE_OSC_CHECK_OSC_TYPES(2, "ii");


#if 0
const int32_t index = argv[0]->i; const int32_t index = argv[0]->i;
const int32_t channel = argv[1]->i; const int32_t channel = argv[1]->i;
plugin->setParameterMidiChannel(index, channel, false, true); plugin->setParameterMidiChannel(index, channel, false, true);
#endif


return 0; return 0;
} }
@@ -648,18 +630,9 @@ int CarlaEngineOsc::handleMsgSetProgram(CARLA_ENGINE_OSC_HANDLE_ARGS2)
qDebug("CarlaEngineOsc::handleMsgSetProgram()"); qDebug("CarlaEngineOsc::handleMsgSetProgram()");
CARLA_ENGINE_OSC_CHECK_OSC_TYPES(1, "i"); CARLA_ENGINE_OSC_CHECK_OSC_TYPES(1, "i");


#if 0
const int32_t index = argv[0]->i; const int32_t index = argv[0]->i;
plugin->setProgram(index, true, false, true, true); plugin->setProgram(index, true, false, true, true);


// parameters might have changed, send all param values back
if (m_controlData.target && index >= 0)
{
for (uint32_t i=0; i < plugin->parameterCount(); i++)
engine->osc_send_control_set_parameter_value(plugin->id(), i, plugin->getParameterValue(i));
}
#endif

return 0; return 0;
} }


@@ -668,18 +641,9 @@ int CarlaEngineOsc::handleMsgSetMidiProgram(CARLA_ENGINE_OSC_HANDLE_ARGS2)
qDebug("CarlaEngineOsc::handleMsgSetMidiProgram()"); qDebug("CarlaEngineOsc::handleMsgSetMidiProgram()");
CARLA_ENGINE_OSC_CHECK_OSC_TYPES(1, "i"); CARLA_ENGINE_OSC_CHECK_OSC_TYPES(1, "i");


#if 0
const int32_t index = argv[0]->i; const int32_t index = argv[0]->i;
plugin->setMidiProgram(index, true, false, true, true); plugin->setMidiProgram(index, true, false, true, true);


// parameters might have changed, send all param values back
if (m_controlData.target && index >= 0)
{
for (uint32_t i=0; i < plugin->parameterCount(); i++)
engine->osc_send_control_set_parameter_value(plugin->id(), i, plugin->getParameterValue(i));
}
#endif

return 0; return 0;
} }


@@ -688,12 +652,10 @@ int CarlaEngineOsc::handleMsgNoteOn(CARLA_ENGINE_OSC_HANDLE_ARGS2)
qDebug("CarlaEngineOsc::handleMsgNoteOn()"); qDebug("CarlaEngineOsc::handleMsgNoteOn()");
CARLA_ENGINE_OSC_CHECK_OSC_TYPES(3, "iii"); CARLA_ENGINE_OSC_CHECK_OSC_TYPES(3, "iii");


#if 0
const int32_t channel = argv[0]->i; const int32_t channel = argv[0]->i;
const int32_t note = argv[1]->i; const int32_t note = argv[1]->i;
const int32_t velo = argv[2]->i; const int32_t velo = argv[2]->i;
plugin->sendMidiSingleNote(channel, note, velo, true, false, true); plugin->sendMidiSingleNote(channel, note, velo, true, false, true);
#endif


return 0; return 0;
} }
@@ -703,11 +665,9 @@ int CarlaEngineOsc::handleMsgNoteOff(CARLA_ENGINE_OSC_HANDLE_ARGS2)
qDebug("CarlaEngineOsc::handleMsgNoteOff()"); qDebug("CarlaEngineOsc::handleMsgNoteOff()");
CARLA_ENGINE_OSC_CHECK_OSC_TYPES(2, "ii"); CARLA_ENGINE_OSC_CHECK_OSC_TYPES(2, "ii");


#if 0
const int32_t channel = argv[0]->i; const int32_t channel = argv[0]->i;
const int32_t note = argv[1]->i; const int32_t note = argv[1]->i;
plugin->sendMidiSingleNote(channel, note, 0, true, false, true); plugin->sendMidiSingleNote(channel, note, 0, true, false, true);
#endif


return 0; return 0;
} }


+ 2
- 2
source/backend/engine/plugin.cpp View File

@@ -394,7 +394,7 @@ protected:
return paramBuffers[index]; return paramBuffers[index];
} }


void d_setParameterValue(uint32_t index, float value)
void d_setParameterValue(uint32_t index, float value)
{ {
if (index >= paramCount) if (index >= paramCount)
return; return;
@@ -402,7 +402,7 @@ protected:
paramBuffers[index] = value; paramBuffers[index] = value;
} }


void d_setProgram(uint32_t index)
void d_setProgram(uint32_t index)
{ {
if (index >= programCount) if (index >= programCount)
return; return;


+ 9
- 9
source/backend/plugin/Makefile View File

@@ -30,16 +30,16 @@ endif


OBJS = \ OBJS = \
carla_plugin.cpp.o \ carla_plugin.cpp.o \
carla_plugin_thread.cpp.o \
native.cpp.o \ native.cpp.o \
ladspa.cpp.o

# carla_plugin_thread.cpp.o \
# carla_bridge.cpp.o \
# dssi.cpp.o \
# lv2.cpp.o \
# vst.cpp.o \
# fluidsynth.cpp.o \
# linuxsampler.cpp.o
ladspa.cpp.o \
dssi.cpp.o \
lv2.cpp.o \
vst.cpp.o \
fluidsynth.cpp.o \
linuxsampler.cpp.o

# carla_bridge.cpp.o


SHARED = ../libcarla_plugin.so SHARED = ../libcarla_plugin.so
STATIC = ../libcarla_plugin.a STATIC = ../libcarla_plugin.a


+ 46
- 46
source/backend/plugin/carla_plugin_thread.cpp View File

@@ -15,7 +15,7 @@
* For a full copy of the GNU General Public License see the COPYING file * For a full copy of the GNU General Public License see the COPYING file
*/ */


#include "carla_plugin.hpp"
#include "carla_plugin_internal.hpp"


#include <QtCore/QProcess> #include <QtCore/QProcess>


@@ -39,99 +39,99 @@ const char* PluginThreadMode2str(const CarlaPluginThread::PluginThreadMode mode)
return nullptr; return nullptr;
} }


CarlaPluginThread::CarlaPluginThread(CarlaBackend::CarlaEngine* const engine_, CarlaBackend::CarlaPlugin* const plugin_, const PluginThreadMode mode_, QObject* const parent)
CarlaPluginThread::CarlaPluginThread(CarlaBackend::CarlaEngine* const engine, CarlaBackend::CarlaPlugin* const plugin, const PluginThreadMode mode, QObject* const parent)
: QThread(parent), : QThread(parent),
engine(engine_),
plugin(plugin_),
mode(mode_)
kEngine(engine),
kPlugin(plugin),
kMode(mode)
{ {
qDebug("CarlaPluginThread::CarlaPluginThread(plugin:\"%s\", engine:\"%s\", %s)", plugin->name(), engine->getName(), PluginThreadMode2str(mode)); qDebug("CarlaPluginThread::CarlaPluginThread(plugin:\"%s\", engine:\"%s\", %s)", plugin->name(), engine->getName(), PluginThreadMode2str(mode));


m_process = nullptr;
fProcess = nullptr;
} }


CarlaPluginThread::~CarlaPluginThread() CarlaPluginThread::~CarlaPluginThread()
{ {
if (m_process)
delete m_process;
if (fProcess != nullptr)
delete fProcess;
} }


void CarlaPluginThread::setOscData(const char* const binary, const char* const label, const char* const data1) void CarlaPluginThread::setOscData(const char* const binary, const char* const label, const char* const data1)
{ {
m_binary = QString(binary);
m_label = QString(label);
m_data1 = QString(data1);
fBinary = binary;
fLabel = label;
fData1 = data1;
} }


void CarlaPluginThread::run() void CarlaPluginThread::run()
{ {
qDebug("CarlaPluginThread::run()"); qDebug("CarlaPluginThread::run()");


if (! m_process)
if (fProcess == nullptr)
{ {
m_process = new QProcess(nullptr);
m_process->setProcessChannelMode(QProcess::ForwardedChannels);
fProcess = new QProcess(nullptr);
fProcess->setProcessChannelMode(QProcess::ForwardedChannels);
#ifndef BUILD_BRIDGE #ifndef BUILD_BRIDGE
m_process->setProcessEnvironment(engine->getOptionsAsProcessEnvironment());
fProcess->setProcessEnvironment(kEngine->getOptionsAsProcessEnvironment());
#endif #endif
} }


QString name(plugin->name() ? plugin->name() : "(none)");
QString name(kPlugin->name() ? kPlugin->name() : "(none)");
QStringList arguments; QStringList arguments;


switch (mode)
switch (kMode)
{ {
case PLUGIN_THREAD_DSSI_GUI: case PLUGIN_THREAD_DSSI_GUI:
/* osc_url */ arguments << QString("%1/%2").arg(engine->getOscServerPathUDP()).arg(plugin->id());
/* filename */ arguments << plugin->filename();
/* label */ arguments << m_label;
/* ui-title */ arguments << QString("%1 (GUI)").arg(plugin->name());
/* osc_url */ arguments << QString("%1/%2").arg(kEngine->getOscServerPathUDP()).arg(kPlugin->id());
/* filename */ arguments << kPlugin->filename();
/* label */ arguments << (const char*)fLabel;
/* ui-title */ arguments << QString("%1 (GUI)").arg(kPlugin->name());
break; break;


case PLUGIN_THREAD_LV2_GUI: case PLUGIN_THREAD_LV2_GUI:
/* osc_url */ arguments << QString("%1/%2").arg(engine->getOscServerPathTCP()).arg(plugin->id());
/* URI */ arguments << m_label;
/* ui-URI */ arguments << m_data1;
/* ui-title */ arguments << QString("%1 (GUI)").arg(plugin->name());
/* osc_url */ arguments << QString("%1/%2").arg(kEngine->getOscServerPathTCP()).arg(kPlugin->id());
/* URI */ arguments << (const char*)fLabel;
/* ui-URI */ arguments << (const char*)fData1;
/* ui-title */ arguments << QString("%1 (GUI)").arg(kPlugin->name());
break; break;


case PLUGIN_THREAD_VST_GUI: case PLUGIN_THREAD_VST_GUI:
/* osc_url */ arguments << QString("%1/%2").arg(engine->getOscServerPathTCP()).arg(plugin->id());
/* filename */ arguments << plugin->filename();
/* ui-title */ arguments << QString("%1 (GUI)").arg(plugin->name());
/* osc_url */ arguments << QString("%1/%2").arg(kEngine->getOscServerPathTCP()).arg(kPlugin->id());
/* filename */ arguments << kPlugin->filename();
/* ui-title */ arguments << QString("%1 (GUI)").arg(kPlugin->name());
break; break;


case PLUGIN_THREAD_BRIDGE: case PLUGIN_THREAD_BRIDGE:
/* osc_url */ arguments << QString("%1/%2").arg(engine->getOscServerPathTCP()).arg(plugin->id());
/* stype */ arguments << m_data1;
/* filename */ arguments << plugin->filename();
/* osc_url */ arguments << QString("%1/%2").arg(kEngine->getOscServerPathTCP()).arg(kPlugin->id());
/* stype */ arguments << (const char*)fData1;
/* filename */ arguments << kPlugin->filename();
/* name */ arguments << name; /* name */ arguments << name;
/* label */ arguments << m_label;
/* label */ arguments << (const char*)fLabel;
break; break;
} }


m_process->start(m_binary, arguments);
m_process->waitForStarted();
fProcess->start((const char*)fBinary, arguments);
fProcess->waitForStarted();


switch (mode)
switch (kMode)
{ {
case PLUGIN_THREAD_DSSI_GUI: case PLUGIN_THREAD_DSSI_GUI:
case PLUGIN_THREAD_LV2_GUI: case PLUGIN_THREAD_LV2_GUI:
case PLUGIN_THREAD_VST_GUI: case PLUGIN_THREAD_VST_GUI:
if (plugin->waitForOscGuiShow())
if (kPlugin->waitForOscGuiShow())
{ {
m_process->waitForFinished(-1);
fProcess->waitForFinished(-1);


if (m_process->exitCode() == 0)
if (fProcess->exitCode() == 0)
{ {
// Hide // Hide
engine->callback(CarlaBackend::CALLBACK_SHOW_GUI, plugin->id(), 0, 0, 0.0, nullptr);
kEngine->callback(CarlaBackend::CALLBACK_SHOW_GUI, kPlugin->id(), 0, 0, 0.0, nullptr);
qWarning("CarlaPluginThread::run() - GUI closed"); qWarning("CarlaPluginThread::run() - GUI closed");
} }
else else
{ {
// Kill // Kill
engine->callback(CarlaBackend::CALLBACK_SHOW_GUI, plugin->id(), -1, 0, 0.0, nullptr);
kEngine->callback(CarlaBackend::CALLBACK_SHOW_GUI, kPlugin->id(), -1, 0, 0.0, nullptr);
qWarning("CarlaPluginThread::run() - GUI crashed"); qWarning("CarlaPluginThread::run() - GUI crashed");
break; break;
} }
@@ -139,22 +139,22 @@ void CarlaPluginThread::run()
else else
{ {
qDebug("CarlaPluginThread::run() - GUI timeout"); qDebug("CarlaPluginThread::run() - GUI timeout");
engine->callback(CarlaBackend::CALLBACK_SHOW_GUI, plugin->id(), 0, 0, 0.0, nullptr);
kEngine->callback(CarlaBackend::CALLBACK_SHOW_GUI, kPlugin->id(), 0, 0, 0.0, nullptr);
} }
break; break;


case PLUGIN_THREAD_BRIDGE: case PLUGIN_THREAD_BRIDGE:
m_process->waitForFinished(-1);
fProcess->waitForFinished(-1);


if (m_process->exitCode() != 0)
if (fProcess->exitCode() != 0)
{ {
qWarning("CarlaPluginThread::run() - bridge crashed"); qWarning("CarlaPluginThread::run() - bridge crashed");


QString errorString = QString("Plugin '%1' has crashed!\n" QString errorString = QString("Plugin '%1' has crashed!\n"
"Saving now will lose its current settings.\n" "Saving now will lose its current settings.\n"
"Please remove this plugin, and not rely on it from this point.").arg(plugin->name());
engine->setLastError(errorString.toUtf8().constData());
engine->callback(CarlaBackend::CALLBACK_ERROR, plugin->id(), 0, 0, 0.0, nullptr);
"Please remove this plugin, and not rely on it from this point.").arg(kPlugin->name());
kEngine->setLastError(errorString.toUtf8().constData());
kEngine->callback(CarlaBackend::CALLBACK_ERROR, kPlugin->id(), 0, 0, 0.0, nullptr);
} }


break; break;


+ 3
- 3
source/backend/plugin/dssi.cpp View File

@@ -15,7 +15,7 @@
* For a full copy of the GNU General Public License see the COPYING file * For a full copy of the GNU General Public License see the COPYING file
*/ */


#include "carla_plugin.hpp"
#include "carla_plugin_internal.hpp"


#ifdef WANT_DSSI #ifdef WANT_DSSI


@@ -1599,9 +1599,9 @@ CARLA_BACKEND_END_NAMESPACE


CARLA_BACKEND_START_NAMESPACE CARLA_BACKEND_START_NAMESPACE


CarlaPlugin* CarlaPlugin::newDSSI(const initializer& init, const void* const extra)
CarlaPlugin* CarlaPlugin::newDSSI(const Initializer& init, const char* const guiFilename)
{ {
qDebug("CarlaPlugin::newDSSI(%p, \"%s\", \"%s\", \"%s\", %p)", init.engine, init.filename, init.name, init.label, extra);
qDebug("CarlaPlugin::newDSSI(%p, \"%s\", \"%s\", \"%s\", \"%s\")", init.engine, init.filename, init.name, init.label, guiFilename);


#ifdef WANT_DSSI #ifdef WANT_DSSI
short id = init.engine->getNewPluginId(); short id = init.engine->getNewPluginId();


+ 2
- 2
source/backend/plugin/fluidsynth.cpp View File

@@ -19,7 +19,7 @@
# error Should not use fluidsynth for bridges! # error Should not use fluidsynth for bridges!
#endif #endif


#include "carla_plugin.hpp"
#include "carla_plugin_internal.hpp"


#ifdef WANT_FLUIDSYNTH #ifdef WANT_FLUIDSYNTH


@@ -1327,7 +1327,7 @@ CARLA_BACKEND_END_NAMESPACE


CARLA_BACKEND_START_NAMESPACE CARLA_BACKEND_START_NAMESPACE


CarlaPlugin* CarlaPlugin::newSF2(const initializer& init)
CarlaPlugin* CarlaPlugin::newSF2(const Initializer& init)
{ {
qDebug("CarlaPlugin::newSF2(%p, \"%s\", \"%s\", \"%s\")", init.engine, init.filename, init.name, init.label); qDebug("CarlaPlugin::newSF2(%p, \"%s\", \"%s\", \"%s\")", init.engine, init.filename, init.name, init.label);




+ 4
- 4
source/backend/plugin/linuxsampler.cpp View File

@@ -21,7 +21,7 @@
# error Should not use linuxsampler for bridges! # error Should not use linuxsampler for bridges!
#endif #endif


#include "carla_plugin.hpp"
#include "carla_plugin_internal.hpp"


#ifdef WANT_LINUXSAMPLER #ifdef WANT_LINUXSAMPLER


@@ -930,7 +930,7 @@ private:
const char* m_maker; const char* m_maker;
}; };


CarlaPlugin* LinuxSamplerPlugin::newLinuxSampler(const initializer& init, bool isGIG)
CarlaPlugin* LinuxSamplerPlugin::newLinuxSampler(const Initializer& init, bool isGIG)
{ {
qDebug("LinuxSamplerPlugin::newLinuxSampler(%p, \"%s\", \"%s\", \"%s\", %s)", init.engine, init.filename, init.name, init.label, bool2str(isGIG)); qDebug("LinuxSamplerPlugin::newLinuxSampler(%p, \"%s\", \"%s\", \"%s\", %s)", init.engine, init.filename, init.name, init.label, bool2str(isGIG));


@@ -966,7 +966,7 @@ CARLA_BACKEND_END_NAMESPACE


CARLA_BACKEND_START_NAMESPACE CARLA_BACKEND_START_NAMESPACE


CarlaPlugin* CarlaPlugin::newGIG(const initializer& init)
CarlaPlugin* CarlaPlugin::newGIG(const Initializer& init)
{ {
qDebug("CarlaPlugin::newGIG(%p, \"%s\", \"%s\", \"%s\")", init.engine, init.filename, init.name, init.label); qDebug("CarlaPlugin::newGIG(%p, \"%s\", \"%s\", \"%s\")", init.engine, init.filename, init.name, init.label);
#ifdef WANT_LINUXSAMPLER #ifdef WANT_LINUXSAMPLER
@@ -977,7 +977,7 @@ CarlaPlugin* CarlaPlugin::newGIG(const initializer& init)
#endif #endif
} }


CarlaPlugin* CarlaPlugin::newSFZ(const initializer& init)
CarlaPlugin* CarlaPlugin::newSFZ(const Initializer& init)
{ {
qDebug("CarlaPlugin::newSFZ(%p, \"%s\", \"%s\", \"%s\")", init.engine, init.filename, init.name, init.label); qDebug("CarlaPlugin::newSFZ(%p, \"%s\", \"%s\", \"%s\")", init.engine, init.filename, init.name, init.label);
#ifdef WANT_LINUXSAMPLER #ifdef WANT_LINUXSAMPLER


+ 2
- 2
source/backend/plugin/lv2.cpp View File

@@ -15,7 +15,7 @@
* For a full copy of the GNU General Public License see the COPYING file * For a full copy of the GNU General Public License see the COPYING file
*/ */


#include "carla_plugin.hpp"
#include "carla_plugin_internal.hpp"


#ifdef WANT_LV2 #ifdef WANT_LV2


@@ -4640,7 +4640,7 @@ CARLA_BACKEND_END_NAMESPACE


CARLA_BACKEND_START_NAMESPACE CARLA_BACKEND_START_NAMESPACE


CarlaPlugin* CarlaPlugin::newLV2(const initializer& init)
CarlaPlugin* CarlaPlugin::newLV2(const Initializer& init)
{ {
qDebug("CarlaPlugin::newLV2(%p, \"%s\", \"%s\", \"%s\")", init.engine, init.filename, init.name, init.label); qDebug("CarlaPlugin::newLV2(%p, \"%s\", \"%s\", \"%s\")", init.engine, init.filename, init.name, init.label);




+ 1
- 1
source/backend/plugin/native.cpp View File

@@ -15,7 +15,7 @@
* For a full copy of the GNU General Public License see the COPYING file * For a full copy of the GNU General Public License see the COPYING file
*/ */


#include "carla_plugin.hpp"
#include "carla_plugin_internal.hpp"
#include "carla_native.h" #include "carla_native.h"


CARLA_BACKEND_START_NAMESPACE CARLA_BACKEND_START_NAMESPACE


+ 2
- 2
source/backend/plugin/vst.cpp View File

@@ -15,7 +15,7 @@
* For a full copy of the GNU General Public License see the COPYING file * For a full copy of the GNU General Public License see the COPYING file
*/ */


#include "carla_plugin.hpp"
#include "carla_plugin_internal.hpp"


#ifdef WANT_VST #ifdef WANT_VST


@@ -2386,7 +2386,7 @@ CARLA_BACKEND_END_NAMESPACE


CARLA_BACKEND_START_NAMESPACE CARLA_BACKEND_START_NAMESPACE


CarlaPlugin* CarlaPlugin::newVST(const initializer& init)
CarlaPlugin* CarlaPlugin::newVST(const Initializer& init)
{ {
qDebug("CarlaPlugin::newVST(%p, \"%s\", \"%s\", \"%s\")", init.engine, init.filename, init.name, init.label); qDebug("CarlaPlugin::newVST(%p, \"%s\", \"%s\", \"%s\")", init.engine, init.filename, init.name, init.label);




+ 6
- 0
source/backend/standalone/carla_standalone.cpp View File

@@ -211,7 +211,9 @@ bool carla_engine_init(const char* driverName, const char* clientName)
standalone.engine->setOption(CarlaBackend::OPTION_FORCE_STEREO, standalone.options.forceStereo, nullptr); standalone.engine->setOption(CarlaBackend::OPTION_FORCE_STEREO, standalone.options.forceStereo, nullptr);
standalone.engine->setOption(CarlaBackend::OPTION_PREFER_PLUGIN_BRIDGES, standalone.options.preferPluginBridges, nullptr); standalone.engine->setOption(CarlaBackend::OPTION_PREFER_PLUGIN_BRIDGES, standalone.options.preferPluginBridges, nullptr);
standalone.engine->setOption(CarlaBackend::OPTION_PREFER_UI_BRIDGES, standalone.options.preferUiBridges, nullptr); standalone.engine->setOption(CarlaBackend::OPTION_PREFER_UI_BRIDGES, standalone.options.preferUiBridges, nullptr);
#ifdef WANT_DSSI
standalone.engine->setOption(CarlaBackend::OPTION_USE_DSSI_VST_CHUNKS, standalone.options.useDssiVstChunks, nullptr); standalone.engine->setOption(CarlaBackend::OPTION_USE_DSSI_VST_CHUNKS, standalone.options.useDssiVstChunks, nullptr);
#endif
standalone.engine->setOption(CarlaBackend::OPTION_MAX_PARAMETERS, standalone.options.maxParameters, nullptr); standalone.engine->setOption(CarlaBackend::OPTION_MAX_PARAMETERS, standalone.options.maxParameters, nullptr);
standalone.engine->setOption(CarlaBackend::OPTION_PREFERRED_BUFFER_SIZE, standalone.options.preferredBufferSize, nullptr); standalone.engine->setOption(CarlaBackend::OPTION_PREFERRED_BUFFER_SIZE, standalone.options.preferredBufferSize, nullptr);
standalone.engine->setOption(CarlaBackend::OPTION_PREFERRED_SAMPLE_RATE, standalone.options.preferredSampleRate, nullptr); standalone.engine->setOption(CarlaBackend::OPTION_PREFERRED_SAMPLE_RATE, standalone.options.preferredSampleRate, nullptr);
@@ -221,6 +223,7 @@ bool carla_engine_init(const char* driverName, const char* clientName)
standalone.engine->setOption(CarlaBackend::OPTION_PATH_BRIDGE_POSIX64, 0, standalone.options.bridge_posix64); standalone.engine->setOption(CarlaBackend::OPTION_PATH_BRIDGE_POSIX64, 0, standalone.options.bridge_posix64);
standalone.engine->setOption(CarlaBackend::OPTION_PATH_BRIDGE_WIN32, 0, standalone.options.bridge_win32); standalone.engine->setOption(CarlaBackend::OPTION_PATH_BRIDGE_WIN32, 0, standalone.options.bridge_win32);
standalone.engine->setOption(CarlaBackend::OPTION_PATH_BRIDGE_WIN64, 0, standalone.options.bridge_win64); standalone.engine->setOption(CarlaBackend::OPTION_PATH_BRIDGE_WIN64, 0, standalone.options.bridge_win64);
#ifdef WANT_LV2
standalone.engine->setOption(CarlaBackend::OPTION_PATH_BRIDGE_LV2_GTK2, 0, standalone.options.bridge_lv2gtk2); standalone.engine->setOption(CarlaBackend::OPTION_PATH_BRIDGE_LV2_GTK2, 0, standalone.options.bridge_lv2gtk2);
standalone.engine->setOption(CarlaBackend::OPTION_PATH_BRIDGE_LV2_GTK3, 0, standalone.options.bridge_lv2gtk3); standalone.engine->setOption(CarlaBackend::OPTION_PATH_BRIDGE_LV2_GTK3, 0, standalone.options.bridge_lv2gtk3);
standalone.engine->setOption(CarlaBackend::OPTION_PATH_BRIDGE_LV2_QT4, 0, standalone.options.bridge_lv2qt4); standalone.engine->setOption(CarlaBackend::OPTION_PATH_BRIDGE_LV2_QT4, 0, standalone.options.bridge_lv2qt4);
@@ -228,9 +231,12 @@ bool carla_engine_init(const char* driverName, const char* clientName)
standalone.engine->setOption(CarlaBackend::OPTION_PATH_BRIDGE_LV2_COCOA, 0, standalone.options.bridge_lv2cocoa); standalone.engine->setOption(CarlaBackend::OPTION_PATH_BRIDGE_LV2_COCOA, 0, standalone.options.bridge_lv2cocoa);
standalone.engine->setOption(CarlaBackend::OPTION_PATH_BRIDGE_LV2_WINDOWS, 0, standalone.options.bridge_lv2win); standalone.engine->setOption(CarlaBackend::OPTION_PATH_BRIDGE_LV2_WINDOWS, 0, standalone.options.bridge_lv2win);
standalone.engine->setOption(CarlaBackend::OPTION_PATH_BRIDGE_LV2_X11, 0, standalone.options.bridge_lv2qt4); standalone.engine->setOption(CarlaBackend::OPTION_PATH_BRIDGE_LV2_X11, 0, standalone.options.bridge_lv2qt4);
#endif
#ifdef WANT_VST
standalone.engine->setOption(CarlaBackend::OPTION_PATH_BRIDGE_VST_COCOA, 0, standalone.options.bridge_vstcocoa); standalone.engine->setOption(CarlaBackend::OPTION_PATH_BRIDGE_VST_COCOA, 0, standalone.options.bridge_vstcocoa);
standalone.engine->setOption(CarlaBackend::OPTION_PATH_BRIDGE_VST_HWND, 0, standalone.options.bridge_vsthwnd); standalone.engine->setOption(CarlaBackend::OPTION_PATH_BRIDGE_VST_HWND, 0, standalone.options.bridge_vsthwnd);
standalone.engine->setOption(CarlaBackend::OPTION_PATH_BRIDGE_VST_X11, 0, standalone.options.bridge_vstx11); standalone.engine->setOption(CarlaBackend::OPTION_PATH_BRIDGE_VST_X11, 0, standalone.options.bridge_vstx11);
#endif


if (standalone.procName.isNotEmpty()) if (standalone.procName.isNotEmpty())
standalone.engine->setOption(CarlaBackend::OPTION_PROCESS_NAME, 0, standalone.procName); standalone.engine->setOption(CarlaBackend::OPTION_PROCESS_NAME, 0, standalone.procName);


+ 188
- 161
source/carla.py View File

@@ -1,35 +1,38 @@
#!/usr/bin/env python3 #!/usr/bin/env python3
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-


# Carla Backend code
# Copyright (C) 2011-2012 Filipe Coelho <falktx@falktx.com>
# Carla plugin host
# Copyright (C) 2011-2013 Filipe Coelho <falktx@falktx.com>
# #
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# any later version.
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License as
# published by the Free Software Foundation; either version 2 of
# the License, or any later version.
# #
# This program is distributed in the hope that it will be useful, # This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of # but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details. # GNU General Public License for more details.
# #
# For a full copy of the GNU General Public License see the COPYING file
# For a full copy of the GNU General Public License see the GPL.txt file


# ------------------------------------------------------------------------------------------------------------
# Imports (Global) # Imports (Global)
from PyQt4.QtGui import QApplication, QMainWindow, QTableWidgetItem


from PyQt4.QtCore import QSize
from PyQt4.QtGui import QApplication, QListWidgetItem, QMainWindow

# ------------------------------------------------------------------------------------------------------------
# Imports (Custom Stuff) # Imports (Custom Stuff)
import ui_carla, ui_carla_database, ui_carla_refresh

import ui_carla
from carla_backend import * from carla_backend import *
from carla_shared import * # FIXME, remove later
#from shared_settings import * #from shared_settings import *


# set defaults
DEFAULT_PROJECT_FOLDER = HOME
#setDefaultProjectFolder(DEFAULT_PROJECT_FOLDER)
#setDefaultPluginsPaths(LADSPA_PATH, DSSI_PATH, LV2_PATH, VST_PATH, GIG_PATH, SF2_PATH, SFZ_PATH)

# ------------------------------------------------------------------------------------------------------------
# Main Window # Main Window

class CarlaMainW(QMainWindow): class CarlaMainW(QMainWindow):
def __init__(self, parent=None): def __init__(self, parent=None):
QMainWindow.__init__(self, parent) QMainWindow.__init__(self, parent)
@@ -59,8 +62,10 @@ class CarlaMainW(QMainWindow):
self.fEngineStarted = False self.fEngineStarted = False
self.fFirstEngineInit = False self.fFirstEngineInit = False


self.fPluginCount = 0
self.fPluginList = []

#self.m_project_filename = None #self.m_project_filename = None
#self.m_pluginCount = 0


#self._nsmAnnounce2str = "" #self._nsmAnnounce2str = ""
#self._nsmOpen1str = "" #self._nsmOpen1str = ""
@@ -68,10 +73,6 @@ class CarlaMainW(QMainWindow):
#self.nsm_server = None #self.nsm_server = None
#self.nsm_url = None #self.nsm_url = None


#self.m_plugin_list = []
#for x in range(MAX_DEFAULT_PLUGINS):
#self.m_plugin_list.append(None)

# ------------------------------------------------------------- # -------------------------------------------------------------
# Set-up GUI stuff # Set-up GUI stuff


@@ -108,27 +109,29 @@ class CarlaMainW(QMainWindow):
self.connect(self.ui.act_help_about_qt, SIGNAL("triggered()"), app, SLOT("aboutQt()")) self.connect(self.ui.act_help_about_qt, SIGNAL("triggered()"), app, SLOT("aboutQt()"))


#self.connect(self, SIGNAL("SIGUSR1()"), SLOT("slot_handleSIGUSR1()")) #self.connect(self, SIGNAL("SIGUSR1()"), SLOT("slot_handleSIGUSR1()"))
#self.connect(self, SIGNAL("DebugCallback(int, int, int, double, QString)"), SLOT("slot_handleDebugCallback(int, int, int, double, QString)"))
#self.connect(self, SIGNAL("ParameterValueCallback(int, int, double)"), SLOT("slot_handleParameterValueCallback(int, int, double)"))
#self.connect(self, SIGNAL("ParameterMidiChannelCallback(int, int, int)"), SLOT("slot_handleParameterMidiChannelCallback(int, int, int)"))
#self.connect(self, SIGNAL("ParameterMidiCcCallback(int, int, int)"), SLOT("slot_handleParameterMidiCcCallback(int, int, int)"))
#self.connect(self, SIGNAL("ProgramCallback(int, int)"), SLOT("slot_handleProgramCallback(int, int)"))
#self.connect(self, SIGNAL("MidiProgramCallback(int, int)"), SLOT("slot_handleMidiProgramCallback(int, int)"))
#self.connect(self, SIGNAL("NoteOnCallback(int, int, int, int)"), SLOT("slot_handleNoteOnCallback(int, int, int, int)"))
#self.connect(self, SIGNAL("NoteOffCallback(int, int, int)"), SLOT("slot_handleNoteOffCallback(int, int, int)"))
#self.connect(self, SIGNAL("ShowGuiCallback(int, int)"), SLOT("slot_handleShowGuiCallback(int, int)"))
#self.connect(self, SIGNAL("ResizeGuiCallback(int, int, int)"), SLOT("slot_handleResizeGuiCallback(int, int, int)"))
#self.connect(self, SIGNAL("UpdateCallback(int)"), SLOT("slot_handleUpdateCallback(int)"))
#self.connect(self, SIGNAL("ReloadInfoCallback(int)"), SLOT("slot_handleReloadInfoCallback(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("ReloadAllCallback(int)"), SLOT("slot_handleReloadAllCallback(int)"))
self.connect(self, SIGNAL("DebugCallback(int, int, int, double, QString)"), SLOT("slot_handleDebugCallback(int, int, int, double, QString)"))
self.connect(self, SIGNAL("PluginAddedCallback(int)"), SLOT("slot_handlePluginAddedCallback(int)"))
self.connect(self, SIGNAL("PluginRemovedCallback(int)"), SLOT("slot_handlePluginRemovedCallback(int)"))
self.connect(self, SIGNAL("ParameterValueChangedCallback(int, int, double)"), SLOT("slot_handleParameterValueChangedCallback(int, int, double)"))
self.connect(self, SIGNAL("ParameterDefaultChangedCallback(int, int, double)"), SLOT("slot_handleParameterDefaultChangedCallback(int, int, double)"))
self.connect(self, SIGNAL("ParameterMidiChannelChangedCallback(int, int, int)"), SLOT("slot_handleParameterMidiChannelChangedCallback(int, int, int)"))
self.connect(self, SIGNAL("ParameterMidiCcChangedCallback(int, int, int)"), SLOT("slot_handleParameterMidiCcChangedCallback(int, int, int)"))
self.connect(self, SIGNAL("ProgramChangedCallback(int, int)"), SLOT("slot_handleProgramChangedCallback(int, int)"))
self.connect(self, SIGNAL("MidiProgramChangedCallback(int, int)"), SLOT("slot_handleMidiProgramChangedCallback(int, int)"))
self.connect(self, SIGNAL("NoteOnCallback(int, int, int, int)"), SLOT("slot_handleNoteOnCallback(int, int, int, int)"))
self.connect(self, SIGNAL("NoteOffCallback(int, int, int)"), SLOT("slot_handleNoteOffCallback(int, int, int)"))
self.connect(self, SIGNAL("ShowGuiCallback(int, int)"), SLOT("slot_handleShowGuiCallback(int, int)"))
self.connect(self, SIGNAL("UpdateCallback(int)"), SLOT("slot_handleUpdateCallback(int)"))
self.connect(self, SIGNAL("ReloadInfoCallback(int)"), SLOT("slot_handleReloadInfoCallback(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("ReloadAllCallback(int)"), SLOT("slot_handleReloadAllCallback(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()"))
#self.connect(self, SIGNAL("NSM_SaveCallback()"), SLOT("slot_handleNSM_SaveCallback()")) #self.connect(self, SIGNAL("NSM_SaveCallback()"), SLOT("slot_handleNSM_SaveCallback()"))
#self.connect(self, SIGNAL("ErrorCallback(QString)"), SLOT("slot_handleErrorCallback(QString)"))
#self.connect(self, SIGNAL("QuitCallback()"), SLOT("slot_handleQuitCallback()"))
self.connect(self, SIGNAL("ErrorCallback(QString)"), SLOT("slot_handleErrorCallback(QString)"))
self.connect(self, SIGNAL("QuitCallback()"), SLOT("slot_handleQuitCallback()"))


#self.TIMER_GUI_STUFF = self.startTimer(self.m_savedSettings["Main/RefreshInterval"]) # Peaks #self.TIMER_GUI_STUFF = self.startTimer(self.m_savedSettings["Main/RefreshInterval"]) # Peaks
#self.TIMER_GUI_STUFF2 = self.startTimer(self.m_savedSettings["Main/RefreshInterval"] * 2) # LEDs and edit dialog #self.TIMER_GUI_STUFF2 = self.startTimer(self.m_savedSettings["Main/RefreshInterval"] * 2) # LEDs and edit dialog
@@ -203,47 +206,45 @@ class CarlaMainW(QMainWindow):
self.fEngineStarted = True self.fEngineStarted = True
self.fFirstEngineInit = False self.fFirstEngineInit = False


self.fPluginCount = 0
self.fPluginList = []

if Carla.processMode == PROCESS_MODE_CONTINUOUS_RACK:
maxCount = MAX_RACK_PLUGINS
elif Carla.processMode == PROCESS_MODE_PATCHBAY:
maxCount = MAX_PATCHBAY_PLUGINS
else:
maxCount = MAX_DEFAULT_PLUGINS

for x in range(maxCount):
self.fPluginList.append(None)

def stopEngine(self): def stopEngine(self):
#if self.m_pluginCount > 0:
#ask = QMessageBox.question(self, self.tr("Warning"), self.tr("There are still some plugins loaded, you need to remove them to stop the engine.\n"
#"Do you want to do this now?"),
#QMessageBox.Yes | QMessageBox.No, QMessageBox.No)
#if ask == QMessageBox.Yes:
#self.slot_remove_all()
#else:
#return
if self.fPluginCount > 0:
ask = QMessageBox.question(self, self.tr("Warning"), self.tr("There are still some plugins loaded, you need to remove them to stop the engine.\n"
"Do you want to do this now?"),
QMessageBox.Yes | QMessageBox.No, QMessageBox.No)
if ask != QMessageBox.Yes:
return
#self.slot_remove_all()


if Carla.host.is_engine_running() and not Carla.host.engine_close(): if Carla.host.is_engine_running() and not Carla.host.engine_close():
print(cString(Carla.host.get_last_error())) print(cString(Carla.host.get_last_error()))


self.fEngineStarted = False self.fEngineStarted = False
self.fPluginCount = 0
self.fPluginList = []


def addPlugin(self, btype, ptype, filename, name, label, extraStuff, activate):
def addPlugin(self, btype, ptype, filename, name, label, extraStuff):
if not self.fEngineStarted: if not self.fEngineStarted:
if activate:
QMessageBox.warning(self, self.tr("Warning"), self.tr("Cannot add new plugins while engine is stopped"))
return -1
QMessageBox.warning(self, self.tr("Warning"), self.tr("Cannot add new plugins while engine is stopped"))
return False


if not Carla.host.add_plugin(btype, ptype, filename, name, label, extraStuff): if not Carla.host.add_plugin(btype, ptype, filename, name, label, extraStuff):
CustomMessageBox(self, QMessageBox.Critical, self.tr("Error"), self.tr("Failed to load plugin"), cString(Carla.host.get_last_error()), QMessageBox.Ok, QMessageBox.Ok) CustomMessageBox(self, QMessageBox.Critical, self.tr("Error"), self.tr("Failed to load plugin"), cString(Carla.host.get_last_error()), QMessageBox.Ok, QMessageBox.Ok)
return False return False


else:
print("added plugin!!")
new_plugin_id = 0

pwidget = PluginWidget(self, new_plugin_id)
self.ui.w_plugins.layout().addWidget(pwidget)
#self.m_plugin_list[new_plugin_id] = pwidget
self.ui.act_plugin_remove_all.setEnabled(True)

pwidget.ui.peak_in.setRefreshRate(self.fSavedSettings["Main/RefreshInterval"])
pwidget.ui.peak_out.setRefreshRate(self.fSavedSettings["Main/RefreshInterval"])

if activate:
pwidget.setActive(True, True, True)

#self.m_pluginCount += 1
return True return True


#def pluginWidgetActivated(self, widget): #def pluginWidgetActivated(self, widget):
@@ -287,33 +288,58 @@ class CarlaMainW(QMainWindow):
self.ui.act_engine_start.setEnabled(not check) self.ui.act_engine_start.setEnabled(not check)
self.ui.act_engine_stop.setEnabled(check) self.ui.act_engine_stop.setEnabled(check)


#@pyqtSlot()
#def slot_handleSIGUSR1(self):
#print("Got SIGUSR1 -> Saving project now")
@pyqtSlot()
def slot_handleSIGUSR1(self):
print("Got SIGUSR1 -> Saving project now")
#QTimer.singleShot(0, self, SLOT("slot_file_save()")) #QTimer.singleShot(0, self, SLOT("slot_file_save()"))


#@pyqtSlot(int, int, int, float, str)
#def slot_handleDebugCallback(self, plugin_id, value1, value2, value3, valueStr):
#print("DEBUG :: %i, %i, %i, %f, \"%s\")" % (plugin_id, value1, value2, value3, valueStr))
@pyqtSlot(int, int, int, float, str)
def slot_handleDebugCallback(self, pluginId, value1, value2, value3, valueStr):
print("DEBUG :: %i, %i, %i, %f, \"%s\")" % (pluginId, value1, value2, value3, valueStr))


#@pyqtSlot(int, int, float)
#def slot_handleParameterValueCallback(self, pluginId, parameterId, value):
#pwidget = self.m_plugin_list[pluginId]
#if pwidget:
#pwidget.m_parameterIconTimer = ICON_STATE_ON
@pyqtSlot(int)
def slot_handlePluginAddedCallback(self, pluginId, pluginName="todo"):
pwidgetItem = QListWidgetItem(self.ui.listWidget)
pwidgetItem.setSizeHint(QSize(pwidgetItem.sizeHint().width(), 48))


#if parameterId == PARAMETER_ACTIVE:
#pwidget.set_active((value > 0.0), True, False)
#elif parameterId == PARAMETER_DRYWET:
#pwidget.set_drywet(value * 1000, True, False)
#elif parameterId == PARAMETER_VOLUME:
#pwidget.set_volume(value * 1000, True, False)
#elif parameterId == PARAMETER_BALANCE_LEFT:
#pwidget.set_balance_left(value * 1000, True, False)
#elif parameterId == PARAMETER_BALANCE_RIGHT:
#pwidget.set_balance_right(value * 1000, True, False)
#elif parameterId >= 0:
#pwidget.edit_dialog.set_parameter_to_update(parameterId)
pwidget = PluginWidget(self, pwidgetItem, pluginId)
pwidget.ui.peak_in.setRefreshRate(self.fSavedSettings["Main/RefreshInterval"])
pwidget.ui.peak_out.setRefreshRate(self.fSavedSettings["Main/RefreshInterval"])

self.ui.listWidget.setItemWidget(pwidgetItem, pwidget)

self.fPluginCount += 1
self.fPluginList[pluginId] = pwidget

if self.fPluginCount == 1:
self.ui.act_plugin_remove_all.setEnabled(True)

@pyqtSlot(int)
def slot_handlePluginRemovedCallback(self, pluginId):
pwidget = self.fPluginList[pluginId]
if pwidget is None:
return

self.fPluginList[pluginId] = None
self.fPluginCount -= 1

pwidget.ui.edit_dialog.close()
pwidget.close()
del pwidget

self.ui.listWidget.takeItem(pluginId)
#self.ui.listWidget.removeItemWidget(pwidget.getListWidgetItem())

if self.fPluginCount == 0:
self.ui.act_plugin_remove_all.setEnabled(False)

@pyqtSlot(int, int, float)
def slot_handleParameterValueChangedCallback(self, pluginId, parameterId, value):
pwidget = self.fPluginList[pluginId]
if pwidget is None:
return

pwidget.setParameterValue(value, True, False)


#@pyqtSlot(int, int, int) #@pyqtSlot(int, int, int)
#def slot_handleParameterMidiChannelCallback(self, pluginId, parameterId, channel): #def slot_handleParameterMidiChannelCallback(self, pluginId, parameterId, channel):
@@ -367,14 +393,6 @@ class CarlaMainW(QMainWindow):
#pwidget.b_gui.setChecked(False) #pwidget.b_gui.setChecked(False)
#pwidget.b_gui.setEnabled(False) #pwidget.b_gui.setEnabled(False)


#@pyqtSlot(int, int, int)
#def slot_handleResizeGuiCallback(self, plugin_id, width, height):
#pwidget = self.m_plugin_list[plugin_id]
#if pwidget:
#gui_dialog = pwidget.gui_dialog
#if gui_dialog:
#gui_dialog.setNewSize(width, height)

#@pyqtSlot(int) #@pyqtSlot(int)
#def slot_handleUpdateCallback(self, plugin_id): #def slot_handleUpdateCallback(self, plugin_id):
#pwidget = self.m_plugin_list[plugin_id] #pwidget = self.m_plugin_list[plugin_id]
@@ -446,15 +464,15 @@ class CarlaMainW(QMainWindow):
#self.save_project() #self.save_project()
#Carla.host.nsm_reply_save() #Carla.host.nsm_reply_save()


#@pyqtSlot(str)
#def slot_handleErrorCallback(self, error):
#QMessageBox.critical(self, self.tr("Error"), error)
@pyqtSlot(str)
def slot_handleErrorCallback(self, error):
QMessageBox.critical(self, self.tr("Error"), error)


#@pyqtSlot()
#def slot_handleQuitCallback(self):
#CustomMessageBox(self, QMessageBox.Warning, self.tr("Warning"),
#self.tr("JACK has been stopped or crashed.\nPlease start JACK and restart Carla"),
#self.tr("You may want to save your session now..."), QMessageBox.Ok, QMessageBox.Ok)
@pyqtSlot()
def slot_handleQuitCallback(self):
CustomMessageBox(self, QMessageBox.Warning, self.tr("Warning"),
self.tr("Engine has been stopped or crashed.\nPlease restart Carla"),
self.tr("You may want to save your session now..."), QMessageBox.Ok, QMessageBox.Ok)


#def remove_plugin(self, plugin_id, showError): #def remove_plugin(self, plugin_id, showError):
#pwidget = self.m_plugin_list[plugin_id] #pwidget = self.m_plugin_list[plugin_id]
@@ -500,23 +518,6 @@ class CarlaMainW(QMainWindow):
#else: #else:
#self.act_plugin_remove_all.setEnabled(False) #self.act_plugin_remove_all.setEnabled(False)


#def get_extra_stuff(self, plugin):
#ptype = plugin['type']

#if ptype == PLUGIN_LADSPA:
#unique_id = plugin['unique_id']
#for rdf_item in self.ladspa_rdf_list:
#if rdf_item.UniqueID == unique_id:
#return pointer(rdf_item)

#elif ptype == PLUGIN_DSSI:
#if plugin['hints'] & PLUGIN_HAS_GUI:
#gui = findDSSIGUI(plugin['binary'], plugin['name'], plugin['label'])
#if gui:
#return gui.encode("utf-8")

#return c_nullptr

#def save_project(self): #def save_project(self):
#content = ("<?xml version='1.0' encoding='UTF-8'?>\n" #content = ("<?xml version='1.0' encoding='UTF-8'?>\n"
#"<!DOCTYPE CARLA-PROJECT>\n" #"<!DOCTYPE CARLA-PROJECT>\n"
@@ -825,8 +826,8 @@ class CarlaMainW(QMainWindow):
ptype = dialog.fRetPlugin['type'] ptype = dialog.fRetPlugin['type']
filename = dialog.fRetPlugin['binary'] filename = dialog.fRetPlugin['binary']
label = dialog.fRetPlugin['label'] label = dialog.fRetPlugin['label']
extraStuff = None #self.get_extra_stuff(dialog.ret_plugin)
self.addPlugin(btype, ptype, filename, None, label, extraStuff, True)
extraStuff = self.getExtraStuff(dialog.fRetPlugin)
self.addPlugin(btype, ptype, filename, None, label, extraStuff)


#@pyqtSlot() #@pyqtSlot()
#def slot_remove_all(self): #def slot_remove_all(self):
@@ -870,6 +871,23 @@ class CarlaMainW(QMainWindow):
#pwidget.peak_in.setRefreshRate(self.m_savedSettings["Main/RefreshInterval"]) #pwidget.peak_in.setRefreshRate(self.m_savedSettings["Main/RefreshInterval"])
#pwidget.peak_out.setRefreshRate(self.m_savedSettings["Main/RefreshInterval"]) #pwidget.peak_out.setRefreshRate(self.m_savedSettings["Main/RefreshInterval"])


def getExtraStuff(self, plugin):
ptype = plugin['type']

if ptype == PLUGIN_LADSPA:
uniqueId = plugin['uniqueId']
for rdfItem in self.fLadspaRdfList:
if rdfItem.UniqueID == uniqueId:
return pointer(rdfItem)

elif ptype == PLUGIN_DSSI:
if plugin['hints'] & PLUGIN_HAS_GUI:
gui = findDSSIGUI(plugin['binary'], plugin['name'], plugin['label'])
if gui:
return gui.encode("utf-8")

return c_nullptr

def loadRDFs(self): def loadRDFs(self):
# Save RDF info for later # Save RDF info for later
self.fLadspaRdfList = [] self.fLadspaRdfList = []
@@ -904,7 +922,7 @@ class CarlaMainW(QMainWindow):
self.ui.toolBar.setVisible(showToolbar) self.ui.toolBar.setVisible(showToolbar)


self.fSavedSettings = { self.fSavedSettings = {
"Main/DefaultProjectFolder": settings.value("Main/DefaultProjectFolder", DEFAULT_PROJECT_FOLDER, type=str),
"Main/DefaultProjectFolder": settings.value("Main/DefaultProjectFolder", HOME, type=str),
"Main/RefreshInterval": settings.value("Main/RefreshInterval", 120, type=int) "Main/RefreshInterval": settings.value("Main/RefreshInterval", 120, type=int)
} }


@@ -937,7 +955,7 @@ class CarlaMainW(QMainWindow):
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 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:
#if pwidget: pwidget.check_gui_stuff() #if pwidget: pwidget.check_gui_stuff()
@@ -948,7 +966,7 @@ class CarlaMainW(QMainWindow):
#for pwidget in self.m_plugin_list: #for pwidget in self.m_plugin_list:
#if pwidget: pwidget.check_gui_stuff2() #if pwidget: pwidget.check_gui_stuff2()


#QMainWindow.timerEvent(self, event)
QMainWindow.timerEvent(self, event)


def closeEvent(self, event): def closeEvent(self, event):
#if self.nsm_server: #if self.nsm_server:
@@ -963,53 +981,62 @@ class CarlaMainW(QMainWindow):


# ------------------------------------------------------------------------------------------------ # ------------------------------------------------------------------------------------------------


def callback_function(ptr, action, pluginId, value1, value2, value3, valueStr):
def callbackFunction(ptr, action, pluginId, value1, value2, value3, valueStr):
if pluginId < 0 or not Carla.gui: if pluginId < 0 or not Carla.gui:
return return


#if action == CALLBACK_DEBUG:
#Carla.gui.emit(SIGNAL("DebugCallback(int, int, int, double, QString)"), pluginId, value1, value2, value3, cString(valueStr))
#elif action == CALLBACK_PARAMETER_VALUE_CHANGED:
#Carla.gui.emit(SIGNAL("ParameterValueCallback(int, int, double)"), pluginId, value1, value3)
#elif action == CALLBACK_PARAMETER_MIDI_CHANNEL_CHANGED:
#Carla.gui.emit(SIGNAL("ParameterMidiChannelCallback(int, int, int)"), pluginId, value1, value2)
#elif action == CALLBACK_PARAMETER_MIDI_CC_CHANGED:
#Carla.gui.emit(SIGNAL("ParameterMidiCcCallback(int, int, int)"), pluginId, value1, value2)
#elif action == CALLBACK_PROGRAM_CHANGED:
#Carla.gui.emit(SIGNAL("ProgramCallback(int, int)"), pluginId, value1)
#elif action == CALLBACK_MIDI_PROGRAM_CHANGED:
#Carla.gui.emit(SIGNAL("MidiProgramCallback(int, int)"), pluginId, value1)
#elif action == CALLBACK_NOTE_ON:
#Carla.gui.emit(SIGNAL("NoteOnCallback(int, int, int, int)"), pluginId, value1, value2, value3)
#elif action == CALLBACK_NOTE_OFF:
#Carla.gui.emit(SIGNAL("NoteOffCallback(int, int, int)"), pluginId, value1, value2)
#elif action == CALLBACK_SHOW_GUI:
#Carla.gui.emit(SIGNAL("ShowGuiCallback(int, int)"), pluginId, value1)
#elif action == CALLBACK_UPDATE:
#Carla.gui.emit(SIGNAL("UpdateCallback(int)"), pluginId)
#elif action == CALLBACK_RELOAD_INFO:
#Carla.gui.emit(SIGNAL("ReloadInfoCallback(int)"), pluginId)
#elif action == CALLBACK_RELOAD_PARAMETERS:
#Carla.gui.emit(SIGNAL("ReloadParametersCallback(int)"), pluginId)
#elif action == CALLBACK_RELOAD_PROGRAMS:
#Carla.gui.emit(SIGNAL("ReloadProgramsCallback(int)"), pluginId)
#elif action == CALLBACK_RELOAD_ALL:
#Carla.gui.emit(SIGNAL("ReloadAllCallback(int)"), pluginId)
if action == CALLBACK_DEBUG:
return Carla.gui.emit(SIGNAL("DebugCallback(int, int, int, double, QString)"), pluginId, value1, value2, value3, cString(valueStr))
elif action == CALLBACK_PLUGIN_ADDED:
return Carla.gui.emit(SIGNAL("PluginAddedCallback(int)"), pluginId)
elif action == CALLBACK_PLUGIN_REMOVED:
return Carla.gui.emit(SIGNAL("PluginRemovedCallback(int)"), pluginId)
elif action == CALLBACK_PARAMETER_VALUE_CHANGED:
return Carla.gui.emit(SIGNAL("ParameterValueChangedCallback(int, int, double)"), pluginId, value1, value3)
elif action == CALLBACK_PARAMETER_DEFAULT_CHANGED:
return Carla.gui.emit(SIGNAL("ParameterDefaultChangedCallback(int, int, double)"), pluginId, value1, value3)
elif action == CALLBACK_PARAMETER_MIDI_CHANNEL_CHANGED:
return Carla.gui.emit(SIGNAL("ParameterMidiChannelChangedCallback(int, int, int)"), pluginId, value1, value2)
elif action == CALLBACK_PARAMETER_MIDI_CC_CHANGED:
return Carla.gui.emit(SIGNAL("ParameterMidiCcChangedCallback(int, int, int)"), pluginId, value1, value2)
elif action == CALLBACK_PROGRAM_CHANGED:
return Carla.gui.emit(SIGNAL("ProgramChangedCallback(int, int)"), pluginId, value1)
elif action == CALLBACK_MIDI_PROGRAM_CHANGED:
return Carla.gui.emit(SIGNAL("MidiProgramChangedCallback(int, int)"), pluginId, value1)
elif action == CALLBACK_NOTE_ON:
return Carla.gui.emit(SIGNAL("NoteOnCallback(int, int, int, int)"), pluginId, value1, value2, value3)
elif action == CALLBACK_NOTE_OFF:
return Carla.gui.emit(SIGNAL("NoteOffCallback(int, int, int)"), pluginId, value1, value2)
elif action == CALLBACK_SHOW_GUI:
return Carla.gui.emit(SIGNAL("ShowGuiCallback(int, int)"), pluginId, value1)
elif action == CALLBACK_UPDATE:
return Carla.gui.emit(SIGNAL("UpdateCallback(int)"), pluginId)
elif action == CALLBACK_RELOAD_INFO:
return Carla.gui.emit(SIGNAL("ReloadInfoCallback(int)"), pluginId)
elif action == CALLBACK_RELOAD_PARAMETERS:
return Carla.gui.emit(SIGNAL("ReloadParametersCallback(int)"), pluginId)
elif action == CALLBACK_RELOAD_PROGRAMS:
return Carla.gui.emit(SIGNAL("ReloadProgramsCallback(int)"), pluginId)
elif action == CALLBACK_RELOAD_ALL:
return Carla.gui.emit(SIGNAL("ReloadAllCallback(int)"), pluginId)
#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()"))
#return
#elif action == CALLBACK_NSM_OPEN1: #elif action == CALLBACK_NSM_OPEN1:
#Carla.gui._nsmOpen1str = cString(valueStr) #Carla.gui._nsmOpen1str = cString(valueStr)
#Carla.gui.emit(SIGNAL("NSM_Open1Callback()")) #Carla.gui.emit(SIGNAL("NSM_Open1Callback()"))
#return
#elif action == CALLBACK_NSM_OPEN2: #elif action == CALLBACK_NSM_OPEN2:
#Carla.gui._nsmOpen2str = cString(valueStr) #Carla.gui._nsmOpen2str = cString(valueStr)
#Carla.gui.emit(SIGNAL("NSM_Open2Callback()")) #Carla.gui.emit(SIGNAL("NSM_Open2Callback()"))
#return
#elif action == CALLBACK_NSM_SAVE: #elif action == CALLBACK_NSM_SAVE:
#Carla.gui.emit(SIGNAL("NSM_SaveCallback()"))
#elif action == CALLBACK_ERROR:
#Carla.gui.emit(SIGNAL("ErrorCallback(QString)"), cString(Carla.host.get_last_error()))
#elif action == CALLBACK_QUIT:
#Carla.gui.emit(SIGNAL("QuitCallback()"))
#return Carla.gui.emit(SIGNAL("NSM_SaveCallback()"))
elif action == CALLBACK_ERROR:
return Carla.gui.emit(SIGNAL("ErrorCallback(QString)"), valueStr)
elif action == CALLBACK_QUIT:
return Carla.gui.emit(SIGNAL("QuitCallback()"))


#--------------- main ------------------ #--------------- main ------------------
if __name__ == '__main__': if __name__ == '__main__':
@@ -1035,7 +1062,7 @@ if __name__ == '__main__':


# Init backend # Init backend
Carla.host = Host(libPrefix) Carla.host = Host(libPrefix)
Carla.host.set_callback_function(callback_function)
Carla.host.set_callback_function(callbackFunction)
Carla.host.set_option(OPTION_PROCESS_NAME, 0, "carla") Carla.host.set_option(OPTION_PROCESS_NAME, 0, "carla")


# Set bridge paths # Set bridge paths


+ 137
- 141
source/carla_shared.py View File

@@ -191,11 +191,10 @@ PARAMETER_USES_SAMPLERATE = 0x20
PARAMETER_USES_SCALEPOINTS = 0x40 PARAMETER_USES_SCALEPOINTS = 0x40
PARAMETER_USES_CUSTOM_TEXT = 0x80 PARAMETER_USES_CUSTOM_TEXT = 0x80


# FIXME
# Custom Data types # Custom Data types
#CUSTOM_DATA_INVALID = None
#CUSTOM_DATA_CHUNK = "http://kxstudio.sf.net/ns/carla/chunk"
#CUSTOM_DATA_STRING = "http://kxstudio.sf.net/ns/carla/string"
CUSTOM_DATA_INVALID = None
CUSTOM_DATA_CHUNK = "http://kxstudio.sf.net/ns/carla/chunk"
CUSTOM_DATA_STRING = "http://kxstudio.sf.net/ns/carla/string"


# Binary Type # Binary Type
BINARY_NONE = 0 BINARY_NONE = 0
@@ -274,26 +273,29 @@ OPTION_PATH_BRIDGE_VST_HWND = 23
OPTION_PATH_BRIDGE_VST_X11 = 24 OPTION_PATH_BRIDGE_VST_X11 = 24


# Callback Type # Callback Type
CALLBACK_DEBUG = 0
CALLBACK_PARAMETER_VALUE_CHANGED = 1
CALLBACK_PARAMETER_MIDI_CHANNEL_CHANGED = 2
CALLBACK_PARAMETER_MIDI_CC_CHANGED = 3
CALLBACK_PROGRAM_CHANGED = 4
CALLBACK_MIDI_PROGRAM_CHANGED = 5
CALLBACK_NOTE_ON = 6
CALLBACK_NOTE_OFF = 7
CALLBACK_SHOW_GUI = 8
CALLBACK_UPDATE = 9
CALLBACK_RELOAD_INFO = 10
CALLBACK_RELOAD_PARAMETERS = 11
CALLBACK_RELOAD_PROGRAMS = 12
CALLBACK_RELOAD_ALL = 13
CALLBACK_NSM_ANNOUNCE = 14
CALLBACK_NSM_OPEN1 = 15
CALLBACK_NSM_OPEN2 = 16
CALLBACK_NSM_SAVE = 17
CALLBACK_ERROR = 18
CALLBACK_QUIT = 19
CALLBACK_DEBUG = 0
CALLBACK_PLUGIN_ADDED = 1
CALLBACK_PLUGIN_REMOVED = 2
CALLBACK_PARAMETER_VALUE_CHANGED = 3
CALLBACK_PARAMETER_DEFAULT_CHANGED = 4
CALLBACK_PARAMETER_MIDI_CHANNEL_CHANGED = 5
CALLBACK_PARAMETER_MIDI_CC_CHANGED = 6
CALLBACK_PROGRAM_CHANGED = 7
CALLBACK_MIDI_PROGRAM_CHANGED = 8
CALLBACK_NOTE_ON = 9
CALLBACK_NOTE_OFF = 10
CALLBACK_SHOW_GUI = 11
CALLBACK_UPDATE = 12
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


# Process Mode Type # Process Mode Type
PROCESS_MODE_SINGLE_CLIENT = 0 PROCESS_MODE_SINGLE_CLIENT = 0
@@ -317,6 +319,7 @@ class CarlaHostObject(object):
'host', 'host',
'gui', 'gui',
'isControl', 'isControl',
'isLocal',
'processMode', 'processMode',
'maxParameters' 'maxParameters'
] ]
@@ -325,6 +328,7 @@ Carla = CarlaHostObject()
Carla.host = None Carla.host = None
Carla.gui = None Carla.gui = None
Carla.isControl = False Carla.isControl = False
Carla.isLocal = True
Carla.processMode = PROCESS_MODE_CONTINUOUS_RACK Carla.processMode = PROCESS_MODE_CONTINUOUS_RACK
Carla.maxParameters = MAX_RACK_PLUGINS Carla.maxParameters = MAX_RACK_PLUGINS


@@ -1394,29 +1398,52 @@ class PluginEdit(QDialog):


self.fParameterCount = 0 self.fParameterCount = 0
self.fParameterList = [] # (type, id, widget) self.fParameterList = [] # (type, id, widget)
self.fParameterIdsToUpdate = [] # id
self.fParameterToUpdate = [] # (id, value)


self.fTabIconOff = QIcon(":/bitmaps/led_off.png") self.fTabIconOff = QIcon(":/bitmaps/led_off.png")
self.fTabIconOn = QIcon(":/bitmaps/led_yellow.png") self.fTabIconOn = QIcon(":/bitmaps/led_yellow.png")
self.fTabIconCount = 0 self.fTabIconCount = 0
self.fTabIconTimers = [] self.fTabIconTimers = []


self.ui.dial_drywet.setPixmap(3)
self.ui.dial_drywet.setLabel("Dry/Wet")
self.ui.dial_vol.setPixmap(3)
self.ui.dial_vol.setLabel("Volume")
self.ui.dial_b_left.setPixmap(4)
self.ui.dial_b_left.setLabel("L")
self.ui.dial_b_right.setPixmap(4)
self.ui.dial_b_right.setLabel("R")

self.ui.dial_drywet.setCustomPaint(self.ui.dial_drywet.CUSTOM_PAINT_CARLA_WET)
self.ui.dial_vol.setCustomPaint(self.ui.dial_vol.CUSTOM_PAINT_CARLA_VOL)
self.ui.dial_b_left.setCustomPaint(self.ui.dial_b_left.CUSTOM_PAINT_CARLA_L)
self.ui.dial_b_right.setCustomPaint(self.ui.dial_b_right.CUSTOM_PAINT_CARLA_R)

self.ui.keyboard.setMode(self.ui.keyboard.HORIZONTAL) self.ui.keyboard.setMode(self.ui.keyboard.HORIZONTAL)
self.ui.keyboard.setOctaves(6) self.ui.keyboard.setOctaves(6)
self.ui.scrollArea.ensureVisible(self.ui.keyboard.width() * 1 / 5, 0)
self.ui.scrollArea.ensureVisible(self.ui.keyboard.width() / 5, 0)
self.ui.scrollArea.setVisible(False) self.ui.scrollArea.setVisible(False)


# TODO - not implemented yet # TODO - not implemented yet
self.ui.b_reload_program.setEnabled(False) self.ui.b_reload_program.setEnabled(False)
self.ui.b_reload_midi_program.setEnabled(False) self.ui.b_reload_midi_program.setEnabled(False)


# Not available for carla-control
if Carla.isControl:
self.ui.b_load_state.setEnabled(False)
self.ui.b_save_state.setEnabled(False)
else:
if Carla.isLocal:
self.connect(self.ui.b_save_state, SIGNAL("clicked()"), SLOT("slot_saveState()")) self.connect(self.ui.b_save_state, SIGNAL("clicked()"), SLOT("slot_saveState()"))
self.connect(self.ui.b_load_state, SIGNAL("clicked()"), SLOT("slot_loadState()")) self.connect(self.ui.b_load_state, SIGNAL("clicked()"), SLOT("slot_loadState()"))
else:
self.ui.b_load_state.setEnabled(False)
self.ui.b_save_state.setEnabled(False)

self.connect(self.ui.dial_drywet, SIGNAL("sliderMoved(int)"), SLOT("slot_dryWetChanged(int)"))
self.connect(self.ui.dial_vol, SIGNAL("sliderMoved(int)"), SLOT("slot_volumeChanged(int)"))
self.connect(self.ui.dial_b_left, SIGNAL("sliderMoved(int)"), SLOT("slot_balanceLeftChanged(int)"))
self.connect(self.ui.dial_b_right, SIGNAL("sliderMoved(int)"), SLOT("slot_balanceRightChanged(int)"))

#self.connect(self.ui.dial_drywet, SIGNAL("customContextMenuRequested(QPoint)"), SLOT("slot_showCustomDialMenu()"))
#self.connect(self.ui.dial_vol, SIGNAL("customContextMenuRequested(QPoint)"), SLOT("slot_showCustomDialMenu()"))
#self.connect(self.ui.dial_b_left, SIGNAL("customContextMenuRequested(QPoint)"), SLOT("slot_showCustomDialMenu()"))
#self.connect(self.ui.dial_b_right, SIGNAL("customContextMenuRequested(QPoint)"), SLOT("slot_showCustomDialMenu()"))


self.connect(self.ui.keyboard, SIGNAL("noteOn(int)"), SLOT("slot_noteOn(int)")) self.connect(self.ui.keyboard, SIGNAL("noteOn(int)"), SLOT("slot_noteOn(int)"))
self.connect(self.ui.keyboard, SIGNAL("noteOff(int)"), SLOT("slot_noteOff(int)")) self.connect(self.ui.keyboard, SIGNAL("noteOff(int)"), SLOT("slot_noteOff(int)"))
@@ -1427,6 +1454,7 @@ class PluginEdit(QDialog):
self.connect(self, SIGNAL("finished(int)"), SLOT("slot_finished()")) self.connect(self, SIGNAL("finished(int)"), SLOT("slot_finished()"))


self.reloadAll() self.reloadAll()
self.resize(self.width(), self.height()-self.ui.keyboard.height())


def reloadAll(self): def reloadAll(self):
self.fPluginInfo = Carla.host.get_plugin_info(self.fPluginId) self.fPluginInfo = Carla.host.get_plugin_info(self.fPluginId)
@@ -1490,10 +1518,11 @@ class PluginEdit(QDialog):
self.ui.le_ains.setText(str(audioCountInfo['ins'])) self.ui.le_ains.setText(str(audioCountInfo['ins']))
self.ui.le_aouts.setText(str(audioCountInfo['outs'])) self.ui.le_aouts.setText(str(audioCountInfo['outs']))
self.ui.le_params.setText(str(paramCountInfo['ins'])) self.ui.le_params.setText(str(paramCountInfo['ins']))
self.ui.le_couts.setText(str(paramCountInfo['outs']))


self.ui.le_is_synth.setText(self.tr("Yes") if (pluginHints & PLUGIN_IS_SYNTH) else self.tr("No"))
self.ui.le_has_gui.setText(self.tr("Yes") if (pluginHints & PLUGIN_HAS_GUI) else self.tr("No"))
self.ui.dial_drywet.setEnabled(pluginHints & PLUGIN_CAN_DRYWET)
self.ui.dial_vol.setEnabled(pluginHints & PLUGIN_CAN_VOLUME)
self.ui.dial_b_left.setEnabled(pluginHints & PLUGIN_CAN_BALANCE)
self.ui.dial_b_right.setEnabled(pluginHints & PLUGIN_CAN_BALANCE)


# Show/hide keyboard # Show/hide keyboard
self.ui.scrollArea.setVisible((pluginHints & PLUGIN_IS_SYNTH) != 0 or (midiCountInfo['ins'] > 0 < midiCountInfo['outs'])) self.ui.scrollArea.setVisible((pluginHints & PLUGIN_IS_SYNTH) != 0 or (midiCountInfo['ins'] > 0 < midiCountInfo['outs']))
@@ -1508,7 +1537,7 @@ class PluginEdit(QDialog):
# Reset # Reset
self.fParameterCount = 0 self.fParameterCount = 0
self.fParameterList = [] self.fParameterList = []
self.fParameterIdsToUpdate = []
self.fParameterToUpdate = []


self.fTabIconCount = 0 self.fTabIconCount = 0
self.fTabIconTimers = [] self.fTabIconTimers = []
@@ -1561,11 +1590,10 @@ class PluginEdit(QDialog):
for j in range(paramInfo['scalePointCount']): for j in range(paramInfo['scalePointCount']):
scalePointInfo = Carla.host.get_parameter_scalepoint_info(self.fPluginId, i, j) scalePointInfo = Carla.host.get_parameter_scalepoint_info(self.fPluginId, i, j)


parameter['scalepoints'].append(
{
'value': scalePointInfo['value'],
'label': cString(scalePointInfo['label'])
})
parameter['scalePoints'].append({
'value': scalePointInfo['value'],
'label': cString(scalePointInfo['label'])
})


paramInputList.append(parameter) paramInputList.append(parameter)


@@ -1689,6 +1717,28 @@ class PluginEdit(QDialog):


self.ui.cb_midi_programs.blockSignals(False) self.ui.cb_midi_programs.blockSignals(False)


def setParameterValue(self, parameterId, value):
#if parameterId == PARAMETER_ACTIVE:
#pass
#elif parameterId == PARAMETER_DRYWET:
#self.ui.dial_drywet.setValue(value * 1000, True, False)
#elif parameterId == PARAMETER_VOLUME:
#self.ui.dial_vol.setValue(value * 1000, True, False)
#elif parameterId == PARAMETER_BALANCE_LEFT:
#self.ui.dial_b_left.setValue(value * 1000, True, False)
#elif parameterId == PARAMETER_BALANCE_RIGHT:
#self.ui.dial_b_right.setValue(value * 1000, True, False)
#elif parameterId == PARAMETER_PANNING:
##self.ui.dial_pan.setValue(value * 1000, True, False)
#pass
#elif parameterId >= 0:
for paramItem in self.fParameterToUpdate:
if paramItem[0] == parameterId:
paramItem[1] = value
break
else:
self.fParameterToUpdate.append([parameterId, value])

def setVisible(self, yesNo): def setVisible(self, yesNo):
if yesNo: if yesNo:
if not self.fGeometry.isNull(): if not self.fGeometry.isNull():
@@ -1698,6 +1748,26 @@ class PluginEdit(QDialog):


QDialog.setVisible(self, yesNo) QDialog.setVisible(self, yesNo)


@pyqtSlot(int)
def slot_dryWetChanged(self, value):
Carla.host.set_drywet(self.fPluginId, float(value)/1000)

@pyqtSlot(int)
def slot_volumeChanged(self, value):
Carla.host.set_volume(self.fPluginId, float(value)/1000)

@pyqtSlot(int)
def slot_balanceLeftChanged(self, value):
Carla.host.set_balance_left(self.fPluginId, float(value)/1000)

@pyqtSlot(int)
def slot_balanceRightChanged(self, value):
Carla.host.set_balance_right(self.fPluginId, float(value)/1000)

@pyqtSlot(int)
def slot_panningChanged(self, value):
Carla.host.set_panning(self.fPluginId, float(value)/1000)

@pyqtSlot(int, float) @pyqtSlot(int, float)
def slot_parameterValueChanged(self, parameterId, value): def slot_parameterValueChanged(self, parameterId, value):
Carla.host.set_parameter_value(self.fPluginId, parameterId, value) Carla.host.set_parameter_value(self.fPluginId, parameterId, value)
@@ -1787,11 +1857,16 @@ class PluginEdit(QDialog):
# Plugin Widget # Plugin Widget


class PluginWidget(QFrame): class PluginWidget(QFrame):
def __init__(self, parent, pluginId):
def __init__(self, parent, listWidgetItem, pluginId):
QFrame.__init__(self, parent) QFrame.__init__(self, parent)
self.ui = ui_carla_plugin.Ui_PluginWidget() self.ui = ui_carla_plugin.Ui_PluginWidget()
self.ui.setupUi(self) self.ui.setupUi(self)


self.fLastGreenLedState = False
self.fLastBlueLedState = False

self.fParameterIconTimer = ICON_STATE_NULL

self.fPluginId = pluginId self.fPluginId = pluginId
self.fPluginInfo = Carla.host.get_plugin_info(self.fPluginId) self.fPluginInfo = Carla.host.get_plugin_info(self.fPluginId)
self.fPluginInfo["binary"] = cString(self.fPluginInfo["binary"]) self.fPluginInfo["binary"] = cString(self.fPluginInfo["binary"])
@@ -1800,10 +1875,7 @@ class PluginWidget(QFrame):
self.fPluginInfo["maker"] = cString(self.fPluginInfo["maker"]) self.fPluginInfo["maker"] = cString(self.fPluginInfo["maker"])
self.fPluginInfo["copyright"] = cString(self.fPluginInfo["copyright"]) self.fPluginInfo["copyright"] = cString(self.fPluginInfo["copyright"])


self.fParameterIconTimer = ICON_STATE_NULL

self.fLastGreenLedState = False
self.fLastBlueLedState = False
self.fListWidgetItem = listWidgetItem


if Carla.processMode == PROCESS_MODE_CONTINUOUS_RACK: if Carla.processMode == PROCESS_MODE_CONTINUOUS_RACK:
self.fPeaksInputCount = 2 self.fPeaksInputCount = 2
@@ -1865,16 +1937,6 @@ class PluginWidget(QFrame):
self.ui.led_audio_out.setColor(self.ui.led_audio_out.BLUE) self.ui.led_audio_out.setColor(self.ui.led_audio_out.BLUE)
self.ui.led_audio_out.setEnabled(False) self.ui.led_audio_out.setEnabled(False)


self.ui.dial_drywet.setPixmap(3)
self.ui.dial_vol.setPixmap(3)
self.ui.dial_b_left.setPixmap(4)
self.ui.dial_b_right.setPixmap(4)

self.ui.dial_drywet.setCustomPaint(self.ui.dial_drywet.CUSTOM_PAINT_CARLA_WET)
self.ui.dial_vol.setCustomPaint(self.ui.dial_vol.CUSTOM_PAINT_CARLA_VOL)
self.ui.dial_b_left.setCustomPaint(self.ui.dial_b_left.CUSTOM_PAINT_CARLA_L)
self.ui.dial_b_right.setCustomPaint(self.ui.dial_b_right.CUSTOM_PAINT_CARLA_R)

self.ui.peak_in.setColor(self.ui.peak_in.GREEN) self.ui.peak_in.setColor(self.ui.peak_in.GREEN)
self.ui.peak_in.setOrientation(self.ui.peak_in.HORIZONTAL) self.ui.peak_in.setOrientation(self.ui.peak_in.HORIZONTAL)


@@ -1890,26 +1952,16 @@ class PluginWidget(QFrame):
self.ui.edit_dialog.hide() self.ui.edit_dialog.hide()


self.connect(self.ui.led_enable, SIGNAL("clicked(bool)"), SLOT("slot_setActive(bool)")) self.connect(self.ui.led_enable, SIGNAL("clicked(bool)"), SLOT("slot_setActive(bool)"))
self.connect(self.ui.dial_drywet, SIGNAL("sliderMoved(int)"), SLOT("slot_setDryWet(int)"))
self.connect(self.ui.dial_vol, SIGNAL("sliderMoved(int)"), SLOT("slot_setVolume(int)"))
self.connect(self.ui.dial_b_left, SIGNAL("sliderMoved(int)"), SLOT("slot_setBalanceLeft(int)"))
self.connect(self.ui.dial_b_right, SIGNAL("sliderMoved(int)"), SLOT("slot_setBalanceRight(int)"))
#self.connect(self.ui.b_gui, SIGNAL("clicked(bool)"), SLOT("slot_guiClicked(bool)"))
self.connect(self.ui.b_gui, SIGNAL("clicked(bool)"), SLOT("slot_guiClicked(bool)"))
self.connect(self.ui.b_edit, SIGNAL("clicked(bool)"), SLOT("slot_editClicked(bool)")) self.connect(self.ui.b_edit, SIGNAL("clicked(bool)"), SLOT("slot_editClicked(bool)"))
#self.connect(self.ui.b_remove, SIGNAL("clicked()"), SLOT("slot_removeClicked()"))

#self.connect(self.ui.dial_drywet, SIGNAL("customContextMenuRequested(QPoint)"), SLOT("slot_showCustomDialMenu()"))
#self.connect(self.ui.dial_vol, SIGNAL("customContextMenuRequested(QPoint)"), SLOT("slot_showCustomDialMenu()"))
#self.connect(self.ui.dial_b_left, SIGNAL("customContextMenuRequested(QPoint)"), SLOT("slot_showCustomDialMenu()"))
#self.connect(self.ui.dial_b_right, SIGNAL("customContextMenuRequested(QPoint)"), SLOT("slot_showCustomDialMenu()"))
self.connect(self.ui.b_remove, SIGNAL("clicked()"), SLOT("slot_removeClicked()"))


# FIXME # FIXME
self.ui.frame_controls.setVisible(False)
self.ui.pushButton.setVisible(False)
self.ui.pushButton_2.setVisible(False)
self.ui.pushButton_3.setVisible(False)
self.setMaximumHeight(48) self.setMaximumHeight(48)


def getListWidgetItem(self):
return self.fListWidgetItem

def setActive(self, active, sendGui=False, sendCallback=True): def setActive(self, active, sendGui=False, sendCallback=True):
if sendGui: self.ui.led_enable.setChecked(active) if sendGui: self.ui.led_enable.setChecked(active)
if sendCallback: Carla.host.set_active(self.fPluginId, active) if sendCallback: Carla.host.set_active(self.fPluginId, active)
@@ -1917,67 +1969,23 @@ class PluginWidget(QFrame):
if active: if active:
self.ui.edit_dialog.ui.keyboard.allNotesOff() self.ui.edit_dialog.ui.keyboard.allNotesOff()


def setDryWet(self, value, sendGui=False, sendCallback=True):
if sendGui: self.ui.dial_drywet.setValue(value)
if sendCallback: Carla.host.set_drywet(self.fPluginId, float(value)/1000)

message = self.tr("Output dry/wet (%i%%)" % int(value / 10))
self.ui.dial_drywet.setStatusTip(message)
#Carla.gui.statusBar().showMessage(message)
def setParameterValue(self, parameterId, value):
self.fParameterIconTimer = ICON_STATE_ON


def setVolume(self, value, sendGui=False, sendCallback=True):
if sendGui: self.ui.dial_vol.setValue(value)
if sendCallback: Carla.host.set_volume(self.fPluginId, float(value)/1000)
if parameterId == PARAMETER_ACTIVE:
return self.setActive(bool(value), True, False)


message = self.tr("Output volume (%i%%)" % int(value / 10))
self.ui.dial_vol.setStatusTip(message)
#Carla.gui.statusBar().showMessage(message)
self.ui.edit_dialog.setParameterValue(parameterId, value)


def setBalanceLeft(self, value, sendGui=False, sendCallback=True):
if sendGui: self.ui.dial_b_left.setValue(value)
if sendCallback: Carla.host.set_balance_left(self.fPluginId, float(value)/1000)

if value < 0:
message = self.tr("Left Panning (%i%% Left)" % int(-value / 10))
elif value > 0:
message = self.tr("Left Panning (%i%% Right)" % int(value / 10))
else:
message = self.tr("Left Panning (Center)")

self.ui.dial_b_left.setStatusTip(message)
#Carla.gui.statusBar().showMessage(message)

def setBalanceRight(self, value, sendGui=False, sendCallback=True):
if sendGui: self.ui.dial_b_right.setValue(value)
if sendCallback: Carla.host.set_balance_right(self.fPluginId, float(value)/1000)

if value < 0:
message = self.tr("Right Panning (%i%% Left)" % int(-value / 10))
elif value > 0:
message = self.tr("Right Panning (%i%% Right)" % int(value / 10))
else:
message = self.tr("Right Panning (Center)")

self.ui.dial_b_right.setStatusTip(message)
#Carla.gui.statusBar().showMessage(message)

def setPanning(self, value, sendGui=False, sendCallback=True):
#if sendGui: self.ui.dial_vol.setValue(value)
if sendCallback: Carla.host.set_panning(self.fPluginId, float(value)/1000)

#message = self.tr("Output panning (%i%%)" % int(value / 10))
#self.ui.dial_vol.setStatusTip(message)
#Carla.gui.statusBar().showMessage(message)
def setId(self, idx):
self.fPluginId = idx
self.ui.edit_dialog.fPluginId = idx


def editClosed(self): def editClosed(self):
self.ui.b_edit.setChecked(False) self.ui.b_edit.setChecked(False)


def recheckPluginHints(self, hints): def recheckPluginHints(self, hints):
self.fPluginInfo['hints'] = hints self.fPluginInfo['hints'] = hints
self.ui.dial_drywet.setEnabled(hints & PLUGIN_CAN_DRYWET)
self.ui.dial_vol.setEnabled(hints & PLUGIN_CAN_VOLUME)
self.ui.dial_b_left.setEnabled(hints & PLUGIN_CAN_BALANCE)
self.ui.dial_b_right.setEnabled(hints & PLUGIN_CAN_BALANCE)
self.ui.b_gui.setEnabled(hints & PLUGIN_HAS_GUI) self.ui.b_gui.setEnabled(hints & PLUGIN_HAS_GUI)


def paintEvent(self, event): def paintEvent(self, event):
@@ -2025,30 +2033,18 @@ class PluginWidget(QFrame):
def slot_setActive(self, yesNo): def slot_setActive(self, yesNo):
self.setActive(yesNo, False, True) self.setActive(yesNo, False, True)


@pyqtSlot(int)
def slot_setDryWet(self, value):
self.setDryWet(value, False, True)

@pyqtSlot(int)
def slot_setVolume(self, value):
self.setVolume(value, False, True)

@pyqtSlot(int)
def slot_setBalanceLeft(self, value):
self.setBalanceLeft(value, False, True)

@pyqtSlot(int)
def slot_setBalanceRight(self, value):
self.setBalanceRight(value, False, True)

@pyqtSlot(int)
def slot_setPanning(self, value):
self.setPanning(value, False, True)
@pyqtSlot(bool)
def slot_guiClicked(self, show):
Carla.host.show_gui(show)


@pyqtSlot(bool) @pyqtSlot(bool)
def slot_editClicked(self, show): def slot_editClicked(self, show):
self.ui.edit_dialog.setVisible(show) self.ui.edit_dialog.setVisible(show)


@pyqtSlot()
def slot_removeClicked(self):
Carla.host.remove_plugin(self.fPluginId)

# ------------------------------------------------------------------------------------------------------------ # ------------------------------------------------------------------------------------------------------------
# Separate Thread for Plugin Search # Separate Thread for Plugin Search




+ 12
- 6
source/widgets/pixmapdial.py View File

@@ -21,7 +21,8 @@


from math import floor from math import floor
from PyQt4.QtCore import Qt, QPointF, QRectF, QTimer, QSize, SLOT from PyQt4.QtCore import Qt, QPointF, QRectF, QTimer, QSize, SLOT
from PyQt4.QtGui import QColor, QConicalGradient, QDial, QFontMetrics, QLinearGradient, QPainter, QPainterPath, QPen, QPixmap
from PyQt4.QtGui import QColor, QConicalGradient, QDial, QFont, QFontMetrics
from PyQt4.QtGui import QLinearGradient, QPainter, QPainterPath, QPen, QPixmap


# ------------------------------------------------------------------------------------------------------------ # ------------------------------------------------------------------------------------------------------------
# Widget Class # Widget Class
@@ -58,6 +59,8 @@ class PixmapDial(QDial):


self.m_label = "" self.m_label = ""
self.m_labelPos = QPointF(0.0, 0.0) self.m_labelPos = QPointF(0.0, 0.0)
self.m_labelFont = QFont()
self.m_labelFont.setPointSize(6)
self.m_labelWidth = 0 self.m_labelWidth = 0
self.m_labelHeight = 0 self.m_labelHeight = 0
self.m_labelGradient = QLinearGradient(0, 0, 0, 1) self.m_labelGradient = QLinearGradient(0, 0, 0, 1)
@@ -81,6 +84,7 @@ class PixmapDial(QDial):


def setCustomPaint(self, paint): def setCustomPaint(self, paint):
self.m_customPaint = paint self.m_customPaint = paint
self.m_labelPos.setY(self.p_size + self.m_labelHeight/2)
self.update() self.update()


def setEnabled(self, enabled): def setEnabled(self, enabled):
@@ -93,8 +97,8 @@ class PixmapDial(QDial):
def setLabel(self, label): def setLabel(self, label):
self.m_label = label self.m_label = label


self.m_labelWidth = QFontMetrics(self.font()).width(label)
self.m_labelHeight = QFontMetrics(self.font()).height()
self.m_labelWidth = QFontMetrics(self.m_labelFont).width(label)
self.m_labelHeight = QFontMetrics(self.m_labelFont).height()


self.m_labelPos.setX(float(self.p_size)/2 - float(self.m_labelWidth)/2) self.m_labelPos.setX(float(self.p_size)/2 - float(self.m_labelWidth)/2)
self.m_labelPos.setY(self.p_size + self.m_labelHeight) self.m_labelPos.setY(self.p_size + self.m_labelHeight)
@@ -164,10 +168,12 @@ class PixmapDial(QDial):
painter.setRenderHint(QPainter.Antialiasing, True) painter.setRenderHint(QPainter.Antialiasing, True)


if self.m_label: if self.m_label:
painter.setPen(self.m_color2)
painter.setBrush(self.m_labelGradient)
painter.drawRect(self.m_labelGradient_rect)
if self.m_customPaint == self.CUSTOM_PAINT_NULL:
painter.setPen(self.m_color2)
painter.setBrush(self.m_labelGradient)
painter.drawRect(self.m_labelGradient_rect)


painter.setFont(self.m_labelFont)
painter.setPen(self.m_colorT[0 if self.isEnabled() else 1]) painter.setPen(self.m_colorT[0 if self.isEnabled() else 1])
painter.drawText(self.m_labelPos, self.m_label) painter.drawText(self.m_labelPos, self.m_label)




Loading…
Cancel
Save