summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/client/ClientStore.cpp29
-rw-r--r--src/client/NodeModel.hpp1
-rw-r--r--src/client/ObjectModel.cpp2
-rw-r--r--src/client/PluginModel.cpp20
-rw-r--r--src/client/PluginModel.hpp9
-rw-r--r--src/engine/events/LoadPlugins.cpp3
-rw-r--r--src/engine/events/LoadPlugins.hpp6
-rw-r--r--src/engine/events/SetPortValue.cpp5
-rw-r--r--src/gui/Controls.cpp93
-rw-r--r--src/gui/Controls.hpp26
-rw-r--r--src/gui/NodeModule.cpp18
-rw-r--r--src/gui/NodeModule.hpp3
-rw-r--r--src/gui/PatchWindow.cpp64
-rw-r--r--src/gui/PatchWindow.hpp5
-rw-r--r--src/gui/Port.cpp71
-rw-r--r--src/gui/Port.hpp3
-rw-r--r--src/gui/WindowFactory.cpp3
-rw-r--r--src/serialisation/Serialiser.cpp2
18 files changed, 190 insertions, 173 deletions
diff --git a/src/client/ClientStore.cpp b/src/client/ClientStore.cpp
index 74a0faad..64e84494 100644
--- a/src/client/ClientStore.cpp
+++ b/src/client/ClientStore.cpp
@@ -184,11 +184,13 @@ ClientStore::resource(const URI& uri)
void
ClientStore::add_plugin(SharedPtr<PluginModel> pm)
{
- // FIXME: dupes? merge, like with objects?
-
- (*_plugins)[pm->uri()] = pm;
- signal_new_plugin(pm);
- //cerr << "Plugin: " << pm->uri() << ", # plugins: " << _plugins->size() << endl;
+ SharedPtr<PluginModel> existing = this->plugin(pm->uri());
+ if (existing) {
+ existing->set(pm);
+ } else {
+ _plugins->insert(make_pair(pm->uri(), pm));
+ signal_new_plugin(pm);
+ }
}
@@ -300,15 +302,16 @@ ClientStore::put(const URI& uri, const Resource::Properties& properties)
const Resource::Properties::const_iterator p = properties.find("rdf:instanceOf");
SharedPtr<PluginModel> plug;
if (p->second.is_valid() && p->second.type() == Atom::URI) {
- if ((plug = plugin(p->second.get_uri()))) {
- SharedPtr<NodeModel> n(new NodeModel(plug, path));
- n->set_properties(properties);
- add_object(n);
- } else {
- SharedPtr<NodeModel> n(new NodeModel(p->second.get_uri(), path));
- n->set_properties(properties);
- add_object(n);
+ if (!(plug = plugin(p->second.get_uri()))) {
+ cout << "WARNING: Unable to find plugin " << p->second.get_uri() << endl;
+ plug = SharedPtr<PluginModel>(
+ new PluginModel(p->second.get_uri(), "ingen:nil", Resource::Properties()));
+ add_plugin(plug);
}
+
+ SharedPtr<NodeModel> n(new NodeModel(plug, path));
+ n->set_properties(properties);
+ add_object(n);
} else {
cerr << "ERROR: Plugin with no type" << endl;
}
diff --git a/src/client/NodeModel.hpp b/src/client/NodeModel.hpp
index b5af737e..57d2f09c 100644
--- a/src/client/NodeModel.hpp
+++ b/src/client/NodeModel.hpp
@@ -57,6 +57,7 @@ public:
const Raul::URI& plugin_uri() const { return _plugin_uri; }
const Shared::Plugin* plugin() const { return _plugin.get(); }
+ Shared::Plugin* plugin() { return _plugin.get(); }
uint32_t num_ports() const { return _ports.size(); }
const Ports& ports() const { return _ports; }
diff --git a/src/client/ObjectModel.cpp b/src/client/ObjectModel.cpp
index e41be6c9..6c64735d 100644
--- a/src/client/ObjectModel.cpp
+++ b/src/client/ObjectModel.cpp
@@ -83,7 +83,7 @@ ObjectModel::polyphonic() const
/** Merge the data of @a model with self, as much as possible.
*
* This will merge the two models, but with any conflict take the value in
- * @a model as correct. The paths of the two models MUST be equal.
+ * @a o as correct. The paths of the two models MUST be equal.
*/
void
ObjectModel::set(SharedPtr<ObjectModel> o)
diff --git a/src/client/PluginModel.cpp b/src/client/PluginModel.cpp
index 4f1a4626..c40bb7ef 100644
--- a/src/client/PluginModel.cpp
+++ b/src/client/PluginModel.cpp
@@ -128,6 +128,26 @@ PluginModel::get_property(const URI& key) const
}
+void
+PluginModel::set(SharedPtr<PluginModel> p)
+{
+ _type = p->_type;
+ _icon_path = p->_icon_path;
+
+#ifdef HAVE_SLV2
+ if (p->_slv2_plugin)
+ _slv2_plugin = p->_slv2_plugin;
+#endif
+
+ for (Properties::const_iterator v = p->properties().begin(); v != p->properties().end(); ++v) {
+ ResourceImpl::set_property(v->first, v->second);
+ signal_property.emit(v->first, v->second);
+ }
+
+ signal_changed.emit();
+}
+
+
Symbol
PluginModel::default_node_symbol()
{
diff --git a/src/client/PluginModel.hpp b/src/client/PluginModel.hpp
index 90440efe..b9407334 100644
--- a/src/client/PluginModel.hpp
+++ b/src/client/PluginModel.hpp
@@ -89,8 +89,15 @@ public:
static Redland::World* rdf_world() { return _rdf_world; }
+ // Signals
+ sigc::signal<void> signal_changed;
+
+protected:
+ friend class ClientStore;
+ void set(SharedPtr<PluginModel> p);
+
private:
- const Type _type;
+ Type _type;
#ifdef HAVE_SLV2
static SLV2World _slv2_world;
diff --git a/src/engine/events/LoadPlugins.cpp b/src/engine/events/LoadPlugins.cpp
index 4b16048f..e8ae8ce2 100644
--- a/src/engine/events/LoadPlugins.cpp
+++ b/src/engine/events/LoadPlugins.cpp
@@ -27,9 +27,8 @@ namespace Events {
LoadPlugins::LoadPlugins(Engine& engine, SharedPtr<Responder> responder, SampleCount timestamp, QueuedEventSource* source)
-: QueuedEvent(engine, responder, timestamp, true, source)
+ : QueuedEvent(engine, responder, timestamp, true, source)
{
- /* FIXME: Not sure why this has to be blocking, but it fixes some nasty bugs.. */
}
void
diff --git a/src/engine/events/LoadPlugins.hpp b/src/engine/events/LoadPlugins.hpp
index 5f38c9c9..8dce2a27 100644
--- a/src/engine/events/LoadPlugins.hpp
+++ b/src/engine/events/LoadPlugins.hpp
@@ -32,9 +32,9 @@ class LoadPlugins : public QueuedEvent
{
public:
LoadPlugins(Engine& engine,
- SharedPtr<Responder> responder,
- SampleCount timestamp,
- QueuedEventSource* source);
+ SharedPtr<Responder> responder,
+ SampleCount timestamp,
+ QueuedEventSource* source);
void pre_process();
void post_process();
diff --git a/src/engine/events/SetPortValue.cpp b/src/engine/events/SetPortValue.cpp
index 085d328c..7fe6377d 100644
--- a/src/engine/events/SetPortValue.cpp
+++ b/src/engine/events/SetPortValue.cpp
@@ -123,6 +123,11 @@ SetPortValue::pre_process()
_engine.audio_driver()->frame_time() + _engine.audio_driver()->buffer_size());
}
+ if (_port) {
+ _port->set_value(_value);
+ _port->set_property("ingen:value", _value);
+ }
+
QueuedEvent::pre_process();
}
diff --git a/src/gui/Controls.cpp b/src/gui/Controls.cpp
index 6e8ca351..9c66b1ae 100644
--- a/src/gui/Controls.cpp
+++ b/src/gui/Controls.cpp
@@ -70,6 +70,7 @@ Control::init(ControlPanel* panel, SharedPtr<PortModel> pm)
assert(_port_model);
assert(panel);
+ _control_connection.disconnect();
_control_connection = pm->signal_value_changed.connect(sigc::mem_fun(this, &Control::set_value));
}
@@ -174,13 +175,13 @@ SliderControl::clicked(GdkEventButton* ev)
void
SliderControl::set_value(const Atom& atom)
{
- float val = atom.get_float();
+ if (_enabled) {
+ _enable_signal = false;
+ float val = atom.get_float();
- if (_port_model->is_integer())
- val = lrintf(val);
+ if (_port_model->is_integer())
+ val = lrintf(val);
- _enable_signal = false;
- if (_enabled) {
if (_slider->get_value() != val) {
const Gtk::Adjustment* range = _slider->get_adjustment();
const float lower = range->get_lower();
@@ -189,10 +190,12 @@ SliderControl::set_value(const Atom& atom)
set_range(min(lower, val), max(lower, val));
_slider->set_value(val);
}
+
if (_value_spinner->get_value() != val)
_value_spinner->set_value(val);
+
+ _enable_signal = true;
}
- _enable_signal = true;
}
@@ -290,94 +293,16 @@ SliderControl::update_value_from_spinner()
bool
SliderControl::slider_pressed(GdkEvent* ev)
{
- //cerr << "Pressed: " << ev->type << endl;
if (ev->type == GDK_BUTTON_PRESS) {
_enabled = false;
- //GtkClientInterface::instance()->set_ignore_port(_port_model->path());
} else if (ev->type == GDK_BUTTON_RELEASE) {
_enabled = true;
- //GtkClientInterface::instance()->clear_ignore_port();
}
return false;
}
-// ///////////// IntegerControl ////////////// //
-
-#if 0
-IntegerControl::IntegerControl(ControlPanel* panel, SharedPtr<PortModel> pm)
-: Control(panel, pm),
- _enable_signal(false),
- _alignment(0.5, 0.5, 0.0, 0.0),
- _name_label(pm->path().name()),
- _spinner(1.0, 0)
-{
- set_name(pm->path().name());
-
- _spinner.set_range(-99999, 99999);
- _spinner.set_value(_port_model->value());
- _spinner.signal_value_changed().connect(
- sigc::mem_fun(*this, &IntegerControl::update_value));
- _spinner.set_increments(1, 10);
-
- _alignment.add(_spinner);
- pack_start(_name_label);
- pack_start(_alignment);
-
- _enable_signal = true;
-
- show_all();
-}
-
-
-void
-IntegerControl::set_name(const string& name)
-{
- string name_label = "<span weight=\"bold\">";
- name_label += name + "</span>";
- _name_label->set_markup(name_label);
-}
-
-
-void
-IntegerControl::set_value(float val)
-{
- //cerr << "[IntegerControl] Setting value to " << val << endl;
- _enable_signal = false;
- _spinner.set_value(val);
- _enable_signal = true;
-}
-
-
-void
-IntegerControl::enable()
-{
- _spinner.property_sensitive() = true;
- _name_label->property_sensitive() = true;
-}
-
-
-void
-IntegerControl::disable()
-{
- _spinner.property_sensitive() = false;
- _name_label->property_sensitive() = false;
-}
-
-
-void
-IntegerControl::update_value()
-{
- if (_enable_signal) {
- float value = _spinner.get_value();
- _control_panel->value_changed(_port_model, value);
- //m_port_model->value(value);
- }
-}
-#endif
-
-
// ///////////// ToggleControl ////////////// //
diff --git a/src/gui/Controls.hpp b/src/gui/Controls.hpp
index 844e6738..91b737ed 100644
--- a/src/gui/Controls.hpp
+++ b/src/gui/Controls.hpp
@@ -104,32 +104,6 @@ private:
};
-#if 0
-
-/** A spinbutton for integer controls.
- *
- * \ingroup GUI
- */
-class IntegerControl : public Control
-{
-public:
- IntegerControl(ControlPanel* panel, SharedPtr<PortModel> pm);
-
- void enable();
- void disable();
-
-private:
- void set_value(float val);
-
- void update_value();
-
- bool _enable_signal;
- Gtk::Alignment _alignment;
- Gtk::SpinButton _spinner;
-};
-#endif
-
-
/** A radio button for toggle controls.
*
* \ingroup GUI
diff --git a/src/gui/NodeModule.cpp b/src/gui/NodeModule.cpp
index 4df32263..9010221a 100644
--- a/src/gui/NodeModule.cpp
+++ b/src/gui/NodeModule.cpp
@@ -21,6 +21,7 @@
#include "interface/EngineInterface.hpp"
#include "client/PatchModel.hpp"
#include "client/NodeModel.hpp"
+#include "client/PluginModel.hpp"
#include "client/PluginUI.hpp"
#include "App.hpp"
#include "GladeFactory.hpp"
@@ -54,6 +55,9 @@ NodeModule::NodeModule(boost::shared_ptr<PatchCanvas> canvas, SharedPtr<NodeMode
node->signal_removed_port.connect(sigc::hide_return(sigc::mem_fun(this, &NodeModule::remove_port)));
node->signal_property.connect(sigc::mem_fun(this, &NodeModule::set_property));
node->signal_moved.connect(sigc::mem_fun(this, &NodeModule::rename));
+ PluginModel* plugin = dynamic_cast<PluginModel*>(node->plugin());
+ if (plugin)
+ plugin->signal_changed.connect(sigc::mem_fun(this, &NodeModule::plugin_changed));
}
@@ -169,6 +173,14 @@ NodeModule::value_changed(uint32_t index, const Atom& value)
void
+NodeModule::plugin_changed()
+{
+ for (PortVector::iterator p = ports().begin(); p != ports().end(); ++p)
+ PtrCast<Ingen::GUI::Port>(*p)->update_metadata();
+}
+
+
+void
NodeModule::embed_gui(bool embed)
{
if (embed) {
@@ -217,7 +229,7 @@ NodeModule::embed_gui(bool embed)
}
if (embed && _embed_item) {
- initialise_gui_values();
+ set_control_values();
set_base_color(0x212222FF);
} else {
set_default_base_color();
@@ -307,7 +319,7 @@ NodeModule::popup_gui()
_gui_window->set_role("plugin_ui");
_gui_window->add(*_gui_widget);
_gui_widget->show_all();
- initialise_gui_values();
+ set_control_values();
_gui_window->signal_unmap().connect(
sigc::mem_fun(this, &NodeModule::on_gui_window_close));
@@ -334,7 +346,7 @@ NodeModule::on_gui_window_close()
void
-NodeModule::initialise_gui_values()
+NodeModule::set_control_values()
{
uint32_t index=0;
for (NodeModel::Ports::const_iterator p = _node->ports().begin(); p != _node->ports().end(); ++p) {
diff --git a/src/gui/NodeModule.hpp b/src/gui/NodeModule.hpp
index a1a76e71..496d8867 100644
--- a/src/gui/NodeModule.hpp
+++ b/src/gui/NodeModule.hpp
@@ -82,7 +82,8 @@ protected:
void add_port(SharedPtr<PortModel> port, bool resize=true);
void value_changed(uint32_t index, const Raul::Atom& value);
- void initialise_gui_values();
+ void plugin_changed();
+ void set_control_values();
void create_menu();
diff --git a/src/gui/PatchWindow.cpp b/src/gui/PatchWindow.cpp
index a2992215..2638cbbe 100644
--- a/src/gui/PatchWindow.cpp
+++ b/src/gui/PatchWindow.cpp
@@ -18,6 +18,7 @@
#include "PatchWindow.hpp"
#include <iostream>
#include <cassert>
+#include <sstream>
#include <fstream>
#include <boost/format.hpp>
#include "raul/AtomRDF.hpp"
@@ -300,38 +301,55 @@ PatchWindow::patch_port_removed(SharedPtr<PortModel> port)
void
-PatchWindow::object_entered(ObjectModel* model)
+PatchWindow::show_status(ObjectModel* model)
{
- string msg = model->path().str();
- NodeModel* node = dynamic_cast<NodeModel*>(model);
- if (node) {
- PluginModel* plugin = (PluginModel*)node->plugin();
+ std::stringstream msg;
+ msg << model->path().chop_scheme();
+
+ PortModel* port = 0;
+ NodeModel* node = 0;
+
+ if ((port = dynamic_cast<PortModel*>(model))) {
+ show_port_status(port, port->value());
+
+ } else if ((node = dynamic_cast<NodeModel*>(model))) {
+ PluginModel* plugin = dynamic_cast<PluginModel*>(node->plugin());
if (plugin)
- msg.append((boost::format(" (%1%)") % plugin->human_name()).str());
+ msg << ((boost::format(" (%1%)") % plugin->human_name()).str());
+ _status_bar->push(msg.str(), STATUS_CONTEXT_HOVER);
}
+}
- PortModel* port = dynamic_cast<PortModel*>(model);
- if (port) {
- NodeModel* parent = dynamic_cast<NodeModel*>(port->parent().get());
- if (parent) {
- const PluginModel* plugin = dynamic_cast<const PluginModel*>(parent->plugin());
- if (plugin) {
- const string human_name = plugin->port_human_name(port->index());
- if (human_name != "")
- msg.append((boost::format(" (%1%)") % human_name).str());
- }
- }
+void
+PatchWindow::show_port_status(PortModel* port, const Raul::Atom& value)
+{
+ std::stringstream msg;
+ msg << port->path().chop_scheme();
- const Atom& value = port->value();
- if (value.is_valid()) {
- const Redland::Node node = AtomRDF::atom_to_node(
- *App::instance().world()->rdf_world, value);
- msg.append(" = ").append(node.to_string());
+ NodeModel* parent = dynamic_cast<NodeModel*>(port->parent().get());
+ if (parent) {
+ const PluginModel* plugin = dynamic_cast<const PluginModel*>(parent->plugin());
+ if (plugin) {
+ const string& human_name = plugin->port_human_name(port->index());
+ if (human_name != "")
+ msg << " (" << human_name << ")";
}
}
- _status_bar->push(msg, STATUS_CONTEXT_HOVER);
+ if (value.is_valid()) {
+ msg << " = " << value;
+ }
+
+ _status_bar->pop(STATUS_CONTEXT_HOVER);
+ _status_bar->push(msg.str(), STATUS_CONTEXT_HOVER);
+}
+
+
+void
+PatchWindow::object_entered(ObjectModel* model)
+{
+ show_status(model);
}
diff --git a/src/gui/PatchWindow.hpp b/src/gui/PatchWindow.hpp
index 0d997ab7..82afa7ad 100644
--- a/src/gui/PatchWindow.hpp
+++ b/src/gui/PatchWindow.hpp
@@ -21,6 +21,7 @@
#include <gtkmm.h>
#include <libglademm/xml.h>
#include <libglademm.h>
+#include "raul/Atom.hpp"
#include "raul/SharedPtr.hpp"
#include "Window.hpp"
@@ -66,6 +67,8 @@ public:
Gtk::MenuItem* menu_view_control_window() { return _menu_view_control_window; }
+ void show_port_status(PortModel* model, const Raul::Atom& value);
+
protected:
void on_show();
void on_hide();
@@ -73,9 +76,9 @@ protected:
bool on_key_release_event(GdkEventKey* event);
private:
-
void patch_port_added(SharedPtr<PortModel> port);
void patch_port_removed(SharedPtr<PortModel> port);
+ void show_status(ObjectModel* model);
void object_entered(ObjectModel* model);
void object_left(ObjectModel* model);
void editable_changed(bool editable);
diff --git a/src/gui/Port.cpp b/src/gui/Port.cpp
index ba4e0482..91e64f3a 100644
--- a/src/gui/Port.cpp
+++ b/src/gui/Port.cpp
@@ -21,11 +21,13 @@
#include "flowcanvas/Module.hpp"
#include "client/PatchModel.hpp"
#include "client/PortModel.hpp"
-#include "Configuration.hpp"
#include "App.hpp"
+#include "Configuration.hpp"
+#include "GladeFactory.hpp"
+#include "PatchWindow.hpp"
#include "Port.hpp"
#include "PortMenu.hpp"
-#include "GladeFactory.hpp"
+#include "WindowFactory.hpp"
using namespace Ingen::Client;
using namespace std;
@@ -48,6 +50,7 @@ Port::Port(
flip ? (!pm->is_input()) : pm->is_input(),
App::instance().configuration()->get_port_color(pm.get()))
, _port_model(pm)
+ , _pressed(false)
, _flipped(flip)
{
assert(module);
@@ -65,21 +68,14 @@ Port::Port(
if (pm->type().is_control()) {
set_toggled(pm->is_toggle());
show_control();
-
- float min = 0.0f, max = 1.0f;
- boost::shared_ptr<NodeModel> parent = PtrCast<NodeModel>(pm->parent());
- if (parent)
- parent->port_value_range(pm, min, max);
-
- set_control_min(min);
- set_control_max(max);
-
pm->signal_property.connect(sigc::mem_fun(this, &Port::property_changed));
pm->signal_value_changed.connect(sigc::mem_fun(this, &Port::value_changed));
}
pm->signal_activity.connect(sigc::mem_fun(this, &Port::activity));
+ update_metadata();
+
value_changed(pm->value());
}
@@ -91,6 +87,24 @@ Port::~Port()
void
+Port::update_metadata()
+{
+ SharedPtr<PortModel> pm = _port_model.lock();
+ if (pm && pm->type().is_control()) {
+ boost::shared_ptr<NodeModel> parent = PtrCast<NodeModel>(pm->parent());
+ if (parent) {
+ float min = 0.0f;
+ float max = 1.0f;
+ parent->port_value_range(pm, min, max);
+ set_control_min(min);
+ set_control_max(max);
+ }
+ }
+}
+
+
+
+void
Port::create_menu()
{
PortMenu* menu = NULL;
@@ -112,13 +126,32 @@ Port::moved()
void
Port::value_changed(const Atom& value)
{
- if (value.type() == Atom::FLOAT)
+ if (_pressed)
+ return;
+ else if (value.type() == Atom::FLOAT)
FlowCanvas::Port::set_control(value.get_float());
else
cerr << "WARNING: Unknown port value type " << (unsigned)value.type() << endl;
}
+bool
+Port::on_event(GdkEvent* ev)
+{
+ switch (ev->type) {
+ case GDK_BUTTON_PRESS:
+ _pressed = true;
+ break;
+ case GDK_BUTTON_RELEASE:
+ _pressed = false;
+ default:
+ break;
+ }
+
+ return false;
+}
+
+
void
Port::activity()
{
@@ -132,6 +165,14 @@ Port::set_control(float value, bool signal)
if (signal) {
if (model()->type() == PortType::CONTROL) {
App::instance().engine()->set_port_value(model()->path(), Atom(value));
+ PatchWindow* pw = App::instance().window_factory()->patch_window(
+ PtrCast<PatchModel>(model()->parent()));
+ if (!pw)
+ pw = App::instance().window_factory()->patch_window(
+ PtrCast<PatchModel>(model()->parent()->parent()));
+ if (pw)
+ pw->show_port_status(model().get(), value);
+
} else if (model()->type() == PortType::EVENTS) {
App::instance().engine()->set_port_value(model()->path(),
Atom("<http://example.org/ev#BangEvent>", 0, NULL));
@@ -146,9 +187,11 @@ void
Port::property_changed(const URI& key, const Atom& value)
{
if (value.type() == Atom::FLOAT) {
- if ((key.str() == "lv2:minimum"))
+ if (key.str() == "ingen:value")
+ set_control(value.get_float(), false);
+ else if (key.str() == "lv2:minimum")
set_control_min(value.get_float());
- else if ((key.str() == "lv2:maximum"))
+ else if (key.str() == "lv2:maximum")
set_control_max(value.get_float());
} else if (value.type() == Atom::BOOL) {
if ((key.str() == "lv2:toggled"))
diff --git a/src/gui/Port.hpp b/src/gui/Port.hpp
index ec361a9f..2c79ec7c 100644
--- a/src/gui/Port.hpp
+++ b/src/gui/Port.hpp
@@ -51,6 +51,7 @@ public:
SharedPtr<PortModel> model() const { return _port_model.lock(); }
void create_menu();
+ void update_metadata();
virtual void set_control(float value, bool signal);
void value_changed(const Raul::Atom& value);
@@ -61,11 +62,13 @@ public:
private:
void property_changed(const Raul::URI& key, const Raul::Atom& value);
+ bool on_event(GdkEvent* ev);
void moved();
static ArtVpathDash* _dash;
WeakPtr<PortModel> _port_model;
+ bool _pressed;
bool _flipped;
};
diff --git a/src/gui/WindowFactory.cpp b/src/gui/WindowFactory.cpp
index b06ed449..91abccaf 100644
--- a/src/gui/WindowFactory.cpp
+++ b/src/gui/WindowFactory.cpp
@@ -116,6 +116,9 @@ WindowFactory::num_open_patch_windows()
PatchWindow*
WindowFactory::patch_window(SharedPtr<PatchModel> patch)
{
+ if (!patch)
+ return NULL;
+
PatchWindowMap::iterator w = _patch_windows.find(patch->path());
return (w == _patch_windows.end()) ? NULL : w->second;
diff --git a/src/serialisation/Serialiser.cpp b/src/serialisation/Serialiser.cpp
index 33c438e5..5dd9b045 100644
--- a/src/serialisation/Serialiser.cpp
+++ b/src/serialisation/Serialiser.cpp
@@ -420,7 +420,7 @@ Serialiser::serialise_port(const Port* port, const Redland::Node& port_id)
if (port->is_input() && port->type() == PortType::CONTROL)
_model->add_statement(port_id, "ingen:value",
- AtomRDF::atom_to_node(_model->world(), Atom(port->value())));
+ AtomRDF::atom_to_node(_model->world(), port->value()));
serialise_properties(port_id, port->properties());
}