From 2c03f2abd3d3d98a81020438ca805acded39dbab Mon Sep 17 00:00:00 2001 From: David Robillard Date: Fri, 24 Jan 2014 04:47:33 +0000 Subject: Remove redundant and unnecessary properties from saved graphs and protocol. git-svn-id: http://svn.drobilla.net/lad/trunk/ingen@5321 a436a847-0d15-0410-975c-d299462d15a1 --- src/server/DuplexPort.cpp | 12 ++++++++++-- src/server/InputPort.cpp | 6 ------ src/server/LV2Block.cpp | 2 -- src/server/PortImpl.cpp | 9 ++++----- src/server/events/Delta.cpp | 12 ++++++++++-- 5 files changed, 24 insertions(+), 17 deletions(-) (limited to 'src/server') diff --git a/src/server/DuplexPort.cpp b/src/server/DuplexPort.cpp index 438d315c..256d45b1 100644 --- a/src/server/DuplexPort.cpp +++ b/src/server/DuplexPort.cpp @@ -42,8 +42,16 @@ DuplexPort::DuplexPort(BufferFactory& bufs, , OutputPort(bufs, parent, symbol, index, poly, type, buffer_type, value, buffer_size) , _is_output(is_output) { - set_property(bufs.uris().ingen_polyphonic, - bufs.forge().make(polyphonic)); + if (polyphonic) { + set_property(bufs.uris().ingen_polyphonic, bufs.forge().make(true)); + } + + // Set default control range + if (!is_output && (type == PortType::CONTROL || type == PortType::CV)) { + set_property(bufs.uris().lv2_minimum, bufs.forge().make(0.0f)); + set_property(bufs.uris().lv2_maximum, bufs.forge().make(1.0f)); + } + } DuplexPort::~DuplexPort() diff --git a/src/server/InputPort.cpp b/src/server/InputPort.cpp index f1be3b8f..cdf70575 100644 --- a/src/server/InputPort.cpp +++ b/src/server/InputPort.cpp @@ -53,12 +53,6 @@ InputPort::InputPort(BufferFactory& bufs, if (parent->graph_type() != Node::GraphType::GRAPH) { add_property(uris.rdf_type, uris.lv2_InputPort); } - - // Set default control range - if (type == PortType::CONTROL || type == PortType::CV) { - set_property(uris.lv2_minimum, bufs.forge().make(0.0f)); - set_property(uris.lv2_maximum, bufs.forge().make(1.0f)); - } } bool diff --git a/src/server/LV2Block.cpp b/src/server/LV2Block.cpp index 0525a2db..5e97bfe5 100644 --- a/src/server/LV2Block.cpp +++ b/src/server/LV2Block.cpp @@ -366,11 +366,9 @@ LV2Block::instantiate(BufferFactory& bufs) || port_type == PortType::CV)) { port->set_value(val); if (!isnan(min_values[j])) { - port->set_property(uris.lv2_minimum, forge.make(min_values[j])); port->set_minimum(forge.make(min_values[j])); } if (!isnan(max_values[j])) { - port->set_property(uris.lv2_maximum, forge.make(max_values[j])); port->set_maximum(forge.make(max_values[j])); } } diff --git a/src/server/PortImpl.cpp b/src/server/PortImpl.cpp index e4b3ad4d..aed67ec3 100644 --- a/src/server/PortImpl.cpp +++ b/src/server/PortImpl.cpp @@ -82,15 +82,14 @@ PortImpl::PortImpl(BufferFactory& bufs, set_type(type, buffer_type); - add_property(uris.rdf_type, bufs.forge().alloc_uri(type.uri())); set_property(uris.lv2_index, bufs.forge().make((int32_t)index)); if ((type == PortType::CONTROL || type == PortType::CV) && value.is_valid()) { set_property(uris.ingen_value, value); } - if (type == PortType::ATOM) { - add_property(uris.atom_bufferType, - bufs.forge().make_urid(buffer_type)); - } + // if (type == PortType::ATOM) { + // set_property(uris.atom_bufferType, + // bufs.forge().make_urid(buffer_type)); + // } } PortImpl::~PortImpl() diff --git a/src/server/events/Delta.cpp b/src/server/events/Delta.cpp index 072d0ba3..0c134ede 100644 --- a/src/server/events/Delta.cpp +++ b/src/server/events/Delta.cpp @@ -148,9 +148,10 @@ Delta::pre_process() NodeImpl* obj = dynamic_cast(_object); + // Remove any properties removed in delta for (const auto& r : _remove) { - const Raul::URI& key = r.first; - const Atom& value = r.second; + const Raul::URI& key = r.first; + const Atom& value = r.second; if (key == uris.midi_binding && value == uris.patch_wildcard) { PortImpl* port = dynamic_cast(_object); if (port) @@ -161,6 +162,13 @@ Delta::pre_process() } } + // Remove all added properties if this is a put + if (_create && _object) { + for (const auto& p : _properties) { + _object->remove_property(p.first, p.second); + } + } + for (const auto& p : _properties) { const Raul::URI& key = p.first; const Resource::Property& value = p.second; -- cgit v1.2.1