summaryrefslogtreecommitdiffstats
path: root/src/server/events
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2011-09-15 07:17:10 +0000
committerDavid Robillard <d@drobilla.net>2011-09-15 07:17:10 +0000
commitc7f671ff5bf9cf2559697bbc90cf3cee97cc7975 (patch)
treec9448a87cce9bfc957d32bc3b1b404cb7f0c6984 /src/server/events
parentba99f4ca92ea2e6cf8de51341489b0689223e1fc (diff)
downloadingen-c7f671ff5bf9cf2559697bbc90cf3cee97cc7975.tar.gz
ingen-c7f671ff5bf9cf2559697bbc90cf3cee97cc7975.tar.bz2
ingen-c7f671ff5bf9cf2559697bbc90cf3cee97cc7975.zip
Fix control bindings (MIDI learn).
git-svn-id: http://svn.drobilla.net/lad/trunk/ingen@3464 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src/server/events')
-rw-r--r--src/server/events/CreatePort.cpp1
-rw-r--r--src/server/events/SetMetadata.cpp12
-rw-r--r--src/server/events/SetMetadata.hpp7
-rw-r--r--src/server/events/SetPortValue.cpp4
-rw-r--r--src/server/events/SetPortValue.hpp11
5 files changed, 27 insertions, 8 deletions
diff --git a/src/server/events/CreatePort.cpp b/src/server/events/CreatePort.cpp
index ba46a35d..4541892b 100644
--- a/src/server/events/CreatePort.cpp
+++ b/src/server/events/CreatePort.cpp
@@ -148,7 +148,6 @@ CreatePort::execute(ProcessContext& context)
if (_patch_port) {
_engine.maid()->push(_patch->external_ports());
_patch->external_ports(_ports_array);
- _engine.control_bindings()->port_binding_changed(context, _patch_port);
}
if (_driver_port) {
diff --git a/src/server/events/SetMetadata.cpp b/src/server/events/SetMetadata.cpp
index 23109a2f..b01e17cb 100644
--- a/src/server/events/SetMetadata.cpp
+++ b/src/server/events/SetMetadata.cpp
@@ -268,6 +268,8 @@ SetMetadata::execute(ProcessContext& context)
return;
}
+ const Ingen::Shared::LV2URIMap& uris = *_engine.world()->uris().get();
+
if (_create_event) {
_create_event->execute(context);
}
@@ -281,6 +283,7 @@ SetMetadata::execute(ProcessContext& context)
std::vector<SpecialType>::const_iterator t = _types.begin();
for (Properties::const_iterator p = _properties.begin(); p != _properties.end(); ++p, ++t) {
+ const Raul::Atom& key = p->first;
const Raul::Atom& value = p->second;
switch (*t) {
case ENABLE_BROADCAST:
@@ -317,7 +320,7 @@ SetMetadata::execute(ProcessContext& context)
break;
case CONTROL_BINDING:
if (port) {
- _engine.control_bindings()->port_binding_changed(context, port);
+ _engine.control_bindings()->port_binding_changed(context, port, value);
} else if (node) {
if (node->plugin_impl()->type() == Plugin::Internal) {
node->learn();
@@ -325,6 +328,13 @@ SetMetadata::execute(ProcessContext& context)
}
break;
case NONE:
+ if (port) {
+ if (key == uris.lv2_minimum) {
+ port->set_minimum(value);
+ } else if (key == uris.lv2_maximum) {
+ port->set_maximum(value);
+ }
+ }
break;
}
}
diff --git a/src/server/events/SetMetadata.hpp b/src/server/events/SetMetadata.hpp
index 59856730..6e2a93a2 100644
--- a/src/server/events/SetMetadata.hpp
+++ b/src/server/events/SetMetadata.hpp
@@ -18,10 +18,14 @@
#ifndef INGEN_EVENTS_SETMETADATA_HPP
#define INGEN_EVENTS_SETMETADATA_HPP
+
#include <vector>
+
#include "raul/URI.hpp"
-#include "shared/ResourceImpl.hpp"
+
+#include "ControlBindings.hpp"
#include "QueuedEvent.hpp"
+#include "shared/ResourceImpl.hpp"
namespace Ingen {
namespace Server {
@@ -113,6 +117,7 @@ private:
std::string _error_predicate;
bool _create;
Resource::Graph _context;
+ ControlBindings::Key _binding;
SharedPtr<ControlBindings::Bindings> _old_bindings;
};
diff --git a/src/server/events/SetPortValue.cpp b/src/server/events/SetPortValue.cpp
index 4af14d44..e5877d47 100644
--- a/src/server/events/SetPortValue.cpp
+++ b/src/server/events/SetPortValue.cpp
@@ -101,6 +101,8 @@ SetPortValue::pre_process()
_port->set_property(_engine.world()->uris()->ingen_value, _value);
}
+ _binding = _engine.control_bindings()->port_binding(_port);
+
QueuedEvent::pre_process();
}
@@ -114,7 +116,7 @@ SetPortValue::execute(ProcessContext& context)
return;
apply(context);
- _engine.control_bindings()->port_value_changed(context, _port);
+ _engine.control_bindings()->port_value_changed(context, _port, _binding, _value);
}
void
diff --git a/src/server/events/SetPortValue.hpp b/src/server/events/SetPortValue.hpp
index 6f3cde87..13d77225 100644
--- a/src/server/events/SetPortValue.hpp
+++ b/src/server/events/SetPortValue.hpp
@@ -19,6 +19,8 @@
#define INGEN_EVENTS_SETPORTVALUE_HPP
#include "raul/Atom.hpp"
+
+#include "ControlBindings.hpp"
#include "QueuedEvent.hpp"
#include "types.hpp"
@@ -70,10 +72,11 @@ private:
void apply(Context& context);
- bool _queued;
- const Raul::Path _port_path;
- const Raul::Atom _value;
- PortImpl* _port;
+ bool _queued;
+ const Raul::Path _port_path;
+ const Raul::Atom _value;
+ PortImpl* _port;
+ ControlBindings::Key _binding;
};
} // namespace Server