summaryrefslogtreecommitdiffstats
path: root/src/engine/events
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2010-01-29 01:43:54 +0000
committerDavid Robillard <d@drobilla.net>2010-01-29 01:43:54 +0000
commitd5a514148bec58cd7e97d032259362b2e19c0e95 (patch)
tree64ea4dd182a8918b47a6d5f391e2cd097aebb526 /src/engine/events
parent36039b294ee823ceb2c239129defc5eafa110247 (diff)
downloadingen-d5a514148bec58cd7e97d032259362b2e19c0e95.tar.gz
ingen-d5a514148bec58cd7e97d032259362b2e19c0e95.tar.bz2
ingen-d5a514148bec58cd7e97d032259362b2e19c0e95.zip
Magic MIDI binding via special ingen_control port.
Always set lv2:minimum and lv2:maximum properties for control ports so they show up in properties dialog (and can be used for MIDI binding). git-svn-id: http://svn.drobilla.net/lad/trunk/ingen@2391 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src/engine/events')
-rw-r--r--src/engine/events/CreatePort.cpp3
-rw-r--r--src/engine/events/CreatePort.hpp1
-rw-r--r--src/engine/events/Learn.cpp (renamed from src/engine/events/MidiLearn.cpp)54
-rw-r--r--src/engine/events/Learn.hpp (renamed from src/engine/events/MidiLearn.hpp)9
-rw-r--r--src/engine/events/SendPortValue.cpp4
-rw-r--r--src/engine/events/SetMetadata.cpp2
6 files changed, 44 insertions, 29 deletions
diff --git a/src/engine/events/CreatePort.cpp b/src/engine/events/CreatePort.cpp
index 7845994a..73ba4b83 100644
--- a/src/engine/events/CreatePort.cpp
+++ b/src/engine/events/CreatePort.cpp
@@ -143,6 +143,9 @@ CreatePort::execute(ProcessContext& context)
if (_driver_port) {
_engine.driver()->add_port(_driver_port);
}
+
+ if (_source)
+ _source->unblock();
}
diff --git a/src/engine/events/CreatePort.hpp b/src/engine/events/CreatePort.hpp
index c7ddb56a..adda30bb 100644
--- a/src/engine/events/CreatePort.hpp
+++ b/src/engine/events/CreatePort.hpp
@@ -55,7 +55,6 @@ public:
void post_process();
private:
-
enum ErrorType {
NO_ERROR,
UNKNOWN_TYPE,
diff --git a/src/engine/events/MidiLearn.cpp b/src/engine/events/Learn.cpp
index b5c25102..e700ab79 100644
--- a/src/engine/events/MidiLearn.cpp
+++ b/src/engine/events/Learn.cpp
@@ -15,14 +15,16 @@
* 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
-#include "events/MidiLearn.hpp"
-#include "Responder.hpp"
+#include "events/Learn.hpp"
+#include "ClientBroadcaster.hpp"
+#include "ControlBindings.hpp"
#include "Engine.hpp"
#include "EngineStore.hpp"
#include "NodeImpl.hpp"
-#include "internals/Controller.hpp"
-#include "ClientBroadcaster.hpp"
#include "PluginImpl.hpp"
+#include "PortImpl.hpp"
+#include "Responder.hpp"
+#include "internals/Controller.hpp"
using namespace std;
@@ -30,50 +32,62 @@ namespace Ingen {
namespace Events {
-MidiLearn::MidiLearn(Engine& engine, SharedPtr<Responder> responder, SampleCount timestamp, const Raul::Path& node_path)
+Learn::Learn(Engine& engine, SharedPtr<Responder> responder, SampleCount timestamp, const Raul::Path& path)
: QueuedEvent(engine, responder, timestamp)
, _error(NO_ERROR)
- , _node_path(node_path)
- , _node(NULL)
+ , _path(path)
+ , _object(NULL)
+ , _done(false)
{
}
void
-MidiLearn::pre_process()
+Learn::pre_process()
{
- _node = _engine.engine_store()->find_node(_node_path);
+ _object = _engine.engine_store()->find_object(_path);
+
+ PortImpl* port = dynamic_cast<PortImpl*>(_object);
+ if (port) {
+ _done = true;
+ if (port->type() == Shared::PortType::CONTROL)
+ _engine.control_bindings()->learn(port);
+ }
QueuedEvent::pre_process();
}
void
-MidiLearn::execute(ProcessContext& context)
+Learn::execute(ProcessContext& context)
{
QueuedEvent::execute(context);
- if (_node != NULL) {
- if (_node->plugin_impl()->type() == Shared::Plugin::Internal) {
- ((NodeBase*)_node)->learn();
- } else {
- _error = INVALID_NODE_TYPE;
- }
+ if (_done || !_object)
+ return;
+
+ NodeImpl* node = dynamic_cast<NodeImpl*>(_object);
+ if (node) {
+ if (node->plugin_impl()->type() == Shared::Plugin::Internal) {
+ ((NodeBase*)_object)->learn();
+ } else {
+ _error = INVALID_NODE_TYPE;
+ }
}
}
void
-MidiLearn::post_process()
+Learn::post_process()
{
if (_error == NO_ERROR) {
_responder->respond_ok();
- } else if (_node == NULL) {
+ } else if (_object == NULL) {
string msg = "Did not find node '";
- msg.append(_node_path.str()).append("' for MIDI learn.");
+ msg.append(_path.str()).append("' for learn.");
_responder->respond_error(msg);
} else {
- const string msg = string("Node '") + _node_path.str() + "' is not capable of MIDI learn.";
+ const string msg = string("Object '") + _path.str() + "' is not capable of learning.";
_responder->respond_error(msg);
}
}
diff --git a/src/engine/events/MidiLearn.hpp b/src/engine/events/Learn.hpp
index 5835cf6a..8eb61c5f 100644
--- a/src/engine/events/MidiLearn.hpp
+++ b/src/engine/events/Learn.hpp
@@ -33,10 +33,10 @@ namespace Events {
*
* \ingroup engine
*/
-class MidiLearn : public QueuedEvent
+class Learn : public QueuedEvent
{
public:
- MidiLearn(Engine& engine, SharedPtr<Responder> responder, SampleCount timestamp, const Raul::Path& node_path);
+ Learn(Engine& engine, SharedPtr<Responder> responder, SampleCount timestamp, const Raul::Path& path);
void pre_process();
void execute(ProcessContext& context);
@@ -49,8 +49,9 @@ private:
};
ErrorType _error;
- const Raul::Path _node_path;
- NodeImpl* _node;
+ const Raul::Path _path;
+ GraphObjectImpl* _object;
+ bool _done;
};
diff --git a/src/engine/events/SendPortValue.cpp b/src/engine/events/SendPortValue.cpp
index 4088568f..1052033b 100644
--- a/src/engine/events/SendPortValue.cpp
+++ b/src/engine/events/SendPortValue.cpp
@@ -30,12 +30,10 @@ namespace Events {
void
SendPortValue::post_process()
{
- // FIXME...
-
if (_omni) {
_engine.broadcaster()->set_port_value(_port->path(), _value);
} else {
- _engine.broadcaster()->set_port_value(_port->path(), _value);
+ _engine.broadcaster()->set_voice_value(_port->path(), _voice_num, _value);
}
}
diff --git a/src/engine/events/SetMetadata.cpp b/src/engine/events/SetMetadata.cpp
index 5669b63d..ae69aecf 100644
--- a/src/engine/events/SetMetadata.cpp
+++ b/src/engine/events/SetMetadata.cpp
@@ -203,7 +203,7 @@ SetMetadata::execute(ProcessContext& context)
if (_create_event) {
QueuedEvent::execute(context);
_create_event->execute(context);
- if (_blocking)
+ if (_blocking && _source)
_source->unblock();
return;
}