From 698c38587bd4f0133a132dc363098ff8298ec47b Mon Sep 17 00:00:00 2001 From: David Robillard Date: Mon, 11 May 2009 18:05:24 +0000 Subject: * New ontology. * Display human names on patch ports on creation, if enabled. * Fix copy/paste of subpatches. * Split properties into "properties" (class properties) and "variables" (instance properties). * Names are kind of a legacy leftover... * Remove special set poly / enable / etc events in favour of just setting properties (less API, extensible, RDF compatible). git-svn-id: http://svn.drobilla.net/lad/trunk/ingen@1973 a436a847-0d15-0410-975c-d299462d15a1 --- src/engine/Engine.cpp | 1 - src/engine/EventBuffer.hpp | 4 +- src/engine/GraphObjectImpl.cpp | 2 +- src/engine/GraphObjectImpl.hpp | 6 +-- src/engine/HTTPEngineReceiver.cpp | 2 +- src/engine/OSCEngineReceiver.cpp | 34 ------------ src/engine/ObjectSender.cpp | 22 ++++---- src/engine/QueuedEngineInterface.cpp | 34 +----------- src/engine/QueuedEngineInterface.hpp | 4 -- src/engine/events.hpp | 3 -- src/engine/events/EnablePatchEvent.cpp | 86 ----------------------------- src/engine/events/EnablePatchEvent.hpp | 63 ---------------------- src/engine/events/SetMetadataEvent.cpp | 93 +++++++++++++++++++++++++++----- src/engine/events/SetMetadataEvent.hpp | 15 +++++- src/engine/events/SetPolyphonicEvent.cpp | 82 ---------------------------- src/engine/events/SetPolyphonicEvent.hpp | 56 ------------------- src/engine/events/SetPolyphonyEvent.cpp | 79 --------------------------- src/engine/events/SetPolyphonyEvent.hpp | 56 ------------------- src/engine/wscript | 3 -- 19 files changed, 114 insertions(+), 531 deletions(-) delete mode 100644 src/engine/events/EnablePatchEvent.cpp delete mode 100644 src/engine/events/EnablePatchEvent.hpp delete mode 100644 src/engine/events/SetPolyphonicEvent.cpp delete mode 100644 src/engine/events/SetPolyphonicEvent.hpp delete mode 100644 src/engine/events/SetPolyphonyEvent.cpp delete mode 100644 src/engine/events/SetPolyphonyEvent.hpp (limited to 'src/engine') diff --git a/src/engine/Engine.cpp b/src/engine/Engine.cpp index 23316bdf..41004b97 100644 --- a/src/engine/Engine.cpp +++ b/src/engine/Engine.cpp @@ -36,7 +36,6 @@ #include "QueuedEventSource.hpp" #include "PostProcessor.hpp" #include "events/CreatePatchEvent.hpp" -#include "events/EnablePatchEvent.hpp" #include "PostProcessor.hpp" #include "AudioDriver.hpp" #include "ProcessSlave.hpp" diff --git a/src/engine/EventBuffer.hpp b/src/engine/EventBuffer.hpp index 7c2d9d20..9ff91cc7 100644 --- a/src/engine/EventBuffer.hpp +++ b/src/engine/EventBuffer.hpp @@ -44,8 +44,8 @@ public: bool merge(const EventBuffer& a, const EventBuffer& b); - bool increment() const; - bool is_valid() const; + bool increment() const { return _buf->increment(); } + bool is_valid() const { return _buf->is_valid(); } inline uint32_t latest_frames() const { return _buf->latest_frames(); } inline uint32_t latest_subframes() const { return _buf->latest_subframes(); } diff --git a/src/engine/GraphObjectImpl.cpp b/src/engine/GraphObjectImpl.cpp index b08a9ffc..461ebf0b 100644 --- a/src/engine/GraphObjectImpl.cpp +++ b/src/engine/GraphObjectImpl.cpp @@ -33,7 +33,7 @@ const Atom& GraphObjectImpl::get_variable(const std::string& key) { static const Atom null_atom; - Variables::iterator i = _variables.find(key); + Properties::iterator i = _variables.find(key); return (i != _variables.end()) ? (*i).second : null_atom; } diff --git a/src/engine/GraphObjectImpl.hpp b/src/engine/GraphObjectImpl.hpp index 8cd0d707..5830c618 100644 --- a/src/engine/GraphObjectImpl.hpp +++ b/src/engine/GraphObjectImpl.hpp @@ -74,8 +74,8 @@ public: const Raul::Atom& get_variable(const std::string& key); void set_variable(const std::string& key, const Raul::Atom& value); - const Variables& variables() const { return _variables; } - Variables& variables() { return _variables; } + const Properties& variables() const { return _variables; } + Properties& variables() { return _variables; } /** The Patch this object is a child of. */ virtual PatchImpl* parent_patch() const; @@ -109,7 +109,7 @@ protected: bool _polyphonic; private: - Variables _variables; + Properties _variables; }; diff --git a/src/engine/HTTPEngineReceiver.cpp b/src/engine/HTTPEngineReceiver.cpp index 11803d35..98008a16 100644 --- a/src/engine/HTTPEngineReceiver.cpp +++ b/src/engine/HTTPEngineReceiver.cpp @@ -209,7 +209,7 @@ HTTPEngineReceiver::message_callback(SoupServer* server, SoupMessage* msg, const // Serialise object const string response = serialiser->to_string(start->second, - "http://localhost:16180/patch", GraphObject::Variables()); + "http://localhost:16180/patch", GraphObject::Properties()); soup_message_set_status(msg, SOUP_STATUS_OK); soup_message_set_response(msg, mime_type, SOUP_MEMORY_COPY, diff --git a/src/engine/OSCEngineReceiver.cpp b/src/engine/OSCEngineReceiver.cpp index 7950cdf7..b5505f86 100644 --- a/src/engine/OSCEngineReceiver.cpp +++ b/src/engine/OSCEngineReceiver.cpp @@ -419,40 +419,6 @@ OSCEngineReceiver::_clear_patch_cb(const char* path, const char* types, lo_arg** } -/** \page engine_osc_namespace - *

