diff options
author | David Robillard <d@drobilla.net> | 2007-10-01 00:13:02 +0000 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2007-10-01 00:13:02 +0000 |
commit | 8ebd59309b153e7337f2e6668b7e2cb4301cc34a (patch) | |
tree | 0a6c73fdbf8f67b7cd6e528af39b136224f3abac /src/libs/engine/events | |
parent | 8c633f6d1be4ad24ec6597bed151c0123bd7f11f (diff) | |
download | ingen-8ebd59309b153e7337f2e6668b7e2cb4301cc34a.tar.gz ingen-8ebd59309b153e7337f2e6668b7e2cb4301cc34a.tar.bz2 ingen-8ebd59309b153e7337f2e6668b7e2cb4301cc34a.zip |
Merge NoteOnEvent and NoteOffEvent.
Consistent naming for object creation events.
git-svn-id: http://svn.drobilla.net/lad/ingen@792 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src/libs/engine/events')
-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 |
9 files changed, 90 insertions, 207 deletions
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 |