Browse Source

Allow to load preset files as projects in file-browser

tags/1.9.4
falkTX 11 years ago
parent
commit
2392e9672d
6 changed files with 97 additions and 107 deletions
  1. +76
    -92
      resources/ui/carla_edit.ui
  2. +10
    -4
      source/backend/engine/CarlaEngine.cpp
  3. +1
    -1
      source/backend/plugin/CarlaPlugin.cpp
  4. +1
    -1
      source/backend/standalone/CarlaStandalone.cpp
  5. +1
    -1
      source/carla.py
  6. +8
    -8
      source/carla_shared.py

+ 76
- 92
resources/ui/carla_edit.ui View File

@@ -113,8 +113,8 @@ Plugin Name
<string>Information</string>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="1" column="1">
<widget class="QLineEdit" name="le_label">
<item row="8" column="1">
<widget class="QLineEdit" name="le_params">
<property name="frame">
<bool>false</bool>
</property>
@@ -123,18 +123,18 @@ Plugin Name
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="label_maker">
<item row="5" column="0">
<widget class="QLabel" name="label_type">
<property name="text">
<string>Maker:</string>
<string>Type:</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="6" column="1">
<widget class="QLineEdit" name="le_ains">
<item row="2" column="1">
<widget class="QLineEdit" name="le_maker">
<property name="frame">
<bool>false</bool>
</property>
@@ -143,34 +143,38 @@ Plugin Name
</property>
</widget>
</item>
<item row="4" column="0">
<widget class="QLabel" name="label_unique_id">
<item row="7" column="1">
<widget class="QLineEdit" name="le_aouts">
<property name="frame">
<bool>false</bool>
</property>
<property name="readOnly">
<bool>true</bool>
</property>
</widget>
</item>
<item row="6" column="0">
<widget class="QLabel" name="label_ains">
<property name="text">
<string>Unique ID:</string>
<string>Audio Inputs:</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_label">
<item row="9" column="0">
<widget class="QLabel" name="label_latency">
<property name="text">
<string>Label/Product:</string>
<string>Latency:</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QLineEdit" name="le_name">
<property name="minimumSize">
<size>
<width>200</width>
<height>0</height>
</size>
</property>
<item row="4" column="1">
<widget class="QLineEdit" name="le_unique_id">
<property name="frame">
<bool>false</bool>
</property>
@@ -179,16 +183,6 @@ Plugin Name
</property>
</widget>
</item>
<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>
</widget>
</item>
<item row="3" column="1">
<widget class="QLineEdit" name="le_copyright">
<property name="frame">
@@ -199,18 +193,8 @@ Plugin Name
</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="7" column="1">
<widget class="QLineEdit" name="le_aouts">
<item row="6" column="1">
<widget class="QLineEdit" name="le_ains">
<property name="frame">
<bool>false</bool>
</property>
@@ -219,8 +203,8 @@ Plugin Name
</property>
</widget>
</item>
<item row="8" column="1">
<widget class="QLineEdit" name="le_params">
<item row="5" column="1">
<widget class="QLineEdit" name="le_type">
<property name="frame">
<bool>false</bool>
</property>
@@ -229,10 +213,10 @@ Plugin Name
</property>
</widget>
</item>
<item row="6" column="0">
<widget class="QLabel" name="label_ains">
<item row="4" column="0">
<widget class="QLabel" name="label_unique_id">
<property name="text">
<string>Audio Inputs:</string>
<string>Unique ID:</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
@@ -249,8 +233,18 @@ Plugin Name
</property>
</widget>
</item>
<item row="4" column="1">
<widget class="QLineEdit" name="le_unique_id">
<item row="1" column="0">
<widget class="QLabel" name="label_label">
<property name="text">
<string>Label/Product:</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="9" column="1">
<widget class="QLineEdit" name="le_latency">
<property name="frame">
<bool>false</bool>
</property>
@@ -259,58 +253,64 @@ Plugin Name
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QLabel" name="label_copyright">
<property name="text">
<string>Copyright:</string>
<item row="1" column="1">
<widget class="QLineEdit" name="le_label">
<property name="frame">
<bool>false</bool>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
<property name="readOnly">
<bool>true</bool>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QLabel" name="label_real_name">
<item row="8" column="0">
<widget class="QLabel" name="label_params">
<property name="text">
<string>Name:</string>
<string>Parameters:</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="9" column="0">
<widget class="QLabel" name="label_latency">
<item row="2" column="0">
<widget class="QLabel" name="label_maker">
<property name="text">
<string>Latency:</string>
<string>Maker:</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="9" column="1">
<widget class="QLineEdit" name="le_latency">
<property name="frame">
<bool>false</bool>
<item row="0" column="0">
<widget class="QLabel" name="label_real_name">
<property name="text">
<string>Name:</string>
</property>
<property name="readOnly">
<bool>true</bool>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="5" column="1">
<widget class="QLineEdit" name="le_type">
<property name="frame">
<bool>false</bool>
<item row="3" column="0">
<widget class="QLabel" name="label_copyright">
<property name="text">
<string>Copyright:</string>
</property>
<property name="readOnly">
<bool>true</bool>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QLineEdit" name="le_maker">
<item row="0" column="1">
<widget class="QLineEdit" name="le_name">
<property name="minimumSize">
<size>
<width>200</width>
<height>0</height>
</size>
</property>
<property name="frame">
<bool>false</bool>
</property>
@@ -319,22 +319,6 @@ Plugin Name
</property>
</widget>
</item>
<item row="10" column="0" colspan="2">
<spacer name="horizontalSpacer_3">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Expanding</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>250</width>
<height>1</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
</item>