\b /ingen/set_polyphony - Set the polyphony of a patch - * \arg \b response-id (integer) - * \arg \b patch-path - Patch's path - * \arg \b poly (integer)

\n \n - */ -int -OSCEngineReceiver::_set_polyphony_cb(const char* path, const char* types, lo_arg** argv, int argc, lo_message msg) -{ - const char* patch_path = &argv[1]->s; - const uint32_t poly = argv[2]->i; - - set_polyphony(patch_path, poly); - return 0; -} - - -/** \page engine_osc_namespace - *

\b /ingen/set_polyphonic - Toggle a node's or port's polyphonic mode - * \arg \b response-id (integer) - * \arg \b path - Object's path - * \arg \b polyphonic (bool)

\n \n - */ -int -OSCEngineReceiver::_set_polyphonic_cb(const char* path, const char* types, lo_arg** argv, int argc, lo_message msg) -{ - const char* object_path = &argv[1]->s; - bool polyphonic = (types[2] == 'T'); - - set_polyphonic(object_path, polyphonic); - return 0; -} - - // FIXME: add index /** \page engine_osc_namespace *

\b /ingen/new_port - Add a port into a given patch (load a plugin by URI) diff --git a/src/engine/ObjectSender.cpp b/src/engine/ObjectSender.cpp index 81759fae..e261bc97 100644 --- a/src/engine/ObjectSender.cpp +++ b/src/engine/ObjectSender.cpp @@ -62,14 +62,14 @@ ObjectSender::send_patch(ClientInterface* client, const PatchImpl* patch, bool r client->transfer_begin(); client->new_patch(patch->path(), patch->internal_polyphony()); - client->set_property(patch->path(), "ingen:polyphonic", patch->polyphonic()); + client->set_variable(patch->path(), "ingen:polyphonic", bool(patch->polyphonic())); // Send variable - const GraphObjectImpl::Variables& data = patch->variables(); - for (GraphObjectImpl::Variables::const_iterator j = data.begin(); j != data.end(); ++j) + const GraphObjectImpl::Properties& data = patch->variables(); + for (GraphObjectImpl::Properties::const_iterator j = data.begin(); j != data.end(); ++j) client->set_variable(patch->path(), (*j).first, (*j).second); - client->set_property(patch->path(), "ingen:enabled", (bool)patch->enabled()); + client->set_variable(patch->path(), "ingen:enabled", (bool)patch->enabled()); if (recursive) { @@ -119,11 +119,11 @@ ObjectSender::send_node(ClientInterface* client, const NodeImpl* node, bool recu client->transfer_begin(); client->new_node(node->path(), node->plugin()->uri()); - client->set_property(node->path(), "ingen:polyphonic", node->polyphonic()); + client->set_variable(node->path(), "ingen:polyphonic", bool(node->polyphonic())); // Send variables - const GraphObjectImpl::Variables& data = node->variables(); - for (GraphObjectImpl::Variables::const_iterator j = data.begin(); j != data.end(); ++j) + const GraphObjectImpl::Properties& data = node->variables(); + for (GraphObjectImpl::Properties::const_iterator j = data.begin(); j != data.end(); ++j) client->set_variable(node->path(), (*j).first, (*j).second); // Send properties @@ -151,11 +151,13 @@ ObjectSender::send_port(ClientInterface* client, const PortImpl* port, bool bund client->bundle_begin(); client->new_port(port->path(), port->type().uri(), port->index(), port->is_output()); - client->set_property(port->path(), "ingen:polyphonic", port->polyphonic()); + PatchImpl* graph_parent = dynamic_cast(port->parent_node()); + if (graph_parent && graph_parent->internal_polyphony() > 1) + client->set_variable(port->path(), "ingen:polyphonic", bool(port->polyphonic())); // Send variable - const GraphObjectImpl::Variables& data = port->variables(); - for (GraphObjectImpl::Variables::const_iterator j = data.begin(); j != data.end(); ++j) + const GraphObjectImpl::Properties& data = port->variables(); + for (GraphObjectImpl::Properties::const_iterator j = data.begin(); j != data.end(); ++j) client->set_variable(port->path(), (*j).first, (*j).second); // Send properties diff --git a/src/engine/QueuedEngineInterface.cpp b/src/engine/QueuedEngineInterface.cpp index fc3d7788..6a322e16 100644 --- a/src/engine/QueuedEngineInterface.cpp +++ b/src/engine/QueuedEngineInterface.cpp @@ -203,20 +203,6 @@ QueuedEngineInterface::clear_patch(const string& patch_path) } -void -QueuedEngineInterface::set_polyphony(const string& patch_path, uint32_t poly) -{ - push_queued(new SetPolyphonyEvent(_engine, _responder, now(), this, patch_path, poly)); -} - - -void -QueuedEngineInterface::set_polyphonic(const string& path, bool poly) -{ - push_queued(new SetPolyphonicEvent(_engine, _responder, now(), this, path, poly)); -} - - void QueuedEngineInterface::connect(const string& src_port_path, const string& dst_port_path) @@ -289,25 +275,7 @@ QueuedEngineInterface::set_property(const string& path, const string& predicate, const Atom& value) { - // FIXME: implement generically - if (predicate == "ingen:enabled") { - if (value.type() == Atom::BOOL) { - push_queued(new EnablePatchEvent(_engine, _responder, now(), path, value.get_bool())); - return; - } - } else if (predicate == "ingen:polyphonic") { - if (value.type() == Atom::BOOL) { - push_queued(new SetPolyphonicEvent(_engine, _responder, now(), this, path, value.get_bool())); - return; - } - } else if (predicate == "ingen:polyphony") { - if (value.type() == Atom::INT) { - push_queued(new SetPolyphonyEvent(_engine, _responder, now(), this, path, value.get_int32())); - return; - } - } else { - push_queued(new SetMetadataEvent(_engine, _responder, now(), true, path, predicate, value)); - } + push_queued(new SetMetadataEvent(_engine, _responder, now(), true, path, predicate, value)); } // Requests // diff --git a/src/engine/QueuedEngineInterface.hpp b/src/engine/QueuedEngineInterface.hpp index 49fe649b..ec5bf602 100644 --- a/src/engine/QueuedEngineInterface.hpp +++ b/src/engine/QueuedEngineInterface.hpp @@ -99,10 +99,6 @@ public: virtual void clear_patch(const string& patch_path); - virtual void set_polyphony(const string& patch_path, uint32_t poly); - - virtual void set_polyphonic(const string& path, bool poly); - virtual void connect(const string& src_port_path, const string& dst_port_path); diff --git a/src/engine/events.hpp b/src/engine/events.hpp index 355c6a3c..b5dcdbc0 100644 --- a/src/engine/events.hpp +++ b/src/engine/events.hpp @@ -30,7 +30,6 @@ #include "events/DestroyEvent.hpp" #include "events/DisconnectAllEvent.hpp" #include "events/DisconnectionEvent.hpp" -#include "events/EnablePatchEvent.hpp" #include "events/LoadPluginsEvent.hpp" #include "events/MidiLearnEvent.hpp" #include "events/NoteEvent.hpp" @@ -44,8 +43,6 @@ #include "events/RequestPluginsEvent.hpp" #include "events/RequestPortValueEvent.hpp" #include "events/SetMetadataEvent.hpp" -#include "events/SetPolyphonicEvent.hpp" -#include "events/SetPolyphonyEvent.hpp" #include "events/SetPortValueEvent.hpp" #include "events/UnregisterClientEvent.hpp" diff --git a/src/engine/events/EnablePatchEvent.cpp b/src/engine/events/EnablePatchEvent.cpp deleted file mode 100644 index 04759cea..00000000 --- a/src/engine/events/EnablePatchEvent.cpp +++ /dev/null @@ -1,86 +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 "EnablePatchEvent.hpp" -#include "Responder.hpp" -#include "Engine.hpp" -#include "PatchImpl.hpp" -#include "util.hpp" -#include "ClientBroadcaster.hpp" -#include "EngineStore.hpp" - -namespace Ingen { - - -EnablePatchEvent::EnablePatchEvent(Engine& engine, SharedPtr responder, SampleCount timestamp, const string& patch_path, bool enable) -: QueuedEvent(engine, responder, timestamp), - _patch_path(patch_path), - _patch(NULL), - _compiled_patch(NULL), - _enable(enable) -{ -} - - -void -EnablePatchEvent::pre_process() -{ - _patch = _engine.engine_store()->find_patch(_patch_path); - - if (_enable && _patch) { - /* Any event that requires a new process order will set the patch's - * compiled_patch to NULL if it is executed when the patch is not - * active. So, if the CP is NULL, calculate it here */ - if (_patch->compiled_patch() == NULL) - _compiled_patch = _patch->compile(); - } - - QueuedEvent::pre_process(); -} - - -void -EnablePatchEvent::execute(ProcessContext& context) -{ - QueuedEvent::execute(context); - - if (_patch != NULL) { - if (_enable) - _patch->enable(); - else - _patch->disable(); - - if (_enable && _patch->compiled_patch() == NULL) - _patch->compiled_patch(_compiled_patch); - } -} - - -void -EnablePatchEvent::post_process() -{ - if (_patch != NULL) { - _responder->respond_ok(); - _engine.broadcaster()->send_property_change(_patch_path, "ingen:enabled", (bool)_enable); - } else { - _responder->respond_error(string("Patch ") + _patch_path + " not found"); - } -} - - -} // namespace Ingen - diff --git a/src/engine/events/EnablePatchEvent.hpp b/src/engine/events/EnablePatchEvent.hpp deleted file mode 100644 index dad1803a..00000000 --- a/src/engine/events/EnablePatchEvent.hpp +++ /dev/null @@ -1,63 +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 ENABLEPATCHEVENT_H -#define ENABLEPATCHEVENT_H - -#include -#include "QueuedEvent.hpp" - -using std::string; - -namespace Raul { template class Array; } - -namespace Ingen { - -class PatchImpl; -class NodeImpl; -class CompiledPatch; - - -/** Enables a patch's DSP processing. - * - * \ingroup engine - */ -class EnablePatchEvent : public QueuedEvent -{ -public: - EnablePatchEvent(Engine& engine, - SharedPtr responder, - SampleCount timestamp, - const string& patch_path, - bool enable); - - void pre_process(); - void execute(ProcessContext& context); - void post_process(); - -private: - string _patch_path; - PatchImpl* _patch; - CompiledPatch* _compiled_patch; // Patch's new process order - bool _enable; -}; - - -} // namespace Ingen - - -#endif // ENABLEPATCHEVENT_H diff --git a/src/engine/events/SetMetadataEvent.cpp b/src/engine/events/SetMetadataEvent.cpp index 8caede6e..e0b51f2b 100644 --- a/src/engine/events/SetMetadataEvent.cpp +++ b/src/engine/events/SetMetadataEvent.cpp @@ -23,6 +23,7 @@ #include "PortImpl.hpp" #include "ClientBroadcaster.hpp" #include "GraphObjectImpl.hpp" +#include "PatchImpl.hpp" #include "EngineStore.hpp" using std::string; @@ -46,6 +47,8 @@ SetMetadataEvent::SetMetadataEvent( , _key(key) , _value(value) , _object(NULL) + , _patch(NULL) + , _compiled_patch(NULL) { } @@ -61,17 +64,47 @@ SetMetadataEvent::pre_process() _object = _engine.engine_store()->find_object(_path); if (_object == NULL) { + _error = NOT_FOUND; QueuedEvent::pre_process(); return; } + /*cerr << "SET " << _object->path() << (_property ? " PROP " : " VAR ") + << _key << " :: " << _value.type() << endl;*/ + if (_property) _object->set_property(_key, _value); else _object->set_variable(_key, _value); - if (_key == "ingen:broadcast") + _patch = dynamic_cast(_object); + + if (_key == "ingen:broadcast") { _special_type = ENABLE_BROADCAST; + } else if (_patch) { + if (!_property && _key == "ingen:enabled") { + if (_value.type() == Atom::BOOL) { + _special_type = ENABLE; + if (_value.get_bool() && !_patch->compiled_patch()) + _compiled_patch = _patch->compile(); + } else { + _error = BAD_TYPE; + } + } else if (!_property && _key == "ingen:polyphonic") { + if (_value.type() == Atom::BOOL) { + _special_type = POLYPHONIC; + } else { + _error = BAD_TYPE; + } + } else if (_property && _key == "ingen:polyphony") { + if (_value.type() == Atom::INT) { + _special_type = POLYPHONY; + _patch->prepare_internal_poly(_value.get_int32()); + } else { + _error = BAD_TYPE; + } + } + } QueuedEvent::pre_process(); } @@ -80,33 +113,69 @@ SetMetadataEvent::pre_process() void SetMetadataEvent::execute(ProcessContext& context) { - if (_special_type == ENABLE_BROADCAST) { - PortImpl* port = dynamic_cast(_object); - if (port) + if (_error != NO_ERROR) + return; + + PortImpl* port = 0; + switch (_special_type) { + case ENABLE_BROADCAST: + if ((port = dynamic_cast(_object))) port->broadcast(_value.get_bool()); - } + break; + case ENABLE: + if (_value.get_bool()) { + if (!_patch->compiled_patch()) + _patch->compiled_patch(_compiled_patch); + _patch->enable(); + } else { + _patch->disable(); + } + break; + case POLYPHONIC: + if (!_object->set_polyphonic(*_engine.maid(), _value.get_bool())) + _error = INTERNAL; + break; + case POLYPHONY: + if (!_patch->apply_internal_poly(*_engine.maid(), _value.get_int32())) + _error = INTERNAL; + break; + default: + _success = true; + } QueuedEvent::execute(context); - // Do nothing } void SetMetadataEvent::post_process() { - if (_error == INVALID_PATH) { - _responder->respond_error((boost::format("Invalid path '%1%' setting '%2%'") % _path % _key).str()); - } else if (_object == NULL) { - string msg = (boost::format("Unable to find object '%1%' to set '%2%'") % _path % _key).str(); - _responder->respond_error(msg); - } else { + switch (_error) { + case NO_ERROR: _responder->respond_ok(); if (_property) _engine.broadcaster()->send_property_change(_path, _key, _value); else _engine.broadcaster()->send_variable_change(_path, _key, _value); + break; + case NOT_FOUND: + _responder->respond_error((boost::format( + "Unable to find object '%1%' to set '%2%'") + % _path % _key).str()); + case INTERNAL: + _responder->respond_error("Internal error"); + break; + case INVALID_PATH: + _responder->respond_error((boost::format( + "Invalid path '%1%' setting '%2%'") + % _path % _key).str()); + break; + case BAD_TYPE: + _responder->respond_error((boost::format("Bad type for '%1%'") % _key).str()); + break; } } } // namespace Ingen + diff --git a/src/engine/events/SetMetadataEvent.hpp b/src/engine/events/SetMetadataEvent.hpp index ef1538b7..09774fe9 100644 --- a/src/engine/events/SetMetadataEvent.hpp +++ b/src/engine/events/SetMetadataEvent.hpp @@ -27,6 +27,8 @@ using std::string; namespace Ingen { class GraphObjectImpl; +class PatchImpl; +class CompiledPatch; /** An event to set a piece of variable for an GraphObjectImpl. @@ -49,14 +51,23 @@ public: void post_process(); private: - enum { NO_ERROR, INVALID_PATH } _error; - enum { NONE, ENABLE_BROADCAST } _special_type; + enum { NO_ERROR, NOT_FOUND, INTERNAL, INVALID_PATH, BAD_TYPE } _error; + enum { + NONE, + ENABLE, + ENABLE_BROADCAST, + POLYPHONY, + POLYPHONIC + } _special_type; bool _property; + bool _success; string _path; string _key; Raul::Atom _value; GraphObjectImpl* _object; + PatchImpl* _patch; + CompiledPatch* _compiled_patch; }; diff --git a/src/engine/events/SetPolyphonicEvent.cpp b/src/engine/events/SetPolyphonicEvent.cpp deleted file mode 100644 index 87e03d9e..00000000 --- a/src/engine/events/SetPolyphonicEvent.cpp +++ /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 - */ - -#include "raul/Maid.hpp" -#include "SetPolyphonicEvent.hpp" -#include "Responder.hpp" -#include "Engine.hpp" -#include "PatchImpl.hpp" -#include "ClientBroadcaster.hpp" -#include "util.hpp" -#include "EngineStore.hpp" -#include "PortImpl.hpp" -#include "NodeImpl.hpp" -#include "ConnectionImpl.hpp" -#include "QueuedEventSource.hpp" - -namespace Ingen { - - -SetPolyphonicEvent::SetPolyphonicEvent(Engine& engine, SharedPtr responder, FrameTime time, QueuedEventSource* source, const string& path, bool poly) -: QueuedEvent(engine, responder, time, true, source), - _path(path), - _object(NULL), - _poly(poly), - _success(false) -{ -} - - -void -SetPolyphonicEvent::pre_process() -{ - _object = _engine.engine_store()->find_object(_path); - - QueuedEvent::pre_process(); -} - - -void -SetPolyphonicEvent::execute(ProcessContext& context) -{ - QueuedEvent::execute(context); - - if (_object) - _success = _object->set_polyphonic(*_engine.maid(), _poly); - - _source->unblock(); -} - - -void -SetPolyphonicEvent::post_process() -{ - if (_object) { - if (_success) { - _responder->respond_ok(); - _engine.broadcaster()->send_property_change(_path, "ingen:polyphonic", _poly); - } else { - _responder->respond_error("Unable to set object as polyphonic"); - } - } else { - _responder->respond_error("Unable to find object to set polyphonic"); - } -} - - -} // namespace Ingen - diff --git a/src/engine/events/SetPolyphonicEvent.hpp b/src/engine/events/SetPolyphonicEvent.hpp deleted file mode 100644 index 93505cba..00000000 --- a/src/engine/events/SetPolyphonicEvent.hpp +++ /dev/null @@ -1,56 +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 SETPOLYPHONICEVENT_H -#define SETPOLYPHONICEVENT_H - -#include -#include "raul/Array.hpp" -#include "QueuedEvent.hpp" - -using std::string; - -namespace Ingen { - -class GraphObjectImpl; - - -/** Delete all nodes from a patch. - * - * \ingroup engine - */ -class SetPolyphonicEvent : public QueuedEvent -{ -public: - SetPolyphonicEvent(Engine& engine, SharedPtr responder, FrameTime time, QueuedEventSource* source, const string& path, bool poly); - - void pre_process(); - void execute(ProcessContext& context); - void post_process(); - -private: - const string _path; - GraphObjectImpl* _object; - bool _poly; - bool _success; -}; - - -} // namespace Ingen - - -#endif // SETPOLYPHONICEVENT_H diff --git a/src/engine/events/SetPolyphonyEvent.cpp b/src/engine/events/SetPolyphonyEvent.cpp deleted file mode 100644 index 8f48fc41..00000000 --- a/src/engine/events/SetPolyphonyEvent.cpp +++ /dev/null @@ -1,79 +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 "raul/Maid.hpp" -#include "SetPolyphonyEvent.hpp" -#include "Responder.hpp" -#include "Engine.hpp" -#include "PatchImpl.hpp" -#include "ClientBroadcaster.hpp" -#include "util.hpp" -#include "EngineStore.hpp" -#include "PortImpl.hpp" -#include "NodeImpl.hpp" -#include "ConnectionImpl.hpp" -#include "QueuedEventSource.hpp" - -namespace Ingen { - - -SetPolyphonyEvent::SetPolyphonyEvent(Engine& engine, SharedPtr responder, FrameTime time, QueuedEventSource* source, const string& patch_path, uint32_t poly) -: QueuedEvent(engine, responder, time, true, source), - _patch_path(patch_path), - _patch(NULL), - _poly(poly) -{ -} - - -void -SetPolyphonyEvent::pre_process() -{ - _patch = _engine.engine_store()->find_patch(_patch_path); - if (_patch && _poly > _patch->internal_polyphony()) - _patch->prepare_internal_poly(_poly); - - QueuedEvent::pre_process(); -} - - -void -SetPolyphonyEvent::execute(ProcessContext& context) -{ - QueuedEvent::execute(context); - - if (_patch) - _patch->apply_internal_poly(*_engine.maid(), _poly); - - _source->unblock(); -} - - -void -SetPolyphonyEvent::post_process() -{ - if (_patch) { - _responder->respond_ok(); - _engine.broadcaster()->send_property_change(_patch_path, "ingen:polyphony", (int32_t)_poly); - } else { - _responder->respond_error("Unable to find patch"); - } -} - - -} // namespace Ingen - diff --git a/src/engine/events/SetPolyphonyEvent.hpp b/src/engine/events/SetPolyphonyEvent.hpp deleted file mode 100644 index f9c5b4f9..00000000 --- a/src/engine/events/SetPolyphonyEvent.hpp +++ /dev/null @@ -1,56 +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 SETPOLYPHONYEVENT_H -#define SETPOLYPHONYEVENT_H - -#include -#include "raul/Array.hpp" -#include "QueuedEvent.hpp" - -using std::string; - -namespace Ingen { - -class PatchImpl; - - -/** Delete all nodes from a patch. - * - * \ingroup engine - */ -class SetPolyphonyEvent : public QueuedEvent -{ -public: - SetPolyphonyEvent(Engine& engine, SharedPtr responder, FrameTime time, QueuedEventSource* source, const string& patch_path, uint32_t poly); - - void pre_process(); - void execute(ProcessContext& context); - void post_process(); - -private: - const string _patch_path; - PatchImpl* _patch; - const uint32_t _poly; - -}; - - -} // namespace Ingen - - -#endif // SETPOLYPHONYEVENT_H diff --git a/src/engine/wscript b/src/engine/wscript index ec22f801..e6f38c0c 100644 --- a/src/engine/wscript +++ b/src/engine/wscript @@ -67,7 +67,6 @@ def build(bld): events/DestroyEvent.cpp events/DisconnectAllEvent.cpp events/DisconnectionEvent.cpp - events/EnablePatchEvent.cpp events/LoadPluginsEvent.cpp events/MidiLearnEvent.cpp events/NoteEvent.cpp @@ -80,8 +79,6 @@ def build(bld): events/RequestPluginsEvent.cpp events/RequestPortValueEvent.cpp events/SetMetadataEvent.cpp - events/SetPolyphonicEvent.cpp - events/SetPolyphonyEvent.cpp events/UnregisterClientEvent.cpp ''' obj.export_incdirs = ['.'] -- cgit v1.2.1