diff options
author | David Robillard <d@drobilla.net> | 2012-05-22 03:30:42 +0000 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2012-05-22 03:30:42 +0000 |
commit | b1d4027b58465d9cc31d6cb1be05a7ff4f202711 (patch) | |
tree | b1b7e9d1379fc16c5f451fda7afff0d2bc071e18 /src | |
parent | e3b0886bfbd12f65450d4b302371f07f511458c3 (diff) | |
download | ingen-b1d4027b58465d9cc31d6cb1be05a7ff4f202711.tar.gz ingen-b1d4027b58465d9cc31d6cb1be05a7ff4f202711.tar.bz2 ingen-b1d4027b58465d9cc31d6cb1be05a7ff4f202711.zip |
More work on test suite.
Clean up, simplify, and shrink event code.
Support disconnect_all via Atom protocol.
git-svn-id: http://svn.drobilla.net/lad/trunk/ingen@4432 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src')
37 files changed, 272 insertions, 339 deletions
diff --git a/src/gui/ingen_gui_lv2.cpp b/src/gui/ingen_gui_lv2.cpp index 18f1c970..f7510f62 100644 --- a/src/gui/ingen_gui_lv2.cpp +++ b/src/gui/ingen_gui_lv2.cpp @@ -40,12 +40,13 @@ struct IngenLV2AtomSink : public Ingen::Shared::AtomSink { , _ui_controller(ui_controller) {} - void write(const LV2_Atom* atom) { + bool write(const LV2_Atom* atom) { _ui_write(_ui_controller, 0, lv2_atom_total_size(atom), _uris.atom_eventTransfer, atom); + return true; } Ingen::Shared::URIs& _uris; diff --git a/src/server/Engine.cpp b/src/server/Engine.cpp index 9359bacf..ead11895 100644 --- a/src/server/Engine.cpp +++ b/src/server/Engine.cpp @@ -66,6 +66,7 @@ Engine::Engine(Ingen::Shared::World* a_world) , _message_context(*this) , _process_context(*this) , _quit_flag(false) + , _direct_driver(true) { if (a_world->store()) { SharedPtr<EngineStore> estore = PtrCast<EngineStore>(a_world->store()); @@ -133,10 +134,27 @@ Engine::set_driver(SharedPtr<Driver> driver) _driver = driver; } +SampleCount +Engine::event_time() +{ + const SampleCount start = _direct_driver + ? _process_context.start() + : _driver->frame_time(); + + /* Exactly one cycle latency (some could run ASAP if we get lucky, but not + always, and a slight constant latency is far better than jittery lower + (average) latency */ + return start + _driver->block_length(); +} + static void execute_and_delete_event(ProcessContext& context, Event* ev) { ev->pre_process(); + if (ev->time() < context.start()) { + // Didn't get around to executing in time, oh well... + ev->set_time(context.start()); + } ev->execute(context); ev->post_process(); delete ev; @@ -146,6 +164,7 @@ void Engine::init(double sample_rate, uint32_t block_length) { set_driver(SharedPtr<Driver>(new DirectDriver(sample_rate, block_length))); + _direct_driver = true; } bool @@ -252,6 +271,8 @@ Engine::deactivate() unsigned Engine::run(uint32_t sample_count) { + _process_context.locate(_process_context.end(), sample_count, 0); + // Apply control bindings to input control_bindings()->pre_process( _process_context, _root_patch->port_impl(0)->buffer(0).get()); diff --git a/src/server/Engine.hpp b/src/server/Engine.hpp index edbe33ae..11b7b35b 100644 --- a/src/server/Engine.hpp +++ b/src/server/Engine.hpp @@ -68,6 +68,7 @@ public: virtual void init(double sample_rate, uint32_t block_length); virtual bool activate(); virtual void deactivate(); + virtual bool pending_events(); virtual unsigned run(uint32_t sample_count); virtual void quit(); virtual bool main_iteration(); @@ -77,8 +78,7 @@ public: void set_driver(SharedPtr<Driver> driver); - /** Return true iff any events are pending. */ - bool pending_events(); + SampleCount event_time(); /** Enqueue an event to be processed (non-realtime threads only). */ void enqueue_event(Event* ev); @@ -128,6 +128,7 @@ private: ProcessContext _process_context; bool _quit_flag; + bool _direct_driver; }; } // namespace Server diff --git a/src/server/Event.cpp b/src/server/Event.cpp deleted file mode 100644 index 7063acdb..00000000 --- a/src/server/Event.cpp +++ /dev/null @@ -1,72 +0,0 @@ -/* - This file is part of Ingen. - Copyright 2007-2012 David Robillard <http://drobilla.net/> - - Ingen is free software: you can redistribute it and/or modify it under the - terms of the GNU Affero General Public License as published by the Free - Software Foundation, either version 3 of the License, or 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 Affero General Public License for details. - - You should have received a copy of the GNU Affero General Public License - along with Ingen. If not, see <http://www.gnu.org/licenses/>. -*/ - -#include "ingen/Interface.hpp" - -#include "Driver.hpp" -#include "Engine.hpp" -#include "Event.hpp" -#include "ProcessContext.hpp" -#include "ThreadManager.hpp" - -/*! \page methods Method Documentation - * - * <p>All changes in Ingen (both engine and client) occur as a result of - * a small set of methods defined in terms of RDF and matching the - * HTTP and WebDAV standards as closely as possible.</p> - */ - -namespace Ingen { -namespace Server { - -void -Event::pre_process() -{ - ThreadManager::assert_thread(THREAD_PRE_PROCESS); - assert(_pre_processed == false); - _pre_processed = true; -} - -void -Event::execute(ProcessContext& context) -{ - assert(_pre_processed); - assert(!_executed); - assert(_time <= context.end()); - - // Didn't get around to executing in time, jitter, oh well... - if (_time < context.start()) - _time = context.start(); - - _executed = true; -} - -void -Event::post_process() -{ - ThreadManager::assert_not_thread(THREAD_PROCESS); -} - -void -Event::respond(Status status) -{ - if (_request_client) { - _request_client->response(_request_id, status); - } -} - -} // namespace Server -} // namespace Ingen diff --git a/src/server/Event.hpp b/src/server/Event.hpp index d47a8e94..6820e8e2 100644 --- a/src/server/Event.hpp +++ b/src/server/Event.hpp @@ -52,20 +52,23 @@ public: virtual ~Event() {} /** Pre-process event before execution (non-realtime). */ - virtual void pre_process(); + virtual bool pre_process() = 0; /** Execute this event in the audio thread (realtime). */ - virtual void execute(ProcessContext& context); + virtual void execute(ProcessContext& context) = 0; /** Post-process event after execution (non-realtime). */ - virtual void post_process(); + virtual void post_process() = 0; /** Return true iff this event has been pre-processed. */ - inline bool is_prepared() const { return _pre_processed; } + inline bool is_prepared() const { return _status != NOT_PREPARED; } /** Return the time stamp of this event. */ inline SampleCount time() const { return _time; } + /** Set the time stamp of this event. */ + inline void set_time(SampleCount time) { _time = time; } + /** Get the next event to be processed after this one. */ Event* next() const { return _next.get(); } @@ -76,7 +79,11 @@ public: Status status() const { return _status; } /** Respond to the originating client. */ - void respond(Status status); + void respond(Status status) { + if (_request_client) { + _request_client->response(_request_id, status); + } + } protected: Event(Engine& engine, Interface* client, int32_t id, FrameTime time) @@ -84,9 +91,7 @@ protected: , _request_client(client) , _request_id(id) , _time(time) - , _status(SUCCESS) - , _pre_processed(false) - , _executed(false) + , _status(NOT_PREPARED) {} /** Constructor for internal events only */ @@ -95,19 +100,20 @@ protected: , _request_client(NULL) , _request_id(-1) , _time(0) - , _status(SUCCESS) - , _pre_processed(false) - , _executed(false) + , _status(NOT_PREPARED) {} + inline bool pre_process_done(Status st) { + _status = st; + return !st; + } + Engine& _engine; Raul::AtomicPtr<Event> _next; Interface* _request_client; int32_t _request_id; FrameTime _time; Status _status; - bool _pre_processed; - bool _executed; }; } // namespace Server diff --git a/src/server/EventWriter.cpp b/src/server/EventWriter.cpp index 6fb682c2..33462c1c 100644 --- a/src/server/EventWriter.cpp +++ b/src/server/EventWriter.cpp @@ -46,12 +46,7 @@ EventWriter::~EventWriter() SampleCount EventWriter::now() const { - /* Exactly one cycle latency (some could run ASAP if we get lucky, but not - always, and a slight constant latency is far better than jittery lower - (average) latency */ - return (_engine.driver()) - ? _engine.driver()->frame_time() + _engine.driver()->block_length() - : 0; + return _engine.event_time(); } void diff --git a/src/server/PreProcessor.cpp b/src/server/PreProcessor.cpp index 013a43dd..9db13fd1 100644 --- a/src/server/PreProcessor.cpp +++ b/src/server/PreProcessor.cpp @@ -83,6 +83,10 @@ PreProcessor::process(ProcessContext& context, PostProcessor& dest, bool limit) Event* last = ev; while (ev && ev->is_prepared() && ev->time() < context.end()) { + if (ev->time() < context.start()) { + // Didn't get around to executing in time, oh well... + ev->set_time(context.start()); + } ev->execute(context); last = ev; ev = (Event*)ev->next(); diff --git a/src/server/events/Connect.cpp b/src/server/events/Connect.cpp index 8fec67f6..64f81e78 100644 --- a/src/server/events/Connect.cpp +++ b/src/server/events/Connect.cpp @@ -55,7 +55,7 @@ Connect::Connect(Engine& engine, , _buffers(NULL) {} -void +bool Connect::pre_process() { Glib::RWLock::ReaderLock rlock(_engine.engine_store()->lock()); @@ -63,39 +63,29 @@ Connect::pre_process() PortImpl* tail = _engine.engine_store()->find_port(_tail_path); PortImpl* head = _engine.engine_store()->find_port(_head_path); if (!tail || !head) { - _status = PORT_NOT_FOUND; - Event::pre_process(); - return; + return Event::pre_process_done(PORT_NOT_FOUND); } _dst_input_port = dynamic_cast<InputPort*>(head); _src_output_port = dynamic_cast<OutputPort*>(tail); if (!_dst_input_port || !_src_output_port) { - _status = DIRECTION_MISMATCH; - Event::pre_process(); - return; + return Event::pre_process_done(DIRECTION_MISMATCH); } NodeImpl* const src_node = tail->parent_node(); NodeImpl* const dst_node = head->parent_node(); if (!src_node || !dst_node) { - _status = PARENT_NOT_FOUND; - Event::pre_process(); - return; + return Event::pre_process_done(PARENT_NOT_FOUND); } if (src_node->parent() != dst_node->parent() && src_node != dst_node->parent() && src_node->parent() != dst_node) { - _status = PARENT_DIFFERS; - Event::pre_process(); - return; + return Event::pre_process_done(PARENT_DIFFERS); } if (!EdgeImpl::can_connect(_src_output_port, _dst_input_port)) { - _status = TYPE_MISMATCH; - Event::pre_process(); - return; + return Event::pre_process_done(TYPE_MISMATCH); } if (src_node->parent_patch() != dst_node->parent_patch()) { @@ -115,9 +105,7 @@ Connect::pre_process() } if (_patch->has_edge(_src_output_port, _dst_input_port)) { - _status = EXISTS; - Event::pre_process(); - return; + return Event::pre_process_done(EXISTS); } _edge = SharedPtr<EdgeImpl>( @@ -149,14 +137,12 @@ Connect::pre_process() if (_patch->enabled()) _compiled_patch = _patch->compile(); - Event::pre_process(); + return Event::pre_process_done(SUCCESS); } void Connect::execute(ProcessContext& context) { - Event::execute(context); - if (_status == SUCCESS) { // This must be inserted here, since they're actually used by the audio thread _dst_input_port->add_edge(context, _edge.get()); diff --git a/src/server/events/Connect.hpp b/src/server/events/Connect.hpp index f5939386..8a93200f 100644 --- a/src/server/events/Connect.hpp +++ b/src/server/events/Connect.hpp @@ -55,7 +55,7 @@ public: const Raul::Path& tail, const Raul::Path& head); - void pre_process(); + bool pre_process(); void execute(ProcessContext& context); void post_process(); diff --git a/src/server/events/CreateNode.cpp b/src/server/events/CreateNode.cpp index 4c2d1382..756f937d 100644 --- a/src/server/events/CreateNode.cpp +++ b/src/server/events/CreateNode.cpp @@ -39,43 +39,43 @@ CreateNode::CreateNode(Engine& engine, int32_t id, SampleCount timestamp, const Raul::Path& path, - const Raul::URI& plugin_uri, const Resource::Properties& properties) : Event(engine, client, id, timestamp) , _path(path) - , _plugin_uri(plugin_uri) , _properties(properties) , _patch(NULL) , _node(NULL) , _compiled_patch(NULL) {} -void +bool CreateNode::pre_process() { Ingen::Shared::URIs& uris = _engine.world()->uris(); + typedef Resource::Properties::const_iterator iterator; + + const iterator t = _properties.find(uris.ingen_prototype); + if (t != _properties.end() && t->second.type() == uris.forge.URI) { + _plugin_uri = t->second.get_uri(); + } else { + return Event::pre_process_done(BAD_REQUEST); + } + if (_engine.engine_store()->find_object(_path)) { - _status = EXISTS; - Event::pre_process(); - return; + return Event::pre_process_done(EXISTS); } if (!(_patch = _engine.engine_store()->find_patch(_path.parent()))) { - _status = PARENT_NOT_FOUND; - Event::pre_process(); - return; + return Event::pre_process_done(PARENT_NOT_FOUND); } - PluginImpl* plugin = _engine.node_factory()->plugin(_plugin_uri.str()); + PluginImpl* plugin = _engine.node_factory()->plugin(_plugin_uri); if (!plugin) { - _status = PLUGIN_NOT_FOUND; - Event::pre_process(); - return; + return Event::pre_process_done(PLUGIN_NOT_FOUND); } - const Resource::Properties::const_iterator p = _properties.find( - _engine.world()->uris().ingen_polyphonic); + const iterator p = _properties.find(uris.ingen_polyphonic); const bool polyphonic = ( p != _properties.end() && p->second.type() == _engine.world()->forge().Bool && @@ -86,9 +86,7 @@ CreateNode::pre_process() polyphonic, _patch, _engine))) { - _status = CREATION_FAILED; - Event::pre_process(); - return; + return Event::pre_process_done(CREATION_FAILED); } _node->properties().insert(_properties.begin(), _properties.end()); @@ -115,14 +113,12 @@ CreateNode::pre_process() _update.push_back(std::make_pair(port->path(), pprops)); } - Event::pre_process(); + return Event::pre_process_done(SUCCESS); } void CreateNode::execute(ProcessContext& context) { - Event::execute(context); - if (_node) { _engine.maid()->push(_patch->compiled_patch()); _patch->compiled_patch(_compiled_patch); @@ -132,10 +128,8 @@ CreateNode::execute(ProcessContext& context) void CreateNode::post_process() { - if (_status) { - respond(_status); - } else { - respond(SUCCESS); + respond(_status); + if (!_status) { for (Update::const_iterator i = _update.begin(); i != _update.end(); ++i) { _engine.broadcaster()->put(i->first, i->second); } diff --git a/src/server/events/CreateNode.hpp b/src/server/events/CreateNode.hpp index 95d504de..90b2b2b6 100644 --- a/src/server/events/CreateNode.hpp +++ b/src/server/events/CreateNode.hpp @@ -45,10 +45,9 @@ public: int32_t id, SampleCount timestamp, const Raul::Path& node_path, - const Raul::URI& plugin_uri, const Resource::Properties& properties); - void pre_process(); + bool pre_process(); void execute(ProcessContext& context); void post_process(); @@ -57,7 +56,7 @@ private: typedef std::list< std::pair<Raul::URI, Resource::Properties> > Update; Raul::Path _path; - Raul::URI _plugin_uri; + std::string _plugin_uri; Resource::Properties _properties; Update _update; PatchImpl* _patch; diff --git a/src/server/events/CreatePatch.cpp b/src/server/events/CreatePatch.cpp index 92d7a5e3..575cf11e 100644 --- a/src/server/events/CreatePatch.cpp +++ b/src/server/events/CreatePatch.cpp @@ -36,7 +36,6 @@ CreatePatch::CreatePatch(Engine& engine, int32_t id, SampleCount timestamp, const Raul::Path& path, - int poly, const Resource::Properties& properties) : Event(engine, client, id, timestamp) , _path(path) @@ -44,37 +43,38 @@ CreatePatch::CreatePatch(Engine& engine, , _patch(NULL) , _parent(NULL) , _compiled_patch(NULL) - , _poly(poly) + , _poly(1) { + Ingen::Shared::URIs& uris = _engine.world()->uris(); + typedef Resource::Properties::const_iterator iterator; + iterator p = _properties.find(uris.ingen_polyphony); + if (p != _properties.end() && p->second.type() == uris.forge.Int) { + _poly = p->second.get_int32(); + } } -void +bool CreatePatch::pre_process() { if (_path.is_root() || _engine.engine_store()->find_object(_path) != NULL) { - _status = EXISTS; - Event::pre_process(); - return; + return Event::pre_process_done(EXISTS); } if (_poly < 1) { - _status = INVALID_POLY; - Event::pre_process(); - return; + return Event::pre_process_done(INVALID_POLY); } const Raul::Path& path = (const Raul::Path&)_path; _parent = _engine.engine_store()->find_patch(path.parent()); - if (_parent == NULL) { - _status = PARENT_NOT_FOUND; - Event::pre_process(); - return; + if (!_parent) { + return Event::pre_process_done(PARENT_NOT_FOUND); } uint32_t poly = 1; - if (_parent != NULL && _poly > 1 && _poly == static_cast<int>(_parent->internal_poly())) + if (_poly > 1 && _poly == static_cast<int>(_parent->internal_poly())) { poly = _poly; + } const Ingen::Shared::URIs& uris = _engine.world()->uris(); @@ -85,12 +85,10 @@ CreatePatch::pre_process() _patch->add_property(uris.rdf_type, Resource::Property(uris.ingen_Node, Resource::EXTERNAL)); - if (_parent) { - _parent->add_node(new PatchImpl::Nodes::Node(_patch)); - if (_parent->enabled()) { - _patch->enable(); - _compiled_patch = _parent->compile(); - } + _parent->add_node(new PatchImpl::Nodes::Node(_patch)); + if (_parent->enabled()) { + _patch->enable(); + _compiled_patch = _parent->compile(); } _patch->activate(*_engine.buffer_factory()); @@ -100,14 +98,12 @@ CreatePatch::pre_process() _update = _patch->properties(); - Event::pre_process(); + return Event::pre_process_done(SUCCESS); } void CreatePatch::execute(ProcessContext& context) { - Event::execute(context); - if (_patch) { assert(_parent); assert(!_path.is_root()); diff --git a/src/server/events/CreatePatch.hpp b/src/server/events/CreatePatch.hpp index 0747ec06..95f24641 100644 --- a/src/server/events/CreatePatch.hpp +++ b/src/server/events/CreatePatch.hpp @@ -40,10 +40,9 @@ public: int32_t id, SampleCount timestamp, const Raul::Path& path, - int poly, const Resource::Properties& properties); - void pre_process(); + bool pre_process(); void execute(ProcessContext& context); void post_process(); diff --git a/src/server/events/CreatePort.cpp b/src/server/events/CreatePort.cpp index a783512f..9f061238 100644 --- a/src/server/events/CreatePort.cpp +++ b/src/server/events/CreatePort.cpp @@ -81,30 +81,21 @@ CreatePort::CreatePort(Engine& engine, _buffer_type = _engine.world()->uri_map().map_uri(i->second.get_uri()); } } - - if (_port_type == PortType::UNKNOWN) { - _status = UNKNOWN_TYPE; - } } -void +bool CreatePort::pre_process() { - if (_status) { - Event::pre_process(); - return; + if (_port_type == PortType::UNKNOWN) { + return Event::pre_process_done(UNKNOWN_TYPE); } if (_engine.engine_store()->find_object(_path)) { - _status = EXISTS; - Event::pre_process(); - return; + return Event::pre_process_done(_status); } if (!(_patch = _engine.engine_store()->find_patch(_path.parent()))) { - _status = PARENT_NOT_FOUND; - Event::pre_process(); - return; + return Event::pre_process_done(PARENT_NOT_FOUND); } const Ingen::Shared::URIs& uris = _engine.world()->uris(); @@ -124,9 +115,7 @@ CreatePort::pre_process() _engine.world()->forge().make(int32_t(old_num_ports)))); } else if (index_i->second.type() != uris.forge.Int || index_i->second.get_int32() != static_cast<int32_t>(old_num_ports)) { - _status = BAD_INDEX; - Event::pre_process(); - return; + return Event::pre_process_done(BAD_INDEX); } Resource::Properties::const_iterator poly_i = _properties.find(uris.ingen_polyphonic); @@ -137,9 +126,7 @@ CreatePort::pre_process() if (!(_patch_port = _patch->create_port( *_engine.buffer_factory(), _path.symbol(), _port_type, _buffer_type, buffer_size, _is_output, polyphonic))) { - _status = CREATION_FAILED; - Event::pre_process(); - return; + return Event::pre_process_done(CREATION_FAILED); } _patch_port->properties().insert(_properties.begin(), _properties.end()); @@ -168,19 +155,17 @@ CreatePort::pre_process() assert(_ports_array->size() == _patch->num_ports_non_rt()); } else { - _status = CREATION_FAILED; + return Event::pre_process_done(CREATION_FAILED); } _update = _patch_port->properties(); - Event::pre_process(); + return Event::pre_process_done(SUCCESS); } void CreatePort::execute(ProcessContext& context) { - Event::execute(context); - if (_patch_port) { _engine.maid()->push(_patch->external_ports()); _patch->external_ports(_ports_array); diff --git a/src/server/events/CreatePort.hpp b/src/server/events/CreatePort.hpp index 3b40136e..3952b1b7 100644 --- a/src/server/events/CreatePort.hpp +++ b/src/server/events/CreatePort.hpp @@ -49,7 +49,7 @@ public: bool is_output, const Resource::Properties& properties); - void pre_process(); + bool pre_process(); void execute(ProcessContext& context); void post_process(); diff --git a/src/server/events/Delete.cpp b/src/server/events/Delete.cpp index d54bcab4..5e7dd20e 100644 --- a/src/server/events/Delete.cpp +++ b/src/server/events/Delete.cpp @@ -60,12 +60,11 @@ Delete::~Delete() delete _disconnect_event; } -void +bool Delete::pre_process() { if (_path.is_root() || _path == "path:/control_in" || _path == "path:/control_out") { - Event::pre_process(); - return; + return Event::pre_process_done(NOT_DELETABLE); } _lock.acquire(); @@ -125,14 +124,12 @@ Delete::pre_process() } - Event::pre_process(); + return Event::pre_process_done(SUCCESS); } void Delete::execute(ProcessContext& context) { - Event::execute(context); - PatchImpl* parent_patch = NULL; if (_patch_node_listnode) { diff --git a/src/server/events/Delete.hpp b/src/server/events/Delete.hpp index 2ca24469..4316763f 100644 --- a/src/server/events/Delete.hpp +++ b/src/server/events/Delete.hpp @@ -65,7 +65,7 @@ public: ~Delete(); - void pre_process(); + bool pre_process(); void execute(ProcessContext& context); void post_process(); diff --git a/src/server/events/Disconnect.cpp b/src/server/events/Disconnect.cpp index e1a86b13..fc6813ea 100644 --- a/src/server/events/Disconnect.cpp +++ b/src/server/events/Disconnect.cpp @@ -111,7 +111,7 @@ Disconnect::Impl::Impl(Engine& e, } } -void +bool Disconnect::pre_process() { Glib::RWLock::WriterLock lock(_engine.engine_store()->lock()); @@ -119,18 +119,14 @@ Disconnect::pre_process() if (_tail_path.parent().parent() != _head_path.parent().parent() && _tail_path.parent() != _head_path.parent().parent() && _tail_path.parent().parent() != _head_path.parent()) { - _status = PARENT_DIFFERS; - Event::pre_process(); - return; + return Event::pre_process_done(PARENT_DIFFERS); } _tail = _engine.engine_store()->find_port(_tail_path); _head = _engine.engine_store()->find_port(_head_path); if (_tail == NULL || _head == NULL) { - _status = PORT_NOT_FOUND; - Event::pre_process(); - return; + return Event::pre_process_done(PORT_NOT_FOUND); } NodeImpl* const src_node = _tail->parent_node(); @@ -155,15 +151,11 @@ Disconnect::pre_process() assert(_patch); if (!_patch->has_edge(_tail, _head)) { - _status = NOT_FOUND; - Event::pre_process(); - return; + return Event::pre_process_done(NOT_FOUND); } if (src_node == NULL || dst_node == NULL) { - _status = PARENT_NOT_FOUND; - Event::pre_process(); - return; + return Event::pre_process_done(PARENT_NOT_FOUND); } _impl = new Impl(_engine, @@ -174,7 +166,7 @@ Disconnect::pre_process() if (_patch->enabled()) _compiled_patch = _patch->compile(); - Event::pre_process(); + return Event::pre_process_done(SUCCESS); } bool @@ -208,8 +200,6 @@ Disconnect::Impl::execute(ProcessContext& context, bool set_dst_buffers) void Disconnect::execute(ProcessContext& context) { - Event::execute(context); - if (_status == SUCCESS) { if (!_impl->execute(context, true)) { _status = NOT_FOUND; diff --git a/src/server/events/Disconnect.hpp b/src/server/events/Disconnect.hpp index fa17e9f4..68356e84 100644 --- a/src/server/events/Disconnect.hpp +++ b/src/server/events/Disconnect.hpp @@ -52,7 +52,7 @@ public: const Raul::Path& tail_path, const Raul::Path& head_path); - void pre_process(); + bool pre_process(); void execute(ProcessContext& context); void post_process(); diff --git a/src/server/events/DisconnectAll.cpp b/src/server/events/DisconnectAll.cpp index 0a4c2ef1..d9f8b8c1 100644 --- a/src/server/events/DisconnectAll.cpp +++ b/src/server/events/DisconnectAll.cpp @@ -79,7 +79,7 @@ DisconnectAll::~DisconnectAll() delete (*i); } -void +bool DisconnectAll::pre_process() { Glib::RWLock::WriterLock lock(_engine.engine_store()->lock(), Glib::NOT_LOCK); @@ -88,25 +88,18 @@ DisconnectAll::pre_process() lock.acquire(); _parent = _engine.engine_store()->find_patch(_parent_path); - - if (_parent == NULL) { - _status = PARENT_NOT_FOUND; - Event::pre_process(); - return; + if (!_parent) { + return Event::pre_process_done(PARENT_NOT_FOUND); } GraphObjectImpl* object = _engine.engine_store()->find_object(_path); if (!object) { - _status = NOT_FOUND; - Event::pre_process(); - return; + return Event::pre_process_done(NOT_FOUND); } if (object->parent_patch() != _parent && object->parent()->parent_patch() != _parent) { - _status = INVALID_PARENT_PATH; - Event::pre_process(); - return; + return Event::pre_process_done(INVALID_PARENT_PATH); } // Only one of these will succeed @@ -146,14 +139,12 @@ DisconnectAll::pre_process() if (!_deleting && _parent->enabled()) _compiled_patch = _parent->compile(); - Event::pre_process(); + return Event::pre_process_done(SUCCESS); } void DisconnectAll::execute(ProcessContext& context) { - Event::execute(context); - if (_status == SUCCESS) { for (Impls::iterator i = _impls.begin(); i != _impls.end(); ++i) { (*i)->execute(context, diff --git a/src/server/events/DisconnectAll.hpp b/src/server/events/DisconnectAll.hpp index 9006fd9d..1446d962 100644 --- a/src/server/events/DisconnectAll.hpp +++ b/src/server/events/DisconnectAll.hpp @@ -56,7 +56,7 @@ public: ~DisconnectAll(); - void pre_process(); + bool pre_process(); void execute(ProcessContext& context); void post_process(); diff --git a/src/server/events/Get.cpp b/src/server/events/Get.cpp index 80fc34e8..6e0aafda 100644 --- a/src/server/events/Get.cpp +++ b/src/server/events/Get.cpp @@ -48,20 +48,21 @@ Get::Get(Engine& engine, { } -void +bool Get::pre_process() { _lock.acquire(); if (_uri == "ingen:plugins") { _plugins = _engine.node_factory()->plugins(); + return Event::pre_process_done(SUCCESS); } else if (Raul::Path::is_valid(_uri.str())) { _object = _engine.engine_store()->find_object(Raul::Path(_uri.str())); + return Event::pre_process_done(_object ? SUCCESS : NOT_FOUND); } else { _plugin = _engine.node_factory()->plugin(_uri); + return Event::pre_process_done(_plugin ? SUCCESS : NOT_FOUND); } - - Event::pre_process(); } static void @@ -84,12 +85,9 @@ send_node(Interface* client, const NodeImpl* node) PluginImpl* const plugin = node->plugin_impl(); if (plugin->type() == Plugin::Patch) { send_patch(client, (PatchImpl*)node); - } else if (plugin->uri().length() == 0) { - Raul::error((Raul::fmt("Node %1%'s plugin has no URI\n") - % node->path())); } else { client->put(node->path(), node->properties()); - for (size_t j=0; j < node->num_ports(); ++j) { + for (size_t j = 0; j < node->num_ports(); ++j) { send_port(client, node->port_impl(j)); } } diff --git a/src/server/events/Get.hpp b/src/server/events/Get.hpp index 146c2b39..f1b5003d 100644 --- a/src/server/events/Get.hpp +++ b/src/server/events/Get.hpp @@ -44,7 +44,8 @@ public: SampleCount timestamp, const Raul::URI& uri); - void pre_process(); + bool pre_process(); + void execute(ProcessContext& context) {} void post_process(); private: diff --git a/src/server/events/Move.cpp b/src/server/events/Move.cpp index 3874fcf1..84deba05 100644 --- a/src/server/events/Move.cpp +++ b/src/server/events/Move.cpp @@ -49,27 +49,22 @@ Move::~Move() { } -void +bool Move::pre_process() { Glib::RWLock::WriterLock lock(_engine.engine_store()->lock()); if (!_old_path.parent().is_parent_of(_new_path)) { - _status = PARENT_DIFFERS; - Event::pre_process(); - return; + return Event::pre_process_done(PARENT_DIFFERS); } + _store_iterator = _engine.engine_store()->find(_old_path); - if (_store_iterator == _engine.engine_store()->end()) { - _status = NOT_FOUND; - Event::pre_process(); - return; + if (_store_iterator == _engine.engine_store()->end()) { + return Event::pre_process_done(NOT_FOUND); } - if (_engine.engine_store()->find_object(_new_path)) { - _status = EXISTS; - Event::pre_process(); - return; + if (_engine.engine_store()->find_object(_new_path)) { + return Event::pre_process_done(EXISTS); } SharedPtr< Raul::Table< Raul::Path, SharedPtr<GraphObject> > > removed @@ -93,14 +88,12 @@ Move::pre_process() _engine.engine_store()->add(*removed.get()); - Event::pre_process(); + return Event::pre_process_done(SUCCESS); } void Move::execute(ProcessContext& context) { - Event::execute(context); - SharedPtr<PortImpl> port = PtrCast<PortImpl>(_store_iterator->second); if (port && port->parent()->parent() == NULL) { EnginePort* eport = _engine.driver()->engine_port(context, _new_path); diff --git a/src/server/events/Move.hpp b/src/server/events/Move.hpp index 1b35e9bd..2e21b190 100644 --- a/src/server/events/Move.hpp +++ b/src/server/events/Move.hpp @@ -53,7 +53,7 @@ public: ~Move(); - void pre_process(); + bool pre_process(); void execute(ProcessContext& context); void post_process(); diff --git a/src/server/events/SetMetadata.cpp b/src/server/events/SetMetadata.cpp index 26757426..7bd3e7a5 100644 --- a/src/server/events/SetMetadata.cpp +++ b/src/server/events/SetMetadata.cpp @@ -101,7 +101,7 @@ SetMetadata::~SetMetadata() delete _create_event; } -void +bool SetMetadata::pre_process() { typedef Properties::const_iterator iterator; @@ -116,9 +116,7 @@ SetMetadata::pre_process() : static_cast<Shared::ResourceImpl*>(_engine.node_factory()->plugin(_subject)); if (!_object && (!is_graph_object || !_create)) { - _status = NOT_FOUND; - Event::pre_process(); - return; + return Event::pre_process_done(NOT_FOUND); } const Ingen::Shared::URIs& uris = _engine.world()->uris(); @@ -129,19 +127,15 @@ SetMetadata::pre_process() Shared::ResourceImpl::type(uris, _properties, is_patch, is_node, is_port, is_output); if (is_patch) { - uint32_t poly = 1; - iterator p = _properties.find(uris.ingen_polyphony); - if (p != _properties.end() && p->second.is_valid() && p->second.type() == uris.forge.Int) - poly = p->second.get_int32(); - _create_event = new CreatePatch(_engine, _request_client, _request_id, _time, - path, poly, _properties); + _create_event = new CreatePatch( + _engine, _request_client, _request_id, _time, path, _properties); } else if (is_node) { - const iterator p = _properties.find(uris.ingen_prototype); - _create_event = new CreateNode(_engine, _request_client, _request_id, _time, - path, p->second.get_uri(), _properties); + _create_event = new CreateNode( + _engine, _request_client, _request_id, _time, path, _properties); } else if (is_port) { - _create_event = new CreatePort(_engine, _request_client, _request_id, _time, - path, is_output, _properties); + _create_event = new CreatePort( + _engine, _request_client, _request_id, _time, + path, is_output, _properties); } if (_create_event) { _create_event->pre_process(); @@ -177,7 +171,7 @@ SetMetadata::pre_process() _object->remove_property(key, value); } - for (Properties::iterator p = _properties.begin(); p != _properties.end(); ++p) { + for (Properties::const_iterator p = _properties.begin(); p != _properties.end(); ++p) { const Raul::URI& key = p->first; const Resource::Property& value = p->second; SpecialType op = NONE; @@ -252,32 +246,34 @@ SetMetadata::pre_process() } } - if (_status != SUCCESS) { + if (_status != NOT_PREPARED) { break; } _types.push_back(op); } - Event::pre_process(); + return Event::pre_process_done(_status == NOT_PREPARED ? SUCCESS : _status); } void SetMetadata::execute(ProcessContext& context) { - if (_status != SUCCESS) { - Event::execute(context); + if (_status) { return; } const Ingen::Shared::URIs& uris = _engine.world()->uris(); if (_create_event) { + _create_event->set_time(_time); _create_event->execute(context); } - for (SetEvents::iterator i = _set_events.begin(); i != _set_events.end(); ++i) + for (SetEvents::iterator i = _set_events.begin(); i != _set_events.end(); ++i) { + (*i)->set_time(_time); (*i)->execute(context); + } GraphObjectImpl* const object = dynamic_cast<GraphObjectImpl*>(_object); NodeImpl* const node = dynamic_cast<NodeImpl*>(_object); @@ -289,8 +285,9 @@ SetMetadata::execute(ProcessContext& context) const Raul::Atom& value = p->second; switch (*t) { case ENABLE_BROADCAST: - if (port) + if (port) { port->broadcast(value.get_bool()); + } break; case ENABLE: if (value.get_bool()) { @@ -303,15 +300,14 @@ SetMetadata::execute(ProcessContext& context) _patch->disable(context); } break; - case POLYPHONIC: - { - PatchImpl* parent = reinterpret_cast<PatchImpl*>(object->parent()); - if (value.get_bool()) - object->apply_poly(context, *_engine.maid(), parent->internal_poly()); - else - object->apply_poly(context, *_engine.maid(), 1); + case POLYPHONIC: { + PatchImpl* parent = reinterpret_cast<PatchImpl*>(object->parent()); + if (value.get_bool()) { + object->apply_poly(context, *_engine.maid(), parent->internal_poly()); + } else { + object->apply_poly(context, *_engine.maid(), 1); } - break; + } break; case POLYPHONY: if (_patch->internal_poly() != static_cast<uint32_t>(value.get_int32()) && !_patch->apply_internal_poly(context, @@ -340,8 +336,6 @@ SetMetadata::execute(ProcessContext& context) break; } } - - Event::execute(context); } void diff --git a/src/server/events/SetMetadata.hpp b/src/server/events/SetMetadata.hpp index 84957e02..223339da 100644 --- a/src/server/events/SetMetadata.hpp +++ b/src/server/events/SetMetadata.hpp @@ -78,7 +78,7 @@ public: ~SetMetadata(); - void pre_process(); + bool pre_process(); void execute(ProcessContext& context); void post_process(); diff --git a/src/server/events/SetPortValue.cpp b/src/server/events/SetPortValue.cpp index b4b26ccf..9eb57d55 100644 --- a/src/server/events/SetPortValue.cpp +++ b/src/server/events/SetPortValue.cpp @@ -69,19 +69,20 @@ SetPortValue::~SetPortValue() { } -void +bool SetPortValue::pre_process() { - if (_queued) { - if (_port == NULL) - _port = _engine.engine_store()->find_port(_port_path); - if (_port == NULL) - _status = PORT_NOT_FOUND; + if (_queued && !_port) { + _port = _engine.engine_store()->find_port(_port_path); + } + + if (!_port) { + return Event::pre_process_done(PORT_NOT_FOUND); } // Port is a message context port, set its value and // call the plugin's message run function once - if (_port && _port->parent_node()->context() == Context::MESSAGE) { + if (_port->parent_node()->context() == Context::MESSAGE) { apply(_engine.message_context()); _engine.message_context().run( _engine.message_context(), @@ -89,20 +90,18 @@ SetPortValue::pre_process() _engine.driver()->frame_time() + _engine.driver()->block_length()); } - if (_port) { - _port->set_value(_value); - _port->set_property(_engine.world()->uris().ingen_value, _value); - } + // Set value metadata (does not affect buffers) + _port->set_value(_value); + _port->set_property(_engine.world()->uris().ingen_value, _value); _binding = _engine.control_bindings()->port_binding(_port); - Event::pre_process(); + return Event::pre_process_done(SUCCESS); } void SetPortValue::execute(ProcessContext& context) { - Event::execute(context); assert(_time >= context.start() && _time <= context.end()); if (_port && _port->parent_node()->context() == Context::MESSAGE) diff --git a/src/server/events/SetPortValue.hpp b/src/server/events/SetPortValue.hpp index a6166060..4d97ee99 100644 --- a/src/server/events/SetPortValue.hpp +++ b/src/server/events/SetPortValue.hpp @@ -59,7 +59,7 @@ public: ~SetPortValue(); - void pre_process(); + bool pre_process(); void execute(ProcessContext& context); void post_process(); diff --git a/src/server/ingen_lv2.cpp b/src/server/ingen_lv2.cpp index 2cc12846..c9c6907e 100644 --- a/src/server/ingen_lv2.cpp +++ b/src/server/ingen_lv2.cpp @@ -232,7 +232,7 @@ public: /** AtomSink::write implementation called by the PostProcessor in the main * thread to write responses to the UI. */ - void write(const LV2_Atom* atom) { + bool write(const LV2_Atom* atom) { // Called from post-processor in main thread while (_to_ui.write(lv2_atom_total_size(atom), atom) == 0) { // Overflow, wait until ring is drained next cycle @@ -240,6 +240,7 @@ public: _to_ui_overflow_sem.wait(); _to_ui_overflow = false; } + return true; } void consume_from_ui() { diff --git a/src/server/wscript b/src/server/wscript index 8f505983..c1ea75e9 100644 --- a/src/server/wscript +++ b/src/server/wscript @@ -12,7 +12,6 @@ def build(bld): EdgeImpl.cpp Engine.cpp EngineStore.cpp - Event.cpp EventWriter.cpp GraphObjectImpl.cpp InputPort.cpp diff --git a/src/shared/AtomReader.cpp b/src/shared/AtomReader.cpp index dc2aa15c..c6ff7e18 100644 --- a/src/shared/AtomReader.cpp +++ b/src/shared/AtomReader.cpp @@ -62,53 +62,68 @@ AtomReader::get_props(const LV2_Atom_Object* obj, } } -void +const char* +AtomReader::atom_to_uri(const LV2_Atom* atom) +{ + if (atom && atom->type == _uris.atom_URI) { + return (const char*)LV2_ATOM_BODY(atom); + } else if (atom && atom->type == _uris.atom_URID) { + return _map.unmap_uri(((LV2_Atom_URID*)atom)->body); + } else { + return NULL; + } +} + +bool AtomReader::write(const LV2_Atom* msg) { - if (msg->type != _uris.atom_Blank) { - Raul::warn << "Unknown message type " << msg->type << std::endl; - return; + if (msg->type != _uris.atom_Blank && msg->type != _uris.atom_Resource) { + Raul::warn << (Raul::fmt("Unknown message type <%1%>\n") + % _map.unmap_uri(msg->type)).str(); + return false; } const LV2_Atom_Object* obj = (const LV2_Atom_Object*)msg; const LV2_Atom* subject = NULL; lv2_atom_object_get(obj, (LV2_URID)_uris.patch_subject, &subject, NULL); - const char* subject_uri = NULL; - if (subject && subject->type == _uris.atom_URI) { - subject_uri = (const char*)LV2_ATOM_BODY(subject); - } else if (subject && subject->type == _uris.atom_URID) { - subject_uri = _map.unmap_uri(((LV2_Atom_URID*)subject)->body); - } + const char* subject_uri = atom_to_uri(subject); if (obj->body.otype == _uris.patch_Get) { _iface.set_response_id(obj->body.id); _iface.get(subject_uri); } else if (obj->body.otype == _uris.patch_Delete) { - if (subject_uri) { - _iface.del(subject_uri); - return; - } - const LV2_Atom_Object* body = NULL; lv2_atom_object_get(obj, (LV2_URID)_uris.patch_body, &body, 0); - if (body && body->body.otype == _uris.ingen_Edge) { - const LV2_Atom* tail = NULL; - const LV2_Atom* head = NULL; + + if (subject_uri && !body) { + _iface.del(subject_uri); + return true; + } else if (body && body->body.otype == _uris.ingen_Edge) { + const LV2_Atom* tail = NULL; + const LV2_Atom* head = NULL; + const LV2_Atom* incidentTo = NULL; lv2_atom_object_get(body, (LV2_URID)_uris.ingen_tail, &tail, (LV2_URID)_uris.ingen_head, &head, + (LV2_URID)_uris.ingen_incidentTo, &incidentTo, NULL); Raul::Atom tail_atom; Raul::Atom head_atom; + Raul::Atom incidentTo_atom; get_atom(tail, tail_atom); get_atom(head, head_atom); + get_atom(incidentTo, incidentTo_atom); if (tail_atom.is_valid() && head_atom.is_valid()) { _iface.disconnect(Raul::Path(tail_atom.get_uri()), Raul::Path(head_atom.get_uri())); + } else if (incidentTo_atom.is_valid()) { + _iface.disconnect_all(subject_uri, + Raul::Path(incidentTo_atom.get_uri())); } else { Raul::warn << "Delete of unknown object." << std::endl; + return false; } } } else if (obj->body.otype == _uris.patch_Put) { @@ -116,10 +131,10 @@ AtomReader::write(const LV2_Atom* msg) lv2_atom_object_get(obj, (LV2_URID)_uris.patch_body, &body, 0); if (!body) { Raul::warn << "Put message has no body" << std::endl; - return; + return false; } else if (!subject_uri) { Raul::warn << "Put message has no subject" << std::endl; - return; + return false; } if (body->body.otype == _uris.ingen_Edge) { @@ -131,7 +146,7 @@ AtomReader::write(const LV2_Atom* msg) NULL); if (!tail || !head) { Raul::warn << "Edge has no tail or head" << std::endl; - return; + return false; } Raul::Atom tail_atom; @@ -151,10 +166,10 @@ AtomReader::write(const LV2_Atom* msg) lv2_atom_object_get(obj, (LV2_URID)_uris.patch_body, &body, 0); if (!body) { Raul::warn << "Set message has no body" << std::endl; - return; + return false; } else if (!subject_uri) { Raul::warn << "Set message has no subject" << std::endl; - return; + return false; } LV2_ATOM_OBJECT_FOREACH(body, p) { @@ -165,21 +180,21 @@ AtomReader::write(const LV2_Atom* msg) } else if (obj->body.otype == _uris.patch_Patch) { if (!subject_uri) { Raul::warn << "Put message has no subject" << std::endl; - return; + return false; } const LV2_Atom_Object* remove = NULL; lv2_atom_object_get(obj, (LV2_URID)_uris.patch_remove, &remove, 0); if (!remove) { Raul::warn << "Patch message has no remove" << std::endl; - return; + return false; } const LV2_Atom_Object* add = NULL; lv2_atom_object_get(obj, (LV2_URID)_uris.patch_add, &add, 0); if (!add) { Raul::warn << "Patch message has no add" << std::endl; - return; + return false; } Ingen::Resource::Properties add_props; @@ -189,6 +204,26 @@ AtomReader::write(const LV2_Atom* msg) get_props(remove, remove_props); _iface.delta(subject_uri, remove_props, add_props); + } else if (obj->body.otype == _uris.patch_Move) { + if (!subject_uri) { + Raul::warn << "Move message has no subject" << std::endl; + return false; + } + + const LV2_Atom* dest = NULL; + lv2_atom_object_get(obj, (LV2_URID)_uris.patch_destination, &dest, 0); + if (!dest) { + Raul::warn << "Move message has no destination" << std::endl; + return false; + } + + const char* dest_uri = atom_to_uri(dest); + if (!dest_uri) { + Raul::warn << "Move message destination is not a URI" << std::endl; + return false; + } + + _iface.move(subject_uri, dest_uri); } else if (obj->body.otype == _uris.patch_Response) { const LV2_Atom* request = NULL; const LV2_Atom* body = NULL; @@ -198,10 +233,10 @@ AtomReader::write(const LV2_Atom* msg) 0); if (!request || request->type != _uris.atom_Int) { Raul::warn << "Response message has no request" << std::endl; - return; + return false; } else if (!body || body->type != _uris.atom_Int) { Raul::warn << "Response message body is not integer" << std::endl; - return; + return false; } _iface.response(((LV2_Atom_Int*)request)->body, (Ingen::Status)((LV2_Atom_Int*)body)->body); @@ -210,6 +245,8 @@ AtomReader::write(const LV2_Atom* msg) << _map.unmap_uri(obj->body.otype) << ">" << std::endl; } + + return true; } } // namespace Shared diff --git a/src/shared/AtomWriter.cpp b/src/shared/AtomWriter.cpp index a1ce8fb1..7d600466 100644 --- a/src/shared/AtomWriter.cpp +++ b/src/shared/AtomWriter.cpp @@ -216,6 +216,21 @@ void AtomWriter::disconnect_all(const Raul::Path& parent_patch_path, const Raul::Path& path) { + LV2_Atom_Forge_Frame msg; + lv2_atom_forge_blank(&_forge, &msg, next_id(), _uris.patch_Delete); + + lv2_atom_forge_property_head(&_forge, _uris.patch_subject, 0); + forge_uri(parent_patch_path); + + lv2_atom_forge_property_head(&_forge, _uris.patch_body, 0); + LV2_Atom_Forge_Frame edge; + lv2_atom_forge_blank(&_forge, &edge, 0, _uris.ingen_Edge); + lv2_atom_forge_property_head(&_forge, _uris.ingen_incidentTo, 0); + forge_uri(path); + lv2_atom_forge_pop(&_forge, &edge); + + lv2_atom_forge_pop(&_forge, &msg); + finish_msg(); } void diff --git a/src/shared/ResourceImpl.cpp b/src/shared/ResourceImpl.cpp index bb60da5c..13284cf4 100644 --- a/src/shared/ResourceImpl.cpp +++ b/src/shared/ResourceImpl.cpp @@ -122,7 +122,7 @@ ResourceImpl::type(const URIs& uris, patch = node = port = is_output = false; for (iterator i = types_range.first; i != types_range.second; ++i) { const Raul::Atom& atom = i->second; - if (atom.type() != uris.forge.URI) { + if (atom.type() != uris.forge.URI && atom.type() != uris.forge.URID) { Raul::warn << "[ResourceImpl] Non-URI type " << uris.forge.str(atom) << endl; continue; } diff --git a/src/shared/URIs.cpp b/src/shared/URIs.cpp index 1bc64c27..2c44c826 100644 --- a/src/shared/URIs.cpp +++ b/src/shared/URIs.cpp @@ -54,6 +54,7 @@ URIs::URIs(Shared::Forge& f, URIMap* map) , atom_Bool (forge, map, LV2_ATOM__Bool) , atom_Float (forge, map, LV2_ATOM__Float) , atom_Int (forge, map, LV2_ATOM__Int) + , atom_Resource (forge, map, LV2_ATOM__Resource) , atom_Sequence (forge, map, LV2_ATOM__Sequence) , atom_Sound (forge, map, LV2_ATOM__Sound) , atom_String (forge, map, LV2_ATOM__String) @@ -77,6 +78,7 @@ URIs::URIs(Shared::Forge& f, URIMap* map) , ingen_enabled (forge, map, NS_INGEN "enabled") , ingen_engine (forge, map, NS_INGEN "engine") , ingen_head (forge, map, NS_INGEN "head") + , ingen_incidentTo (forge, map, NS_INGEN "incidentTo") , ingen_nil (forge, map, NS_INGEN "nil") , ingen_node (forge, map, NS_INGEN "node") , ingen_polyphonic (forge, map, NS_INGEN "polyphonic") diff --git a/src/socket/SocketWriter.cpp b/src/socket/SocketWriter.cpp index 9a9decd7..c375ae16 100644 --- a/src/socket/SocketWriter.cpp +++ b/src/socket/SocketWriter.cpp @@ -76,12 +76,13 @@ SocketWriter::~SocketWriter() sratom_free(_sratom); } -void +bool SocketWriter::write(const LV2_Atom* msg) { sratom_write(_sratom, &_map.urid_unmap_feature()->urid_unmap, 0, NULL, NULL, msg->type, msg->size, LV2_ATOM_BODY(msg)); serd_writer_finish(_writer); + return true; } } // namespace Socket diff --git a/src/socket/SocketWriter.hpp b/src/socket/SocketWriter.hpp index 2e27ea98..2a17d843 100644 --- a/src/socket/SocketWriter.hpp +++ b/src/socket/SocketWriter.hpp @@ -43,7 +43,7 @@ public: ~SocketWriter(); - void write(const LV2_Atom* msg); + bool write(const LV2_Atom* msg); int fd() { return _socket->fd(); } Raul::URI uri() const { return _uri; } |