+ 10
- 4
source/backend/engine/CarlaEngine.cpp View File

@@ -1014,19 +1014,21 @@ bool CarlaEngine::loadProject(const char* const filename)

QDomNode xmlNode(xml.documentElement());

if (xmlNode.toElement().tagName() != "CARLA-PROJECT")
if (xmlNode.toElement().tagName() != "CARLA-PROJECT" && xmlNode.toElement().tagName() != "CARLA-PRESET")
{
carla_stderr2("Not a valid Carla project file");
setLastError("Not a valid Carla project or preset file");
return false;
}

const bool isPreset(xmlNode.toElement().tagName() == "CARLA-PRESET");

QDomNode node(xmlNode.firstChild());

while (! node.isNull())
{
if (node.toElement().tagName() == "Plugin")
if (isPreset || node.toElement().tagName() == "Plugin")
{
const SaveState& saveState = getSaveStateDictFromXML(node);
const SaveState& saveState = getSaveStateDictFromXML(isPreset ? xmlNode : node);
CARLA_ASSERT(saveState.type != nullptr);

if (saveState.type == nullptr)
@@ -1044,6 +1046,10 @@ bool CarlaEngine::loadProject(const char* const filename)
plugin->loadSaveState(saveState);
}
}

if (isPreset)
break;

node = node.nextSibling();
}



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

@@ -966,7 +966,7 @@ bool CarlaPlugin::loadStateFromFile(const char* const filename)

if (xmlNode.toElement().tagName() != "CARLA-PRESET")
{
carla_stderr2("Not a valid Carla preset file");
kData->engine->setLastError("Not a valid Carla preset file");
return false;
}



+ 1
- 1
source/backend/standalone/CarlaStandalone.cpp View File

@@ -161,7 +161,7 @@ const char* carla_get_supported_file_types()
if (retText.isEmpty())
{
// Base type
retText = "*.carxp";
retText = "*.carxp;*.carxs";

// Sample kits
#ifdef WANT_FLUIDSYNTH


+ 1
- 1
source/carla.py View File

@@ -836,7 +836,7 @@ class CarlaMainW(QMainWindow):
basename = os.path.basename(filename)
extension = filename.rsplit(".", 1)[-1].lower()

if extension == "carxp":
if extension in ("carxp", "carxs"):
if not Carla.host.load_project(filename):
self.showLastError(True)



+ 8
- 8
source/carla_shared.py View File

@@ -488,7 +488,7 @@ def findTool(tdir, tname):

return ""

# find wine/windows tools
# find windows tools
carla_discovery_win32 = findTool("discovery", "carla-discovery-win32.exe")
carla_discovery_win64 = findTool("discovery", "carla-discovery-win64.exe")
carla_bridge_win32 = findTool("bridges", "carla-bridge-win32.exe")
@@ -1127,7 +1127,6 @@ class PluginEdit(QDialog):
self.ui.b_load_state.setEnabled(False)
self.ui.b_save_state.setEnabled(False)

# Set options
self.connect(self.ui.ch_fixed_buffer, SIGNAL("clicked(bool)"), SLOT("slot_optionChanged(bool)"))
self.connect(self.ui.ch_force_stereo, SIGNAL("clicked(bool)"), SLOT("slot_optionChanged(bool)"))
self.connect(self.ui.ch_map_program_changes, SIGNAL("clicked(bool)"), SLOT("slot_optionChanged(bool)"))
@@ -1144,10 +1143,10 @@ class PluginEdit(QDialog):
self.connect(self.ui.dial_b_right, SIGNAL("valueChanged(int)"), SLOT("slot_balanceRightChanged(int)"))
self.connect(self.ui.sb_ctrl_channel, SIGNAL("valueChanged(int)"), SLOT("slot_ctrlChannelChanged(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.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("noteOff(int)"), SLOT("slot_noteOff(int)"))
@@ -1195,6 +1194,8 @@ class PluginEdit(QDialog):
self.ui.le_type.setText("LV2")
elif pluginType == PLUGIN_VST:
self.ui.le_type.setText("VST")
elif pluginType == PLUGIN_VST3:
self.ui.le_type.setText("VST3")
elif pluginType == PLUGIN_GIG:
self.ui.le_type.setText("GIG")
elif pluginType == PLUGIN_SF2:
@@ -1230,7 +1231,6 @@ class PluginEdit(QDialog):
self.ui.dial_b_left.setEnabled(pluginHints & PLUGIN_CAN_BALANCE)
self.ui.dial_b_right.setEnabled(pluginHints & PLUGIN_CAN_BALANCE)

# Set options
self.ui.ch_fixed_buffer.setEnabled(self.fPluginInfo['optionsAvailable'] & PLUGIN_OPTION_FIXED_BUFFER)
self.ui.ch_fixed_buffer.setChecked(self.fPluginInfo['optionsEnabled'] & PLUGIN_OPTION_FIXED_BUFFER)
self.ui.ch_force_stereo.setEnabled(self.fPluginInfo['optionsAvailable'] & PLUGIN_OPTION_FORCE_STEREO)
@@ -1255,7 +1255,7 @@ class PluginEdit(QDialog):
self.ui.scrollArea.setEnabled(showKeyboard)
self.ui.scrollArea.setVisible(showKeyboard)

# Force-Update parent for new hints (knobs)
# Force-Update parent for new hints
if self.fRealParent:
self.fRealParent.recheckPluginHints(pluginHints)



Loading…
Cancel
Save