From 8ebd59309b153e7337f2e6668b7e2cb4301cc34a Mon Sep 17 00:00:00 2001 From: David Robillard Date: Mon, 1 Oct 2007 00:13:02 +0000 Subject: 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 --- src/libs/engine/Makefile.am | 14 +-- src/libs/engine/QueuedEngineInterface.cpp | 6 +- src/libs/engine/events.hpp | 7 +- src/libs/engine/events/AddNodeEvent.cpp | 145 ------------------------ src/libs/engine/events/AddNodeEvent.hpp | 82 -------------- src/libs/engine/events/AddPortEvent.cpp | 175 ----------------------------- src/libs/engine/events/AddPortEvent.hpp | 66 ----------- src/libs/engine/events/CreateNodeEvent.cpp | 145 ++++++++++++++++++++++++ src/libs/engine/events/CreateNodeEvent.hpp | 82 ++++++++++++++ src/libs/engine/events/CreatePortEvent.cpp | 175 +++++++++++++++++++++++++++++ src/libs/engine/events/CreatePortEvent.hpp | 66 +++++++++++ src/libs/engine/events/Makefile.am | 14 +-- src/libs/engine/events/NoteEvent.cpp | 101 +++++++++++++++++ src/libs/engine/events/NoteEvent.hpp | 68 +++++++++++ src/libs/engine/events/NoteOffEvent.cpp | 83 -------------- src/libs/engine/events/NoteOffEvent.hpp | 53 --------- src/libs/engine/events/NoteOnEvent.cpp | 93 --------------- src/libs/engine/events/NoteOnEvent.hpp | 55 --------- 18 files changed, 655 insertions(+), 775 deletions(-) delete mode 100644 src/libs/engine/events/AddNodeEvent.cpp delete mode 100644 src/libs/engine/events/AddNodeEvent.hpp delete mode 100644 src/libs/engine/events/AddPortEvent.cpp delete mode 100644 src/libs/engine/events/AddPortEvent.hpp create mode 100644 src/libs/engine/events/CreateNodeEvent.cpp create mode 100644 src/libs/engine/events/CreateNodeEvent.hpp create mode 100644 src/libs/engine/events/CreatePortEvent.cpp create mode 100644 src/libs/engine/events/CreatePortEvent.hpp create mode 100644 src/libs/engine/events/NoteEvent.cpp create mode 100644 src/libs/engine/events/NoteEvent.hpp delete mode 100644 src/libs/engine/events/NoteOffEvent.cpp delete mode 100644 src/libs/engine/events/NoteOffEvent.hpp delete mode 100644 src/libs/engine/events/NoteOnEvent.cpp delete mode 100644 src/libs/engine/events/NoteOnEvent.hpp (limited to 'src') 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/AddNodeEvent.cpp deleted file mode 100644 index f121c50e..00000000 --- a/src/libs/engine/events/AddNodeEvent.cpp +++ /dev/null @@ -1,145 +0,0 @@ -/* This file is part of Ingen. - * Copyright (C) 2007 Dave Robillard - * - * 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 -#include -#include -#include "AddNodeEvent.hpp" -#include "Responder.hpp" -#include "Patch.hpp" -#include "Node.hpp" -#include "Tree.hpp" -#include "Plugin.hpp" -#include "Engine.hpp" -#include "Patch.hpp" -#include "NodeFactory.hpp" -#include "ClientBroadcaster.hpp" -#include "ObjectStore.hpp" -#include "Port.hpp" - -namespace Ingen { - - -AddNodeEvent::AddNodeEvent(Engine& engine, SharedPtr responder, SampleCount timestamp, const string& path, - const string& plugin_uri, bool poly) -: QueuedEvent(engine, responder, timestamp), - _path(path), - _plugin_uri(plugin_uri), - _poly(poly), - _patch(NULL), - _node(NULL), - _compiled_patch(NULL), - _node_already_exists(false) -{ -} - - -/** DEPRECATED: Construct from type, library name, and plugin label. - * - * Do not use. - */ -AddNodeEvent::AddNodeEvent(Engine& engine, SharedPtr 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), - _plugin_type(plugin_type), - _plugin_lib(plugin_lib), - _plugin_label(plugin_label), - _poly(poly), - _patch(NULL), - _node(NULL), - _compiled_patch(NULL), - _node_already_exists(false) -{ -} - - -void -AddNodeEvent::pre_process() -{ - if (_engine.object_store()->find_object(_path) != NULL) { - _node_already_exists = true; - QueuedEvent::pre_process(); - return; - } - - _patch = _engine.object_store()->find_patch(_path.parent()); - - const Plugin* plugin = (_plugin_uri != "") - ? _engine.node_factory()->plugin(_plugin_uri) - : _engine.node_factory()->plugin(_plugin_type, _plugin_lib, _plugin_label); - - if (_patch && plugin) { - - _node = _engine.node_factory()->load_plugin(plugin, _path.name(), _poly, _patch); - - if (_node != NULL) { - _node->activate(); - - // This can be done here because the audio thread doesn't touch the - // node tree - just the process order array - _patch->add_node(new Raul::ListNode(_node)); - //_node->add_to_store(_engine.object_store()); - _engine.object_store()->add(_node); - - // FIXME: not really necessary to build process order since it's not connected, - // just append to the list - if (_patch->enabled()) - _compiled_patch = _patch->compile(); - } - } - QueuedEvent::pre_process(); -} - - -void -AddNodeEvent::execute(ProcessContext& context) -{ - QueuedEvent::execute(context); - - if (_node != NULL) { - if (_patch->compiled_patch() != NULL) - _engine.maid()->push(_patch->compiled_patch()); - _patch->compiled_patch(_compiled_patch); - } -} - - -void -AddNodeEvent::post_process() -{ - string msg; - if (_node_already_exists) { - msg = string("Could not create node - ").append(_path);// + " already exists."; - _responder->respond_error(msg); - } else if (_patch == NULL) { - msg = "Could not find patch '" + _path.parent() +"' for add_node."; - _responder->respond_error(msg); - } else if (_node == NULL) { - msg = "Unable to load node "; - msg.append(_path).append(" (you're missing the plugin \"").append( - _plugin_uri); - _responder->respond_error(msg); - } else { - _responder->respond_ok(); - _engine.broadcaster()->send_node(_node, true); // yes, send ports - } -} - - -} // namespace Ingen - diff --git a/src/libs/engine/events/AddNodeEvent.hpp b/src/libs/engine/events/AddNodeEvent.hpp deleted file mode 100644 index ebee44b4..00000000 --- a/src/libs/engine/events/AddNodeEvent.hpp +++ /dev/null @@ -1,82 +0,0 @@ -/* This file is part of Ingen. - * Copyright (C) 2007 Dave Robillard - * - * 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 ADDNODEEVENT_H -#define ADDNODEEVENT_H - -#include "QueuedEvent.hpp" -#include -#include -using std::string; - -namespace Raul { template class Array; } -template class TreeNode; - -namespace Ingen { - -class Patch; -class Node; -class Plugin; -class CompiledPatch; - - -/** An event to load a Node and insert it into a Patch. - * - * \ingroup engine - */ -class AddNodeEvent : public QueuedEvent -{ -public: - AddNodeEvent(Engine& engine, - SharedPtr responder, - SampleCount timestamp, - const string& node_path, - const string& plugin_uri, - bool poly); - - // DEPRECATED - AddNodeEvent(Engine& engine, - SharedPtr 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); - void post_process(); - -private: - string _patch_name; - Raul::Path _path; - string _plugin_uri; ///< If nonempty then type, library, label, are ignored - string _plugin_type; - string _plugin_lib; - string _plugin_label; - bool _poly; - Patch* _patch; - Node* _node; - CompiledPatch* _compiled_patch; ///< Patch's new process order - bool _node_already_exists; -}; - - -} // namespace Ingen - -#endif // ADDNODEEVENT_H diff --git a/src/libs/engine/events/AddPortEvent.cpp b/src/libs/engine/events/AddPortEvent.cpp deleted file mode 100644 index 6aeb7f0f..00000000 --- a/src/libs/engine/events/AddPortEvent.cpp +++ /dev/null @@ -1,175 +0,0 @@ -/* This file is part of Ingen. - * Copyright (C) 2007 Dave Robillard - * - * 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 -#include -#include -#include -#include "Responder.hpp" -#include "AddPortEvent.hpp" -#include "Patch.hpp" -#include "Tree.hpp" -#include "Plugin.hpp" -#include "Engine.hpp" -#include "Patch.hpp" -#include "QueuedEventSource.hpp" -#include "ObjectStore.hpp" -#include "ClientBroadcaster.hpp" -#include "Port.hpp" -#include "AudioDriver.hpp" -#include "MidiDriver.hpp" -#include "OSCDriver.hpp" -#include "DuplexPort.hpp" - -namespace Ingen { - - -AddPortEvent::AddPortEvent(Engine& engine, - SharedPtr responder, - SampleCount timestamp, - const string& path, - const string& type, - bool is_output, - QueuedEventSource* source) -: QueuedEvent(engine, responder, timestamp, true, source), - _path(path), - _type(type), - _is_output(is_output), - _data_type(DataType::UNKNOWN), - _patch(NULL), - _patch_port(NULL), - _driver_port(NULL) -{ - /* This is blocking because of the two different sets of Patch ports, the array used in the - * audio thread (inherited from NodeBase), and the arrays used in the pre processor thread. - * If two add port events arrive in the same cycle and the second pre processes before the - * first executes, bad things happen (ports are lost). - * - * FIXME: fix this using RCU - */ - - string type_str; - if (type == "ingen:control" || type == "ingen:audio") - _data_type = DataType::FLOAT; - else if (type == "ingen:midi") - _data_type = DataType::MIDI; - else if (type == "ingen:osc") - _data_type = DataType::OSC; -} - - -void -AddPortEvent::pre_process() -{ - if (_engine.object_store()->find_object(_path) != NULL) { - QueuedEvent::pre_process(); - return; - } - - // FIXME: this is just a mess :/ - - _patch = _engine.object_store()->find_patch(_path.parent()); - - if (_patch != NULL) { - assert(_patch->path() == _path.parent()); - - size_t buffer_size = 1; - if (_type != "ingen:control") - buffer_size = _engine.audio_driver()->buffer_size(); - - const uint32_t old_num_ports = _patch->num_ports(); - - _patch_port = _patch->create_port(_path.name(), _data_type, buffer_size, _is_output); - - if (_patch_port) { - - if (_is_output) - _patch->add_output(new Raul::ListNode(_patch_port)); - else - _patch->add_input(new Raul::ListNode(_patch_port)); - - if (_patch->external_ports()) - _ports_array = new Raul::Array(old_num_ports + 1, *_patch->external_ports()); - else - _ports_array = new Raul::Array(old_num_ports + 1, NULL); - - - _ports_array->at(_patch->num_ports()-1) = _patch_port; - //_patch_port->add_to_store(_engine.object_store()); - _engine.object_store()->add(_patch_port); - - if (!_patch->parent()) { - if (_type == "ingen:audio") - _driver_port = _engine.audio_driver()->create_port( - dynamic_cast(_patch_port)); - else if (_type == "ingen:midi") - _driver_port = _engine.midi_driver()->create_port( - dynamic_cast(_patch_port)); - else if (_type == "ingen:osc" && _engine.osc_driver()) - _driver_port = _engine.osc_driver()->create_port( - dynamic_cast(_patch_port)); - } - - assert(_ports_array->size() == _patch->num_ports()); - - } - } - QueuedEvent::pre_process(); -} - - -void -AddPortEvent::execute(ProcessContext& context) -{ - QueuedEvent::execute(context); - - if (_patch_port) { - - _engine.maid()->push(_patch->external_ports()); - //_patch->add_port(_port); - - _patch->external_ports(_ports_array); - } - - if (_driver_port) - if (_type == "ingen:audio") - _engine.audio_driver()->add_port(_driver_port); - else if (_type == "ingen:midi") - _engine.midi_driver()->add_port(_driver_port); - else if (_type == "ingen:osc") - cerr << "OSC DRIVER PORT" << endl; - - if (_source) - _source->unblock(); -} - - -void -AddPortEvent::post_process() -{ - if (!_patch_port) { - const string msg = string("Could not create port - ").append(_path); - _responder->respond_error(msg); - } else { - _responder->respond_ok(); - _engine.broadcaster()->send_port(_patch_port); - } -} - - -} // namespace Ingen - diff --git a/src/libs/engine/events/AddPortEvent.hpp b/src/libs/engine/events/AddPortEvent.hpp deleted file mode 100644 index f430d50c..00000000 --- a/src/libs/engine/events/AddPortEvent.hpp +++ /dev/null @@ -1,66 +0,0 @@ -/* This file is part of Ingen. - * Copyright (C) 2007 Dave Robillard - * - * 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 ADDPORTEVENT_H -#define ADDPORTEVENT_H - -#include "QueuedEvent.hpp" -#include -#include -#include "DataType.hpp" -#include -using std::string; - -template class Array; - -namespace Ingen { - -class Patch; -class Port; -class Plugin; -class DriverPort; - - -/** An event to add a Port to a Patch. - * - * \ingroup engine - */ -class AddPortEvent : public QueuedEvent -{ -public: - AddPortEvent(Engine& engine, SharedPtr responder, SampleCount timestamp, const string& path, const string& type, bool is_output, QueuedEventSource* source); - - void pre_process(); - void execute(ProcessContext& context); - void post_process(); - -private: - Raul::Path _path; - string _type; - bool _is_output; - DataType _data_type; - Patch* _patch; - Port* _patch_port; - Raul::Array* _ports_array; ///< New (external) ports array for Patch - DriverPort* _driver_port; ///< Driver (eg Jack) port if this is a toplevel port - bool _succeeded; -}; - - -} // namespace Ingen - -#endif // ADDPORTEVENT_H diff --git a/src/libs/engine/events/CreateNodeEvent.cpp b/src/libs/engine/events/CreateNodeEvent.cpp new file mode 100644 index 00000000..65296de6 --- /dev/null +++ b/src/libs/engine/events/CreateNodeEvent.cpp @@ -0,0 +1,145 @@ +/* This file is part of Ingen. + * Copyright (C) 2007 Dave Robillard + * + * 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 +#include +#include +#include "CreateNodeEvent.hpp" +#include "Responder.hpp" +#include "Patch.hpp" +#include "Node.hpp" +#include "Tree.hpp" +#include "Plugin.hpp" +#include "Engine.hpp" +#include "Patch.hpp" +#include "NodeFactory.hpp" +#include "ClientBroadcaster.hpp" +#include "ObjectStore.hpp" +#include "Port.hpp" + +namespace Ingen { + + +CreateNodeEvent::CreateNodeEvent(Engine& engine, SharedPtr responder, SampleCount timestamp, const string& path, + const string& plugin_uri, bool poly) +: QueuedEvent(engine, responder, timestamp), + _path(path), + _plugin_uri(plugin_uri), + _poly(poly), + _patch(NULL), + _node(NULL), + _compiled_patch(NULL), + _node_already_exists(false) +{ +} + + +/** DEPRECATED: Construct from type, library name, and plugin label. + * + * Do not use. + */ +CreateNodeEvent::CreateNodeEvent(Engine& engine, SharedPtr 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), + _plugin_type(plugin_type), + _plugin_lib(plugin_lib), + _plugin_label(plugin_label), + _poly(poly), + _patch(NULL), + _node(NULL), + _compiled_patch(NULL), + _node_already_exists(false) +{ +} + + +void +CreateNodeEvent::pre_process() +{ + if (_engine.object_store()->find_object(_path) != NULL) { + _node_already_exists = true; + QueuedEvent::pre_process(); + return; + } + + _patch = _engine.object_store()->find_patch(_path.parent()); + + const Plugin* plugin = (_plugin_uri != "") + ? _engine.node_factory()->plugin(_plugin_uri) + : _engine.node_factory()->plugin(_plugin_type, _plugin_lib, _plugin_label); + + if (_patch && plugin) { + + _node = _engine.node_factory()->load_plugin(plugin, _path.name(), _poly, _patch); + + if (_node != NULL) { + _node->activate(); + + // This can be done here because the audio thread doesn't touch the + // node tree - just the process order array + _patch->add_node(new Raul::ListNode(_node)); + //_node->add_to_store(_engine.object_store()); + _engine.object_store()->add(_node); + + // FIXME: not really necessary to build process order since it's not connected, + // just append to the list + if (_patch->enabled()) + _compiled_patch = _patch->compile(); + } + } + QueuedEvent::pre_process(); +} + + +void +CreateNodeEvent::execute(ProcessContext& context) +{ + QueuedEvent::execute(context); + + if (_node != NULL) { + if (_patch->compiled_patch() != NULL) + _engine.maid()->push(_patch->compiled_patch()); + _patch->compiled_patch(_compiled_patch); + } +} + + +void +CreateNodeEvent::post_process() +{ + string msg; + if (_node_already_exists) { + msg = string("Could not create node - ").append(_path);// + " already exists."; + _responder->respond_error(msg); + } else if (_patch == NULL) { + msg = "Could not find patch '" + _path.parent() +"' for add_node."; + _responder->respond_error(msg); + } else if (_node == NULL) { + msg = "Unable to load node "; + msg.append(_path).append(" (you're missing the plugin \"").append( + _plugin_uri); + _responder->respond_error(msg); + } else { + _responder->respond_ok(); + _engine.broadcaster()->send_node(_node, true); // yes, send ports + } +} + + +} // namespace Ingen + diff --git a/src/libs/engine/events/CreateNodeEvent.hpp b/src/libs/engine/events/CreateNodeEvent.hpp new file mode 100644 index 00000000..73cbcc02 --- /dev/null +++ b/src/libs/engine/events/CreateNodeEvent.hpp @@ -0,0 +1,82 @@ +/* This file is part of Ingen. + * Copyright (C) 2007 Dave Robillard + * + * 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 CREATENODEEVENT_H +#define CREATENODEEVENT_H + +#include "QueuedEvent.hpp" +#include +#include +using std::string; + +namespace Raul { template class Array; } +template class TreeNode; + +namespace Ingen { + +class Patch; +class Node; +class Plugin; +class CompiledPatch; + + +/** An event to load a Node and insert it into a Patch. + * + * \ingroup engine + */ +class CreateNodeEvent : public QueuedEvent +{ +public: + CreateNodeEvent(Engine& engine, + SharedPtr responder, + SampleCount timestamp, + const string& node_path, + const string& plugin_uri, + bool poly); + + // DEPRECATED + CreateNodeEvent(Engine& engine, + SharedPtr 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); + void post_process(); + +private: + string _patch_name; + Raul::Path _path; + string _plugin_uri; ///< If nonempty then type, library, label, are ignored + string _plugin_type; + string _plugin_lib; + string _plugin_label; + bool _poly; + Patch* _patch; + Node* _node; + CompiledPatch* _compiled_patch; ///< Patch's new process order + bool _node_already_exists; +}; + + +} // namespace Ingen + +#endif // CREATENODEEVENT_H diff --git a/src/libs/engine/events/CreatePortEvent.cpp b/src/libs/engine/events/CreatePortEvent.cpp new file mode 100644 index 00000000..b8bc75e6 --- /dev/null +++ b/src/libs/engine/events/CreatePortEvent.cpp @@ -0,0 +1,175 @@ +/* This file is part of Ingen. + * Copyright (C) 2007 Dave Robillard + * + * 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 +#include +#include +#include +#include "Responder.hpp" +#include "CreatePortEvent.hpp" +#include "Patch.hpp" +#include "Tree.hpp" +#include "Plugin.hpp" +#include "Engine.hpp" +#include "Patch.hpp" +#include "QueuedEventSource.hpp" +#include "ObjectStore.hpp" +#include "ClientBroadcaster.hpp" +#include "Port.hpp" +#include "AudioDriver.hpp" +#include "MidiDriver.hpp" +#include "OSCDriver.hpp" +#include "DuplexPort.hpp" + +namespace Ingen { + + +CreatePortEvent::CreatePortEvent(Engine& engine, + SharedPtr responder, + SampleCount timestamp, + const string& path, + const string& type, + bool is_output, + QueuedEventSource* source) +: QueuedEvent(engine, responder, timestamp, true, source), + _path(path), + _type(type), + _is_output(is_output), + _data_type(DataType::UNKNOWN), + _patch(NULL), + _patch_port(NULL), + _driver_port(NULL) +{ + /* This is blocking because of the two different sets of Patch ports, the array used in the + * audio thread (inherited from NodeBase), and the arrays used in the pre processor thread. + * If two add port events arrive in the same cycle and the second pre processes before the + * first executes, bad things happen (ports are lost). + * + * FIXME: fix this using RCU + */ + + string type_str; + if (type == "ingen:control" || type == "ingen:audio") + _data_type = DataType::FLOAT; + else if (type == "ingen:midi") + _data_type = DataType::MIDI; + else if (type == "ingen:osc") + _data_type = DataType::OSC; +} + + +void +CreatePortEvent::pre_process() +{ + if (_engine.object_store()->find_object(_path) != NULL) { + QueuedEvent::pre_process(); + return; + } + + // FIXME: this is just a mess :/ + + _patch = _engine.object_store()->find_patch(_path.parent()); + + if (_patch != NULL) { + assert(_patch->path() == _path.parent()); + + size_t buffer_size = 1; + if (_type != "ingen:control") + buffer_size = _engine.audio_driver()->buffer_size(); + + const uint32_t old_num_ports = _patch->num_ports(); + + _patch_port = _patch->create_port(_path.name(), _data_type, buffer_size, _is_output); + + if (_patch_port) { + + if (_is_output) + _patch->add_output(new Raul::ListNode(_patch_port)); + else + _patch->add_input(new Raul::ListNode(_patch_port)); + + if (_patch->external_ports()) + _ports_array = new Raul::Array(old_num_ports + 1, *_patch->external_ports()); + else + _ports_array = new Raul::Array(old_num_ports + 1, NULL); + + + _ports_array->at(_patch->num_ports()-1) = _patch_port; + //_patch_port->add_to_store(_engine.object_store()); + _engine.object_store()->add(_patch_port); + + if (!_patch->parent()) { + if (_type == "ingen:audio") + _driver_port = _engine.audio_driver()->create_port( + dynamic_cast(_patch_port)); + else if (_type == "ingen:midi") + _driver_port = _engine.midi_driver()->create_port( + dynamic_cast(_patch_port)); + else if (_type == "ingen:osc" && _engine.osc_driver()) + _driver_port = _engine.osc_driver()->create_port( + dynamic_cast(_patch_port)); + } + + assert(_ports_array->size() == _patch->num_ports()); + + } + } + QueuedEvent::pre_process(); +} + + +void +CreatePortEvent::execute(ProcessContext& context) +{ + QueuedEvent::execute(context); + + if (_patch_port) { + + _engine.maid()->push(_patch->external_ports()); + //_patch->add_port(_port); + + _patch->external_ports(_ports_array); + } + + if (_driver_port) + if (_type == "ingen:audio") + _engine.audio_driver()->add_port(_driver_port); + else if (_type == "ingen:midi") + _engine.midi_driver()->add_port(_driver_port); + else if (_type == "ingen:osc") + cerr << "OSC DRIVER PORT" << endl; + + if (_source) + _source->unblock(); +} + + +void +CreatePortEvent::post_process() +{ + if (!_patch_port) { + const string msg = string("Could not create port - ").append(_path); + _responder->respond_error(msg); + } else { + _responder->respond_ok(); + _engine.broadcaster()->send_port(_patch_port); + } +} + + +} // namespace Ingen + diff --git a/src/libs/engine/events/CreatePortEvent.hpp b/src/libs/engine/events/CreatePortEvent.hpp new file mode 100644 index 00000000..adae4892 --- /dev/null +++ b/src/libs/engine/events/CreatePortEvent.hpp @@ -0,0 +1,66 @@ +/* This file is part of Ingen. + * Copyright (C) 2007 Dave Robillard + * + * 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 CREATEPORTEVENT_H +#define CREATEPORTEVENT_H + +#include "QueuedEvent.hpp" +#include +#include +#include "DataType.hpp" +#include +using std::string; + +template class Array; + +namespace Ingen { + +class Patch; +class Port; +class Plugin; +class DriverPort; + + +/** An event to add a Port to a Patch. + * + * \ingroup engine + */ +class CreatePortEvent : public QueuedEvent +{ +public: + CreatePortEvent(Engine& engine, SharedPtr responder, SampleCount timestamp, const string& path, const string& type, bool is_output, QueuedEventSource* source); + + void pre_process(); + void execute(ProcessContext& context); + void post_process(); + +private: + Raul::Path _path; + string _type; + bool _is_output; + DataType _data_type; + Patch* _patch; + Port* _patch_port; + Raul::Array* _ports_array; ///< New (external) ports array for Patch + DriverPort* _driver_port; ///< Driver (eg Jack) port if this is a toplevel port + bool _succeeded; +}; + + +} // namespace Ingen + +#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/NoteEvent.cpp b/src/libs/engine/events/NoteEvent.cpp new file mode 100644 index 00000000..b0b3e926 --- /dev/null +++ b/src/libs/engine/events/NoteEvent.cpp @@ -0,0 +1,101 @@ +/* This file is part of Ingen. + * Copyright (C) 2007 Dave Robillard + * + * 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 "NoteEvent.hpp" +#include "Responder.hpp" +#include "Engine.hpp" +#include "ObjectStore.hpp" +#include "Node.hpp" +#include "MidiNoteNode.hpp" +#include "MidiTriggerNode.hpp" +#include "Plugin.hpp" +#include "ProcessContext.hpp" + +namespace Ingen { + + +/** Note on with Patch explicitly passed. + * + * Used to be triggered by MIDI. Not used anymore. + */ +NoteEvent::NoteEvent(Engine& engine, SharedPtr responder, SampleCount timestamp, Node* node, bool on, uchar note_num, uchar velocity) +: Event(engine, responder, timestamp), + _node(node), + _on(on), + _note_num(note_num), + _velocity(velocity) +{ +} + + +/** Note on with Node lookup. + * + * Triggered by OSC. + */ +NoteEvent::NoteEvent(Engine& engine, SharedPtr 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) +{ +} + + +void +NoteEvent::execute(ProcessContext& context) +{ + Event::execute(context); + assert(_time >= context.start() && _time <= context.end()); + + // Lookup if neccessary + if (!_node) + _node = _engine.object_store()->find_node(_node_path); + + // FIXME: barf + + if (_node != NULL && _node->plugin()->type() == Plugin::Internal) { + 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 +NoteEvent::post_process() +{ + if (_responder) { + if (_node) + _responder->respond_ok(); + else + _responder->respond_error("Did not find node for note_on"); + } +} + + +} // namespace Ingen + diff --git a/src/libs/engine/events/NoteEvent.hpp b/src/libs/engine/events/NoteEvent.hpp new file mode 100644 index 00000000..93e61113 --- /dev/null +++ b/src/libs/engine/events/NoteEvent.hpp @@ -0,0 +1,68 @@ +/* This file is part of Ingen. + * Copyright (C) 2007 Dave Robillard + * + * 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 NOTEEVENT_H +#define NOTEEVENT_H + +#include "Event.hpp" +#include "types.hpp" +#include +using std::string; + +namespace Ingen { + +class Node; + + +/** A note on event. + * + * \ingroup engine + */ +class NoteEvent : public Event +{ +public: + NoteEvent(Engine& engine, + SharedPtr responder, + SampleCount timestamp, + Node* node, + bool on, + uchar note_num, + uchar velocity); + + NoteEvent(Engine& engine, + SharedPtr responder, + SampleCount timestamp, + const string& node_path, + bool on, + uchar note_num, + uchar velocity); + + void execute(ProcessContext& context); + void post_process(); + +private: + Node* _node; + const string _node_path; + bool _on; + uchar _note_num; + uchar _velocity; +}; + + +} // namespace Ingen + +#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 - * - * 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, 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, 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 - * - * 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 -using std::string; - -namespace Ingen { - -class Node; - - -/** A note off event. - * - * \ingroup engine - */ -class NoteOffEvent : public Event -{ -public: - NoteOffEvent(Engine& engine, SharedPtr responder, SampleCount timestamp, Node* node, uchar note_num); - NoteOffEvent(Engine& engine, SharedPtr 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 diff --git a/src/libs/engine/events/NoteOnEvent.cpp b/src/libs/engine/events/NoteOnEvent.cpp deleted file mode 100644 index 316e293a..00000000 --- a/src/libs/engine/events/NoteOnEvent.cpp +++ /dev/null @@ -1,93 +0,0 @@ -/* This file is part of Ingen. - * Copyright (C) 2007 Dave Robillard - * - * 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 "NoteOnEvent.hpp" -#include "Responder.hpp" -#include "Engine.hpp" -#include "ObjectStore.hpp" -#include "Node.hpp" -#include "MidiNoteNode.hpp" -#include "MidiTriggerNode.hpp" -#include "Plugin.hpp" -#include "ProcessContext.hpp" - -namespace Ingen { - - -/** Note on with Patch explicitly passed. - * - * Used to be triggered by MIDI. Not used anymore. - */ -NoteOnEvent::NoteOnEvent(Engine& engine, SharedPtr responder, SampleCount timestamp, Node* patch, uchar note_num, uchar velocity) -: Event(engine, responder, timestamp), - _node(patch), - _note_num(note_num), - _velocity(velocity), - _is_osc_triggered(false) -{ -} - - -/** Note on with Node lookup. - * - * Triggered by OSC. - */ -NoteOnEvent::NoteOnEvent(Engine& engine, SharedPtr responder, SampleCount timestamp, const string& node_path, uchar note_num, uchar velocity) -: Event(engine, responder, timestamp), - _node(NULL), - _node_path(node_path), - _note_num(note_num), - _velocity(velocity), - _is_osc_triggered(true) -{ -} - - -void -NoteOnEvent::execute(ProcessContext& context) -{ - Event::execute(context); - assert(_time >= context.start() && _time <= context.end()); - - // Lookup if neccessary - if (_is_osc_triggered) - _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_on(_note_num, _velocity, _time, context); - else if (_node->plugin()->plug_label() == "trigger_in") - ((MidiTriggerNode*)_node)->note_on(_note_num, _velocity, _time, context); - } -} - - -void -NoteOnEvent::post_process() -{ - if (_is_osc_triggered) { - if (_node != NULL) - _responder->respond_ok(); - else - _responder->respond_error("Did not find node for note_on"); - } -} - - -} // namespace Ingen - diff --git a/src/libs/engine/events/NoteOnEvent.hpp b/src/libs/engine/events/NoteOnEvent.hpp deleted file mode 100644 index a629023f..00000000 --- a/src/libs/engine/events/NoteOnEvent.hpp +++ /dev/null @@ -1,55 +0,0 @@ -/* This file is part of Ingen. - * Copyright (C) 2007 Dave Robillard - * - * 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 NOTEONEVENT_H -#define NOTEONEVENT_H - -#include "Event.hpp" -#include "types.hpp" -#include -using std::string; - -namespace Ingen { - -class Node; - - -/** A note on event. - * - * \ingroup engine - */ -class NoteOnEvent : public Event -{ -public: - NoteOnEvent(Engine& engine, SharedPtr responder, SampleCount timestamp, Node* patch, uchar note_num, uchar velocity); - NoteOnEvent(Engine& engine, SharedPtr responder, SampleCount timestamp, const string& node_path, 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; -}; - - -} // namespace Ingen - -#endif // NOTEONEVENT_H -- cgit v1.2.1