diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/libs/engine/Makefile.am | 14 | ||||
-rw-r--r-- | src/libs/engine/QueuedEngineInterface.cpp | 6 | ||||
-rw-r--r-- | src/libs/engine/events.hpp | 7 | ||||
-rw-r--r-- | src/libs/engine/events/CreateNodeEvent.cpp (renamed from src/libs/engine/events/AddNodeEvent.cpp) | 12 | ||||
-rw-r--r-- | src/libs/engine/events/CreateNodeEvent.hpp (renamed from src/libs/engine/events/AddNodeEvent.hpp) | 36 | ||||
-rw-r--r-- | src/libs/engine/events/CreatePortEvent.cpp (renamed from src/libs/engine/events/AddPortEvent.cpp) | 10 | ||||
-rw-r--r-- | src/libs/engine/events/CreatePortEvent.hpp (renamed from src/libs/engine/events/AddPortEvent.hpp) | 10 | ||||
-rw-r--r-- | src/libs/engine/events/Makefile.am | 14 | ||||
-rw-r--r-- | src/libs/engine/events/NoteEvent.cpp (renamed from src/libs/engine/events/NoteOnEvent.cpp) | 44 | ||||
-rw-r--r-- | src/libs/engine/events/NoteEvent.hpp (renamed from src/libs/engine/events/NoteOnEvent.hpp) | 35 | ||||
-rw-r--r-- | src/libs/engine/events/NoteOffEvent.cpp | 83 | ||||
-rw-r--r-- | src/libs/engine/events/NoteOffEvent.hpp | 53 |
12 files changed, 102 insertions, 222 deletions
diff --git a/src/libs/engine/Makefile.am b/src/libs/engine/Makefile.am index 9aa8be9a..59835dd2 100644 --- a/src/libs/engine/Makefile.am +++ b/src/libs/engine/Makefile.am @@ -104,18 +104,18 @@ libingen_engine_la_SOURCES = \ engine.cpp \ engine.hpp \ events.hpp \ - events/AddNodeEvent.cpp \ - events/AddNodeEvent.hpp \ - events/AddPortEvent.cpp \ - events/AddPortEvent.hpp \ events/AllNotesOffEvent.cpp \ events/AllNotesOffEvent.hpp \ events/ClearPatchEvent.cpp \ events/ClearPatchEvent.hpp \ events/ConnectionEvent.cpp \ events/ConnectionEvent.hpp \ + events/CreateNodeEvent.cpp \ + events/CreateNodeEvent.hpp \ events/CreatePatchEvent.cpp \ events/CreatePatchEvent.hpp \ + events/CreatePortEvent.cpp \ + events/CreatePortEvent.hpp \ events/DeactivateEvent.cpp \ events/DeactivateEvent.hpp \ events/DestroyEvent.cpp \ @@ -134,10 +134,8 @@ libingen_engine_la_SOURCES = \ events/LoadPluginsEvent.hpp \ events/MidiLearnEvent.cpp \ events/MidiLearnEvent.hpp \ - events/NoteOffEvent.cpp \ - events/NoteOffEvent.hpp \ - events/NoteOnEvent.cpp \ - events/NoteOnEvent.hpp \ + events/NoteEvent.cpp \ + events/NoteEvent.hpp \ events/PingQueuedEvent.hpp \ events/RegisterClientEvent.cpp \ events/RegisterClientEvent.hpp \ diff --git a/src/libs/engine/QueuedEngineInterface.cpp b/src/libs/engine/QueuedEngineInterface.cpp index 4e138c57..b7d18bde 100644 --- a/src/libs/engine/QueuedEngineInterface.cpp +++ b/src/libs/engine/QueuedEngineInterface.cpp @@ -132,7 +132,7 @@ void QueuedEngineInterface::create_port(const string& path, const string& data_type, bool direction) { - push_queued(new AddPortEvent(_engine, _responder, now(), path, data_type, direction, this)); + push_queued(new CreatePortEvent(_engine, _responder, now(), path, data_type, direction, this)); } @@ -141,7 +141,7 @@ QueuedEngineInterface::create_node(const string& path, const string& plugin_uri, bool polyphonic) { - push_queued(new AddNodeEvent(_engine, _responder, now(), + push_queued(new CreateNodeEvent(_engine, _responder, now(), path, plugin_uri, polyphonic)); } @@ -153,7 +153,7 @@ QueuedEngineInterface::create_node(const string& path, const string& plugin_label, bool polyphonic) { - push_queued(new AddNodeEvent(_engine, _responder, now(), + push_queued(new CreateNodeEvent(_engine, _responder, now(), path, plugin_type, plugin_lib, plugin_label, polyphonic)); } diff --git a/src/libs/engine/events.hpp b/src/libs/engine/events.hpp index 82c948b2..7f87888d 100644 --- a/src/libs/engine/events.hpp +++ b/src/libs/engine/events.hpp @@ -20,12 +20,12 @@ #include CONFIG_H_PATH -#include "AddNodeEvent.hpp" -#include "AddPortEvent.hpp" #include "AllNotesOffEvent.hpp" #include "ClearPatchEvent.hpp" #include "ConnectionEvent.hpp" +#include "CreateNodeEvent.hpp" #include "CreatePatchEvent.hpp" +#include "CreatePortEvent.hpp" #include "DeactivateEvent.hpp" #include "DestroyEvent.hpp" #include "DisconnectNodeEvent.hpp" @@ -34,8 +34,7 @@ #include "EnablePortBroadcastingEvent.hpp" #include "LoadPluginsEvent.hpp" #include "MidiLearnEvent.hpp" -#include "NoteOffEvent.hpp" -#include "NoteOnEvent.hpp" +#include "NoteEvent.hpp" #include "PingQueuedEvent.hpp" #include "RegisterClientEvent.hpp" #include "RenameEvent.hpp" diff --git a/src/libs/engine/events/AddNodeEvent.cpp b/src/libs/engine/events/CreateNodeEvent.cpp index f121c50e..65296de6 100644 --- a/src/libs/engine/events/AddNodeEvent.cpp +++ b/src/libs/engine/events/CreateNodeEvent.cpp @@ -18,7 +18,7 @@ #include <raul/Maid.hpp> #include <raul/Path.hpp> #include <raul/Path.hpp> -#include "AddNodeEvent.hpp" +#include "CreateNodeEvent.hpp" #include "Responder.hpp" #include "Patch.hpp" #include "Node.hpp" @@ -34,7 +34,7 @@ namespace Ingen { -AddNodeEvent::AddNodeEvent(Engine& engine, SharedPtr<Responder> responder, SampleCount timestamp, const string& path, +CreateNodeEvent::CreateNodeEvent(Engine& engine, SharedPtr<Responder> responder, SampleCount timestamp, const string& path, const string& plugin_uri, bool poly) : QueuedEvent(engine, responder, timestamp), _path(path), @@ -52,7 +52,7 @@ AddNodeEvent::AddNodeEvent(Engine& engine, SharedPtr<Responder> responder, Sampl * * Do not use. */ -AddNodeEvent::AddNodeEvent(Engine& engine, SharedPtr<Responder> responder, SampleCount timestamp, const string& path, +CreateNodeEvent::CreateNodeEvent(Engine& engine, SharedPtr<Responder> responder, SampleCount timestamp, const string& path, const string& plugin_type, const string& plugin_lib, const string& plugin_label, bool poly) : QueuedEvent(engine, responder, timestamp), _path(path), @@ -69,7 +69,7 @@ AddNodeEvent::AddNodeEvent(Engine& engine, SharedPtr<Responder> responder, Sampl void -AddNodeEvent::pre_process() +CreateNodeEvent::pre_process() { if (_engine.object_store()->find_object(_path) != NULL) { _node_already_exists = true; @@ -107,7 +107,7 @@ AddNodeEvent::pre_process() void -AddNodeEvent::execute(ProcessContext& context) +CreateNodeEvent::execute(ProcessContext& context) { QueuedEvent::execute(context); @@ -120,7 +120,7 @@ AddNodeEvent::execute(ProcessContext& context) void -AddNodeEvent::post_process() +CreateNodeEvent::post_process() { string msg; if (_node_already_exists) { diff --git a/src/libs/engine/events/AddNodeEvent.hpp b/src/libs/engine/events/CreateNodeEvent.hpp index ebee44b4..73cbcc02 100644 --- a/src/libs/engine/events/AddNodeEvent.hpp +++ b/src/libs/engine/events/CreateNodeEvent.hpp @@ -15,8 +15,8 @@ * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ -#ifndef ADDNODEEVENT_H -#define ADDNODEEVENT_H +#ifndef CREATENODEEVENT_H +#define CREATENODEEVENT_H #include "QueuedEvent.hpp" #include <raul/Path.hpp> @@ -38,25 +38,25 @@ class CompiledPatch; * * \ingroup engine */ -class AddNodeEvent : public QueuedEvent +class CreateNodeEvent : public QueuedEvent { public: - AddNodeEvent(Engine& engine, - SharedPtr<Responder> responder, - SampleCount timestamp, - const string& node_path, - const string& plugin_uri, - bool poly); + CreateNodeEvent(Engine& engine, + SharedPtr<Responder> responder, + SampleCount timestamp, + const string& node_path, + const string& plugin_uri, + bool poly); // DEPRECATED - AddNodeEvent(Engine& engine, - SharedPtr<Responder> responder, - SampleCount timestamp, - const string& node_path, - const string& plugin_type, - const string& lib_name, - const string& plugin_label, - bool poly); + CreateNodeEvent(Engine& engine, + SharedPtr<Responder> responder, + SampleCount timestamp, + const string& node_path, + const string& plugin_type, + const string& lib_name, + const string& plugin_label, + bool poly); void pre_process(); void execute(ProcessContext& context); @@ -79,4 +79,4 @@ private: } // namespace Ingen -#endif // ADDNODEEVENT_H +#endif // CREATENODEEVENT_H diff --git a/src/libs/engine/events/AddPortEvent.cpp b/src/libs/engine/events/CreatePortEvent.cpp index 6aeb7f0f..b8bc75e6 100644 --- a/src/libs/engine/events/AddPortEvent.cpp +++ b/src/libs/engine/events/CreatePortEvent.cpp @@ -20,7 +20,7 @@ #include <raul/List.hpp> #include <raul/Maid.hpp> #include "Responder.hpp" -#include "AddPortEvent.hpp" +#include "CreatePortEvent.hpp" #include "Patch.hpp" #include "Tree.hpp" #include "Plugin.hpp" @@ -38,7 +38,7 @@ namespace Ingen { -AddPortEvent::AddPortEvent(Engine& engine, +CreatePortEvent::CreatePortEvent(Engine& engine, SharedPtr<Responder> responder, SampleCount timestamp, const string& path, @@ -73,7 +73,7 @@ AddPortEvent::AddPortEvent(Engine& engine, void -AddPortEvent::pre_process() +CreatePortEvent::pre_process() { if (_engine.object_store()->find_object(_path) != NULL) { QueuedEvent::pre_process(); @@ -133,7 +133,7 @@ AddPortEvent::pre_process() void -AddPortEvent::execute(ProcessContext& context) +CreatePortEvent::execute(ProcessContext& context) { QueuedEvent::execute(context); @@ -159,7 +159,7 @@ AddPortEvent::execute(ProcessContext& context) void -AddPortEvent::post_process() +CreatePortEvent::post_process() { if (!_patch_port) { const string msg = string("Could not create port - ").append(_path); diff --git a/src/libs/engine/events/AddPortEvent.hpp b/src/libs/engine/events/CreatePortEvent.hpp index f430d50c..adae4892 100644 --- a/src/libs/engine/events/AddPortEvent.hpp +++ b/src/libs/engine/events/CreatePortEvent.hpp @@ -15,8 +15,8 @@ * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ -#ifndef ADDPORTEVENT_H -#define ADDPORTEVENT_H +#ifndef CREATEPORTEVENT_H +#define CREATEPORTEVENT_H #include "QueuedEvent.hpp" #include <raul/Path.hpp> @@ -39,10 +39,10 @@ class DriverPort; * * \ingroup engine */ -class AddPortEvent : public QueuedEvent +class CreatePortEvent : public QueuedEvent { public: - AddPortEvent(Engine& engine, SharedPtr<Responder> responder, SampleCount timestamp, const string& path, const string& type, bool is_output, QueuedEventSource* source); + CreatePortEvent(Engine& engine, SharedPtr<Responder> responder, SampleCount timestamp, const string& path, const string& type, bool is_output, QueuedEventSource* source); void pre_process(); void execute(ProcessContext& context); @@ -63,4 +63,4 @@ private: } // namespace Ingen -#endif // ADDPORTEVENT_H +#endif // CREATEPORTEVENT_H diff --git a/src/libs/engine/events/Makefile.am b/src/libs/engine/events/Makefile.am index 7d51ce90..22e13205 100644 --- a/src/libs/engine/events/Makefile.am +++ b/src/libs/engine/events/Makefile.am @@ -1,18 +1,18 @@ MAINTAINERCLEANFILES = Makefile.in EXTRA_DIST = \ - AddNodeEvent.cpp \ - AddNodeEvent.hpp \ - AddPortEvent.cpp \ - AddPortEvent.hpp \ AllNotesOffEvent.cpp \ AllNotesOffEvent.hpp \ ClearPatchEvent.cpp \ ClearPatchEvent.hpp \ ConnectionEvent.cpp \ ConnectionEvent.hpp \ + CreateNodeEvent.cpp \ + CreateNodeEvent.hpp \ CreatePatchEvent.cpp \ CreatePatchEvent.hpp \ + CreatePortEvent.cpp \ + CreatePortEvent.hpp \ DSSIConfigureEvent.cpp \ DSSIConfigureEvent.hpp \ DSSIControlEvent.cpp \ @@ -39,10 +39,8 @@ EXTRA_DIST = \ LoadPluginsEvent.hpp \ MidiLearnEvent.cpp \ MidiLearnEvent.hpp \ - NoteOffEvent.cpp \ - NoteOffEvent.hpp \ - NoteOnEvent.cpp \ - NoteOnEvent.hpp \ + NoteEvent.cpp \ + NoteEvent.hpp \ PingQueuedEvent.hpp \ RegisterClientEvent.cpp \ RegisterClientEvent.hpp \ diff --git a/src/libs/engine/events/NoteOnEvent.cpp b/src/libs/engine/events/NoteEvent.cpp index 316e293a..b0b3e926 100644 --- a/src/libs/engine/events/NoteOnEvent.cpp +++ b/src/libs/engine/events/NoteEvent.cpp @@ -15,7 +15,7 @@ * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ -#include "NoteOnEvent.hpp" +#include "NoteEvent.hpp" #include "Responder.hpp" #include "Engine.hpp" #include "ObjectStore.hpp" @@ -32,12 +32,12 @@ namespace Ingen { * * Used to be triggered by MIDI. Not used anymore. */ -NoteOnEvent::NoteOnEvent(Engine& engine, SharedPtr<Responder> responder, SampleCount timestamp, Node* patch, uchar note_num, uchar velocity) +NoteEvent::NoteEvent(Engine& engine, SharedPtr<Responder> responder, SampleCount timestamp, Node* node, bool on, uchar note_num, uchar velocity) : Event(engine, responder, timestamp), - _node(patch), + _node(node), + _on(on), _note_num(note_num), - _velocity(velocity), - _is_osc_triggered(false) + _velocity(velocity) { } @@ -46,42 +46,50 @@ NoteOnEvent::NoteOnEvent(Engine& engine, SharedPtr<Responder> responder, SampleC * * Triggered by OSC. */ -NoteOnEvent::NoteOnEvent(Engine& engine, SharedPtr<Responder> responder, SampleCount timestamp, const string& node_path, uchar note_num, uchar velocity) +NoteEvent::NoteEvent(Engine& engine, SharedPtr<Responder> responder, SampleCount timestamp, const string& node_path, bool on, uchar note_num, uchar velocity) : Event(engine, responder, timestamp), _node(NULL), _node_path(node_path), + _on(on), _note_num(note_num), - _velocity(velocity), - _is_osc_triggered(true) + _velocity(velocity) { } void -NoteOnEvent::execute(ProcessContext& context) +NoteEvent::execute(ProcessContext& context) { Event::execute(context); assert(_time >= context.start() && _time <= context.end()); // Lookup if neccessary - if (_is_osc_triggered) + if (!_node) _node = _engine.object_store()->find_node(_node_path); - // FIXME: this isn't very good at all. + // FIXME: barf + if (_node != NULL && _node->plugin()->type() == Plugin::Internal) { - if (_node->plugin()->plug_label() == "note_in") - ((MidiNoteNode*)_node)->note_on(_note_num, _velocity, _time, context); - else if (_node->plugin()->plug_label() == "trigger_in") - ((MidiTriggerNode*)_node)->note_on(_note_num, _velocity, _time, context); + if (_on) { + if (_node->plugin()->plug_label() == "note_in") + ((MidiNoteNode*)_node)->note_on(_note_num, _velocity, _time, context); + else if (_node->plugin()->plug_label() == "trigger_in") + ((MidiTriggerNode*)_node)->note_on(_note_num, _velocity, _time, context); + } else { + if (_node->plugin()->plug_label() == "note_in") + ((MidiNoteNode*)_node)->note_off(_note_num, _time, context); + else if (_node->plugin()->plug_label() == "trigger_in") + ((MidiTriggerNode*)_node)->note_off(_note_num, _time, context); + } } } void -NoteOnEvent::post_process() +NoteEvent::post_process() { - if (_is_osc_triggered) { - if (_node != NULL) + if (_responder) { + if (_node) _responder->respond_ok(); else _responder->respond_error("Did not find node for note_on"); diff --git a/src/libs/engine/events/NoteOnEvent.hpp b/src/libs/engine/events/NoteEvent.hpp index a629023f..93e61113 100644 --- a/src/libs/engine/events/NoteOnEvent.hpp +++ b/src/libs/engine/events/NoteEvent.hpp @@ -15,8 +15,8 @@ * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ -#ifndef NOTEONEVENT_H -#define NOTEONEVENT_H +#ifndef NOTEEVENT_H +#define NOTEEVENT_H #include "Event.hpp" #include "types.hpp" @@ -32,24 +32,37 @@ class Node; * * \ingroup engine */ -class NoteOnEvent : public Event +class NoteEvent : public Event { public: - NoteOnEvent(Engine& engine, SharedPtr<Responder> responder, SampleCount timestamp, Node* patch, uchar note_num, uchar velocity); - NoteOnEvent(Engine& engine, SharedPtr<Responder> responder, SampleCount timestamp, const string& node_path, uchar note_num, uchar velocity); + NoteEvent(Engine& engine, + SharedPtr<Responder> responder, + SampleCount timestamp, + Node* node, + bool on, + uchar note_num, + uchar velocity); + + NoteEvent(Engine& engine, + SharedPtr<Responder> responder, + SampleCount timestamp, + const string& node_path, + bool on, + uchar note_num, + uchar velocity); void execute(ProcessContext& context); void post_process(); private: - Node* _node; - string _node_path; - uchar _note_num; - uchar _velocity; - bool _is_osc_triggered; + Node* _node; + const string _node_path; + bool _on; + uchar _note_num; + uchar _velocity; }; } // namespace Ingen -#endif // NOTEONEVENT_H +#endif // NOTEEVENT_H diff --git a/src/libs/engine/events/NoteOffEvent.cpp b/src/libs/engine/events/NoteOffEvent.cpp deleted file mode 100644 index f560f250..00000000 --- a/src/libs/engine/events/NoteOffEvent.cpp +++ /dev/null @@ -1,83 +0,0 @@ -/* This file is part of Ingen. - * Copyright (C) 2007 Dave Robillard <http://drobilla.net> - * - * Ingen is free software; you can redistribute it and/or modify it under the - * terms of the GNU General Public License as published by the Free Software - * Foundation; either version 2 of the License, or (at your option) any later - * version. - * - * Ingen is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#include "NoteOffEvent.hpp" -#include "Responder.hpp" -#include "Engine.hpp" -#include "ObjectStore.hpp" -#include "Node.hpp" -#include "Plugin.hpp" -#include "MidiNoteNode.hpp" -#include "MidiTriggerNode.hpp" -#include "ProcessContext.hpp" - -namespace Ingen { - - -/** Note off with patch explicitly passed - triggered by MIDI. - */ -NoteOffEvent::NoteOffEvent(Engine& engine, SharedPtr<Responder> responder, SampleCount timestamp, Node* node, uchar note_num) -: Event(engine, responder, timestamp), - _node(node), - _note_num(note_num) -{ -} - - -/** Note off event with lookup - triggered by OSC. - */ -NoteOffEvent::NoteOffEvent(Engine& engine, SharedPtr<Responder> responder, SampleCount timestamp, const string& node_path, uchar note_num) -: Event(engine, responder, timestamp), - _node(NULL), - _node_path(node_path), - _note_num(note_num) -{ -} - - -void -NoteOffEvent::execute(ProcessContext& context) -{ - Event::execute(context); - assert(_time >= context.start() && _time <= context.end()); - - if (_node == NULL && _node_path != "") - _node = _engine.object_store()->find_node(_node_path); - - // FIXME: this isn't very good at all. - if (_node != NULL && _node->plugin()->type() == Plugin::Internal) { - if (_node->plugin()->plug_label() == "note_in") - ((MidiNoteNode*)_node)->note_off(_note_num, _time, context); - else if (_node->plugin()->plug_label() == "trigger_in") - ((MidiTriggerNode*)_node)->note_off(_note_num, _time, context); - } -} - - -void -NoteOffEvent::post_process() -{ - if (_node != NULL) - _responder->respond_ok(); - else - _responder->respond_error("Did not find node for note_off"); -} - - -} // namespace Ingen - - diff --git a/src/libs/engine/events/NoteOffEvent.hpp b/src/libs/engine/events/NoteOffEvent.hpp deleted file mode 100644 index 1b7d118c..00000000 --- a/src/libs/engine/events/NoteOffEvent.hpp +++ /dev/null @@ -1,53 +0,0 @@ -/* This file is part of Ingen. - * Copyright (C) 2007 Dave Robillard <http://drobilla.net> - * - * Ingen is free software; you can redistribute it and/or modify it under the - * terms of the GNU General Public License as published by the Free Software - * Foundation; either version 2 of the License, or (at your option) any later - * version. - * - * Ingen is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef NOTEOFFEVENT_H -#define NOTEOFFEVENT_H - -#include "Event.hpp" -#include "types.hpp" -#include <string> -using std::string; - -namespace Ingen { - -class Node; - - -/** A note off event. - * - * \ingroup engine - */ -class NoteOffEvent : public Event -{ -public: - NoteOffEvent(Engine& engine, SharedPtr<Responder> responder, SampleCount timestamp, Node* node, uchar note_num); - NoteOffEvent(Engine& engine, SharedPtr<Responder> responder, SampleCount timestamp, const string& node_path, uchar note_num); - - void execute(ProcessContext& context); - void post_process(); - -private: - Node* _node; - string _node_path; - uchar _note_num; -}; - - -} // namespace Ingen - -#endif // NOTEOFFEVENT_H |