summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2012-11-18 18:46:53 +0000
committerDavid Robillard <d@drobilla.net>2012-11-18 18:46:53 +0000
commitd358cae57b7233bf6b781686979fc4dea4d090b3 (patch)
treee60f45f73892fd62fea6caef507567c57722b5b9 /src
parentc8745c6975c6173d08957c4a16bf8b95831ec05a (diff)
downloadingen-d358cae57b7233bf6b781686979fc4dea4d090b3.tar.gz
ingen-d358cae57b7233bf6b781686979fc4dea4d090b3.tar.bz2
ingen-d358cae57b7233bf6b781686979fc4dea4d090b3.zip
Fix learn for Trigger and Internal nodes.
Set value property for inputs when a notification is sent so model is consistent (and learned values are saved correctly). Don't redundantly store value atom in PortModel, just use property directly. Fix incorrect use of lv2:integer as a predicate. git-svn-id: http://svn.drobilla.net/lad/trunk/ingen@4835 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src')
-rw-r--r--src/client/PortModel.cpp17
-rw-r--r--src/serialisation/Serialiser.cpp4
-rw-r--r--src/server/Context.cpp8
-rw-r--r--src/server/events/Delta.cpp11
-rw-r--r--src/server/internals/Controller.cpp2
-rw-r--r--src/server/internals/Trigger.cpp6
6 files changed, 31 insertions, 17 deletions
diff --git a/src/client/PortModel.cpp b/src/client/PortModel.cpp
index 54db0ca1..fdef852d 100644
--- a/src/client/PortModel.cpp
+++ b/src/client/PortModel.cpp
@@ -24,14 +24,16 @@ void
PortModel::on_property(const Raul::URI& uri, const Raul::Atom& value)
{
if (uri == _uris.ingen_activity) {
+ // Don't store activity, it is transient
signal_activity().emit(value);
return;
- } else {
- if (uri == _uris.ingen_value) {
- this->value(value);
- }
}
+
ObjectModel::on_property(uri, value);
+
+ if (uri == _uris.ingen_value) {
+ signal_value_changed().emit(value);
+ }
}
bool
@@ -51,16 +53,15 @@ PortModel::port_property(const Raul::URI& uri) const
void
PortModel::set(SharedPtr<ObjectModel> model)
{
+ ObjectModel::set(model);
+
SharedPtr<PortModel> port = PtrCast<PortModel>(model);
if (port) {
_index = port->_index;
_direction = port->_direction;
- _current_val = port->_current_val;
_connections = port->_connections;
- _signal_value_changed.emit(_current_val);
+ _signal_value_changed.emit(get_property(_uris.ingen_value));
}
-
- ObjectModel::set(model);
}
} // namespace Client
diff --git a/src/serialisation/Serialiser.cpp b/src/serialisation/Serialiser.cpp
index ec8ca9d2..b865ec6c 100644
--- a/src/serialisation/Serialiser.cpp
+++ b/src/serialisation/Serialiser.cpp
@@ -440,8 +440,8 @@ Serialiser::Impl::serialise_block(SharedPtr<const Node> block,
serialise_properties(block_id, props);
for (uint32_t i = 0; i < block->num_ports(); ++i) {
- Node* const p = block->port(i);
- const Sord::Node port_id = path_rdf_node(p->path());
+ Node* const p = block->port(i);
+ const Sord::Node port_id = path_rdf_node(p->path());
serialise_port(p, Resource::EXTERNAL, port_id);
_model->add_statement(block_id,
Sord::URI(_model->world(), uris.lv2_port),
diff --git a/src/server/Context.cpp b/src/server/Context.cpp
index 20d78c0e..1be69fe4 100644
--- a/src/server/Context.cpp
+++ b/src/server/Context.cpp
@@ -18,9 +18,10 @@
#include "ingen/Log.hpp"
#include "ingen/URIMap.hpp"
+#include "Broadcaster.hpp"
+#include "BufferFactory.hpp"
#include "Context.hpp"
#include "Engine.hpp"
-#include "Broadcaster.hpp"
#include "PortImpl.hpp"
namespace Ingen {
@@ -78,6 +79,7 @@ Context::notify(LV2_URID key,
void
Context::emit_notifications(FrameTime end)
{
+ const URIs& uris = _engine.buffer_factory()->uris();
const uint32_t read_space = _event_sink.read_space();
Notification note;
for (uint32_t i = 0; i < read_space; i += sizeof(note)) {
@@ -94,6 +96,10 @@ Context::emit_notifications(FrameTime end)
if (key) {
_engine.broadcaster()->set_property(
note.port->uri(), Raul::URI(key), value);
+ if (note.port->is_input() && note.key == uris.ingen_value) {
+ // FIXME: not thread safe
+ note.port->set_property(uris.ingen_value, value);
+ }
} else {
_engine.log().error("Error unmapping notification key URI\n");
}
diff --git a/src/server/events/Delta.cpp b/src/server/events/Delta.cpp
index 6c935ce2..1c823cdd 100644
--- a/src/server/events/Delta.cpp
+++ b/src/server/events/Delta.cpp
@@ -166,9 +166,12 @@ Delta::pre_process()
SpecialType op = NONE;
if (obj) {
Resource& resource = *obj;
- resource.add_property(key, value, value.context());
+ if (value != uris.wildcard) {
+ resource.add_property(key, value, value.context());
+ }
- PortImpl* port = dynamic_cast<PortImpl*>(_object);
+ BlockImpl* block = NULL;
+ PortImpl* port = dynamic_cast<PortImpl*>(_object);
if (port) {
if (key == uris.ingen_broadcast) {
if (value.type() == uris.forge.Bool) {
@@ -194,6 +197,10 @@ Delta::pre_process()
_status = BAD_OBJECT_TYPE;
}
}
+ } else if ((block = dynamic_cast<BlockImpl*>(_object))) {
+ if (key == uris.ingen_controlBinding && value == uris.wildcard) {
+ op = CONTROL_BINDING; // Internal block learn
+ }
} else if ((_graph = dynamic_cast<GraphImpl*>(_object))) {
if (key == uris.ingen_enabled) {
if (value.type() == uris.forge.Bool) {
diff --git a/src/server/internals/Controller.cpp b/src/server/internals/Controller.cpp
index f38545d3..e65319a0 100644
--- a/src/server/internals/Controller.cpp
+++ b/src/server/internals/Controller.cpp
@@ -62,7 +62,7 @@ ControllerNode::ControllerNode(InternalPlugin* plugin,
PortType::CONTROL, 0, bufs.forge().make(0.0f));
_param_port->set_property(uris.lv2_minimum, bufs.forge().make(0.0f));
_param_port->set_property(uris.lv2_maximum, bufs.forge().make(127.0f));
- _param_port->set_property(uris.lv2_integer, bufs.forge().make(true));
+ _param_port->set_property(uris.lv2_portProperty, uris.lv2_integer);
_param_port->set_property(uris.lv2_name, bufs.forge().alloc("Controller"));
_ports->at(1) = _param_port;
diff --git a/src/server/internals/Trigger.cpp b/src/server/internals/Trigger.cpp
index cdc09a98..41e1800f 100644
--- a/src/server/internals/Trigger.cpp
+++ b/src/server/internals/Trigger.cpp
@@ -62,7 +62,7 @@ TriggerNode::TriggerNode(InternalPlugin* plugin,
PortType::CONTROL, 0, bufs.forge().make(60.0f));
_note_port->set_property(uris.lv2_minimum, bufs.forge().make(0.0f));
_note_port->set_property(uris.lv2_maximum, bufs.forge().make(127.0f));
- _note_port->set_property(uris.lv2_integer, bufs.forge().make(true));
+ _note_port->set_property(uris.lv2_portProperty, uris.lv2_integer);
_note_port->set_property(uris.lv2_name, bufs.forge().alloc("Note"));
_ports->at(1) = _note_port;
@@ -131,8 +131,8 @@ TriggerNode::note_on(ProcessContext& context, uint8_t note_num, uint8_t velocity
if (_learning) {
// FIXME: not thread safe
- _note_port->set_value(context.engine().world()->forge().make(note_num));
- _note_port->set_control_value(context, time, note_num);
+ _note_port->set_value(context.engine().world()->forge().make((float)note_num));
+ _note_port->set_control_value(context, time, (float)note_num);
_note_port->broadcast_value(context, true);
_learning = false;
}