diff options
author | David Robillard <d@drobilla.net> | 2008-11-27 22:52:58 +0000 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2008-11-27 22:52:58 +0000 |
commit | 23e753a92e21b76a24224551b6250f650df11957 (patch) | |
tree | a18b3a13660ab4f3b9e38ae8fda7e1a1fde53211 /src | |
parent | c58f17efff27f959147dfd231a8b059950d06e69 (diff) | |
download | ingen-23e753a92e21b76a24224551b6250f650df11957.tar.gz ingen-23e753a92e21b76a24224551b6250f650df11957.tar.bz2 ingen-23e753a92e21b76a24224551b6250f650df11957.zip |
Remove old learn response event junk.
git-svn-id: http://svn.drobilla.net/lad/trunk/ingen@1807 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src')
-rw-r--r-- | src/engine/MidiControlNode.cpp | 2 | ||||
-rw-r--r-- | src/engine/MidiControlNode.hpp | 5 | ||||
-rw-r--r-- | src/engine/events/MidiLearnEvent.cpp | 16 | ||||
-rw-r--r-- | src/engine/events/MidiLearnEvent.hpp | 42 |
4 files changed, 7 insertions, 58 deletions
diff --git a/src/engine/MidiControlNode.cpp b/src/engine/MidiControlNode.cpp index 0e907a8b..feae6799 100644 --- a/src/engine/MidiControlNode.cpp +++ b/src/engine/MidiControlNode.cpp @@ -104,13 +104,11 @@ MidiControlNode::control(ProcessContext& context, uchar control_num, uchar val, const Sample nval = (val / 127.0f); // normalized [0, 1] if (_learning) { - assert(_learn_event != NULL); _param_port->set_value(control_num); ((AudioBuffer*)_param_port->buffer(0))->set_value( (float)control_num, context.start(), context.end()); _param_port->broadcast_value(context, true); _learning = false; - _learn_event = NULL; } const Sample min_port_val = ((AudioBuffer*)_min_port->buffer(0))->value_at(0); diff --git a/src/engine/MidiControlNode.hpp b/src/engine/MidiControlNode.hpp index 2f0496a3..27319a7f 100644 --- a/src/engine/MidiControlNode.hpp +++ b/src/engine/MidiControlNode.hpp @@ -23,7 +23,6 @@ namespace Ingen { -class MidiLearnResponseEvent; class InputPort; class OutputPort; @@ -44,7 +43,7 @@ public: void control(ProcessContext& context, uchar control_num, uchar val, FrameTime time); - void learn(MidiLearnResponseEvent* ev) { _learning = true; _learn_event = ev; } + void learn() { _learning = true; } private: bool _learning; @@ -55,8 +54,6 @@ private: InputPort* _min_port; InputPort* _max_port; OutputPort* _audio_port; - - MidiLearnResponseEvent* _learn_event; }; diff --git a/src/engine/events/MidiLearnEvent.cpp b/src/engine/events/MidiLearnEvent.cpp index 68293cb7..b542eccd 100644 --- a/src/engine/events/MidiLearnEvent.cpp +++ b/src/engine/events/MidiLearnEvent.cpp @@ -27,24 +27,11 @@ namespace Ingen { -// MidiLearnResponseEvent - -void -MidiLearnResponseEvent::post_process() -{ - _engine.broadcaster()->send_port_value(_port_path, _value); -} - - - -// MidiLearnEvent - MidiLearnEvent::MidiLearnEvent(Engine& engine, SharedPtr<Responder> responder, SampleCount timestamp, const string& node_path) : QueuedEvent(engine, responder, timestamp) , _error(NO_ERROR) , _node_path(node_path) , _node(NULL) - , _response_event(NULL) { } @@ -53,7 +40,6 @@ void MidiLearnEvent::pre_process() { _node = _engine.engine_store()->find_node(_node_path); - _response_event = new MidiLearnResponseEvent(_engine, _node_path + "/Controller_Number", _time); QueuedEvent::pre_process(); } @@ -67,7 +53,7 @@ MidiLearnEvent::execute(ProcessContext& context) if (_node != NULL) { if (_node->plugin_impl()->type() == Plugin::Internal && _node->plugin_impl()->uri() == "http://drobilla.net/ns/ingen#control_node") { - ((MidiControlNode*)_node)->learn(_response_event); + ((MidiControlNode*)_node)->learn(); } else { std::cout << "NOT CAPABLE: " << _node->plugin_impl()->uri() << std::endl; _error = INVALID_NODE_TYPE; diff --git a/src/engine/events/MidiLearnEvent.hpp b/src/engine/events/MidiLearnEvent.hpp index 1dceb041..fca96307 100644 --- a/src/engine/events/MidiLearnEvent.hpp +++ b/src/engine/events/MidiLearnEvent.hpp @@ -22,7 +22,6 @@ #include "MidiControlNode.hpp" #include "types.hpp" #include <string> -using std::string; namespace Ingen { @@ -30,42 +29,14 @@ class NodeImpl; class ControlChangeEvent; -/** Response event for a MIDI learn. - * - * This is a trivial event that sends a control change in it's post_process - * method (used by MidiLearnEvent to notify clients when the learn happens) - */ -class MidiLearnResponseEvent : public Event -{ -public: - MidiLearnResponseEvent(Engine& engine, const string& port_path, SampleCount timestamp) - : Event(engine, SharedPtr<Responder>(), timestamp), - _port_path(port_path), - _value(0.0f) - {} - - void set_value(Sample val) { _value = val; } - void post_process(); - -private: - string _port_path; - Sample _value; -}; - - - -/** A MIDI learn event. - * - * This creates a MidiLearnResponseEvent and passes it to the learning node, which - * will push it to the post-processor once the learn happens in order to reply - * to the client with the new port (learned controller) value. +/** A MIDI learn event (used by control node to learn controller number). * * \ingroup engine */ class MidiLearnEvent : public QueuedEvent { public: - MidiLearnEvent(Engine& engine, SharedPtr<Responder> responder, SampleCount timestamp, const string& node_path); + MidiLearnEvent(Engine& engine, SharedPtr<Responder> responder, SampleCount timestamp, const std::string& node_path); void pre_process(); void execute(ProcessContext& context); @@ -77,12 +48,9 @@ private: INVALID_NODE_TYPE }; - ErrorType _error; - const string _node_path; - NodeImpl* _node; - - /// Event to respond with when learned - MidiLearnResponseEvent* _response_event; + ErrorType _error; + const std::string _node_path; + NodeImpl* _node; }; |