diff options
Diffstat (limited to 'src/server')
71 files changed, 447 insertions, 369 deletions
diff --git a/src/server/BlockFactory.cpp b/src/server/BlockFactory.cpp index 2368109e..e9c218d9 100644 --- a/src/server/BlockFactory.cpp +++ b/src/server/BlockFactory.cpp @@ -35,6 +35,7 @@ #include <algorithm> #include <cstdint> +#include <memory> #include <utility> #include <vector> @@ -61,12 +62,12 @@ BlockFactory::plugins() return _plugins; } -std::set<SPtr<PluginImpl>> +std::set<std::shared_ptr<PluginImpl>> BlockFactory::refresh() { // Record current plugins, and those that are currently zombies - const Plugins old_plugins(_plugins); - std::set<SPtr<PluginImpl>> zombies; + const Plugins old_plugins(_plugins); + std::set<std::shared_ptr<PluginImpl>> zombies; for (const auto& p : _plugins) { if (p.second->is_zombie()) { zombies.insert(p.second); @@ -77,7 +78,7 @@ BlockFactory::refresh() load_lv2_plugins(); // Add any new plugins to response - std::set<SPtr<PluginImpl>> new_plugins; + std::set<std::shared_ptr<PluginImpl>> new_plugins; for (const auto& p : _plugins) { auto o = old_plugins.find(p.first); if (o == old_plugins.end()) { @@ -146,13 +147,12 @@ void BlockFactory::load_lv2_plugins() { // Build an array of port type nodes for checking compatibility - using Types = std::vector<SPtr<LilvNode>>; + using Types = std::vector<std::shared_ptr<LilvNode>>; Types types; for (unsigned t = PortType::ID::AUDIO; t <= PortType::ID::ATOM; ++t) { const URI& uri(PortType(static_cast<PortType::ID>(t)).uri()); - types.push_back( - SPtr<LilvNode>(lilv_new_uri(_world.lilv_world(), uri.c_str()), - lilv_node_free)); + types.push_back(std::shared_ptr<LilvNode>( + lilv_new_uri(_world.lilv_world(), uri.c_str()), lilv_node_free)); } const LilvPlugins* plugins = lilv_world_get_all_plugins(_world.lilv_world()); diff --git a/src/server/BlockFactory.hpp b/src/server/BlockFactory.hpp index aff2e9f4..e285ba92 100644 --- a/src/server/BlockFactory.hpp +++ b/src/server/BlockFactory.hpp @@ -18,10 +18,10 @@ #define INGEN_ENGINE_BLOCKFACTORY_HPP #include "ingen/URI.hpp" -#include "ingen/memory.hpp" #include "raul/Noncopyable.hpp" #include <map> +#include <memory> #include <set> namespace ingen { @@ -47,11 +47,11 @@ public: * * @return The set of newly loaded plugins. */ - std::set<SPtr<PluginImpl>> refresh(); + std::set<std::shared_ptr<PluginImpl>> refresh(); void load_plugin(const URI& uri); - using Plugins = std::map<URI, SPtr<PluginImpl>>; + using Plugins = std::map<URI, std::shared_ptr<PluginImpl>>; const Plugins& plugins(); PluginImpl* plugin(const URI& uri); diff --git a/src/server/BlockImpl.hpp b/src/server/BlockImpl.hpp index ffe2aaf9..9e9a09ad 100644 --- a/src/server/BlockImpl.hpp +++ b/src/server/BlockImpl.hpp @@ -26,6 +26,7 @@ #include "ingen/Properties.hpp" #include "ingen/Resource.hpp" #include "ingen/URI.hpp" +#include "ingen/memory.hpp" #include "lilv/lilv.h" #include "lv2/urid/urid.h" #include "raul/Array.hpp" @@ -34,6 +35,7 @@ #include <boost/optional/optional.hpp> #include <cstdint> +#include <memory> #include <set> namespace Raul { diff --git a/src/server/Broadcaster.cpp b/src/server/Broadcaster.cpp index b7dc4526..04fbdba0 100644 --- a/src/server/Broadcaster.cpp +++ b/src/server/Broadcaster.cpp @@ -22,6 +22,7 @@ #include "ingen/Interface.hpp" #include <cstddef> +#include <memory> #include <utility> namespace ingen { @@ -37,7 +38,7 @@ Broadcaster::~Broadcaster() /** Register a client to receive messages over the notification band. */ void -Broadcaster::register_client(const SPtr<Interface>& client) +Broadcaster::register_client(const std::shared_ptr<Interface>& client) { std::lock_guard<std::mutex> lock(_clients_mutex); _clients.insert(client); @@ -48,7 +49,7 @@ Broadcaster::register_client(const SPtr<Interface>& client) * @return true if client was found and removed. */ bool -Broadcaster::unregister_client(const SPtr<Interface>& client) +Broadcaster::unregister_client(const std::shared_ptr<Interface>& client) { std::lock_guard<std::mutex> lock(_clients_mutex); const size_t erased = _clients.erase(client); @@ -57,7 +58,8 @@ Broadcaster::unregister_client(const SPtr<Interface>& client) } void -Broadcaster::set_broadcast(const SPtr<Interface>& client, bool broadcast) +Broadcaster::set_broadcast(const std::shared_ptr<Interface>& client, + bool broadcast) { if (broadcast) { _broadcastees.insert(client); diff --git a/src/server/Broadcaster.hpp b/src/server/Broadcaster.hpp index c766ceed..5a414432 100644 --- a/src/server/Broadcaster.hpp +++ b/src/server/Broadcaster.hpp @@ -22,10 +22,10 @@ #include "ingen/Interface.hpp" #include "ingen/Message.hpp" #include "ingen/URI.hpp" -#include "ingen/memory.hpp" #include "raul/Noncopyable.hpp" #include <atomic> +#include <memory> #include <mutex> #include <set> @@ -45,17 +45,18 @@ public: Broadcaster() = default; ~Broadcaster() override; - void register_client(const SPtr<Interface>& client); - bool unregister_client(const SPtr<Interface>& client); + void register_client(const std::shared_ptr<Interface>& client); + bool unregister_client(const std::shared_ptr<Interface>& client); - void set_broadcast(const SPtr<Interface>& client, bool broadcast); + void + set_broadcast(const std::shared_ptr<Interface>& client, bool broadcast); /** Ignore a client when broadcasting. * * This is used to prevent feeding back updates to the client that * initiated a property set in the first place. */ - void set_ignore_client(const SPtr<Interface>& client) + void set_ignore_client(const std::shared_ptr<Interface>& client) { _ignore_client = client; } @@ -109,14 +110,14 @@ public: private: friend class Transfer; - using Clients = std::set<SPtr<Interface>>; + using Clients = std::set<std::shared_ptr<Interface>>; - std::mutex _clients_mutex; - Clients _clients; - std::set< SPtr<Interface> > _broadcastees; - std::atomic<bool> _must_broadcast{false}; - unsigned _bundle_depth{0}; - SPtr<Interface> _ignore_client; + std::mutex _clients_mutex; + Clients _clients; + std::set<std::shared_ptr<Interface>> _broadcastees; + std::atomic<bool> _must_broadcast{false}; + unsigned _bundle_depth{0}; + std::shared_ptr<Interface> _ignore_client; }; } // namespace server diff --git a/src/server/Buffer.hpp b/src/server/Buffer.hpp index b1ec1c68..3228106c 100644 --- a/src/server/Buffer.hpp +++ b/src/server/Buffer.hpp @@ -24,7 +24,6 @@ #include "ingen/URIs.hpp" #include "ingen/ingen.h" -#include "ingen/memory.hpp" #include "lv2/atom/atom.h" #include "lv2/urid/urid.h" diff --git a/src/server/BufferFactory.cpp b/src/server/BufferFactory.cpp index e7bb146a..2de18ee8 100644 --- a/src/server/BufferFactory.cpp +++ b/src/server/BufferFactory.cpp @@ -26,6 +26,7 @@ #include "lv2/urid/urid.h" #include <algorithm> +#include <memory> namespace ingen { namespace server { diff --git a/src/server/ClientUpdate.cpp b/src/server/ClientUpdate.cpp index f0eaa1bf..8af3407a 100644 --- a/src/server/ClientUpdate.cpp +++ b/src/server/ClientUpdate.cpp @@ -29,11 +29,11 @@ #include "ingen/Interface.hpp" #include "ingen/Node.hpp" #include "ingen/URIs.hpp" -#include "ingen/memory.hpp" #include <algorithm> #include <cstddef> #include <cstdint> +#include <memory> #include <utility> namespace ingen { @@ -101,8 +101,8 @@ ClientUpdate::put_graph(const GraphImpl* graph) // Enqueue arcs for (const auto& a : graph->arcs()) { - const SPtr<const Arc> arc = a.second; - const Connect connect = { arc->tail_path(), arc->head_path() }; + const auto arc = a.second; + const Connect connect = {arc->tail_path(), arc->head_path()}; connects.push_back(connect); } } diff --git a/src/server/CompiledGraph.cpp b/src/server/CompiledGraph.cpp index 3c6b6172..20bae0a5 100644 --- a/src/server/CompiledGraph.cpp +++ b/src/server/CompiledGraph.cpp @@ -25,6 +25,7 @@ #include "ingen/Configuration.hpp" #include "ingen/Log.hpp" #include "ingen/World.hpp" +#include "ingen/memory.hpp" #include <algorithm> #include <cassert> diff --git a/src/server/CompiledGraph.hpp b/src/server/CompiledGraph.hpp index 9a06a7c9..52178462 100644 --- a/src/server/CompiledGraph.hpp +++ b/src/server/CompiledGraph.hpp @@ -24,6 +24,7 @@ #include "raul/Noncopyable.hpp" #include <cstddef> +#include <memory> #include <set> #include <string> diff --git a/src/server/ControlBindings.hpp b/src/server/ControlBindings.hpp index f465775b..0f67bcb3 100644 --- a/src/server/ControlBindings.hpp +++ b/src/server/ControlBindings.hpp @@ -19,7 +19,6 @@ #include "BufferRef.hpp" -#include "ingen/memory.hpp" #include "lv2/atom/forge.h" #include "raul/Maid.hpp" @@ -142,11 +141,11 @@ private: Type type, const Atom& value_atom); - Engine& _engine; - std::atomic<Binding*> _learn_binding; - SPtr<Bindings> _bindings; - BufferRef _feedback; - LV2_Atom_Forge _forge; + Engine& _engine; + std::atomic<Binding*> _learn_binding; + std::shared_ptr<Bindings> _bindings; + BufferRef _feedback; + LV2_Atom_Forge _forge; }; } // namespace server diff --git a/src/server/DuplexPort.hpp b/src/server/DuplexPort.hpp index 23f56b4f..5dca573d 100644 --- a/src/server/DuplexPort.hpp +++ b/src/server/DuplexPort.hpp @@ -23,12 +23,14 @@ #include "types.hpp" #include "ingen/URI.hpp" +#include "ingen/memory.hpp" #include "lv2/urid/urid.h" #include <boost/intrusive/slist_hook.hpp> #include <cstddef> #include <cstdint> +#include <memory> namespace Raul { class Symbol; } diff --git a/src/server/Engine.cpp b/src/server/Engine.cpp index 0d5a57bb..2c7c001f 100644 --- a/src/server/Engine.cpp +++ b/src/server/Engine.cpp @@ -110,17 +110,17 @@ Engine::Engine(ingen::World& world) _world.lv2_features().add_feature(_worker->schedule_feature()); _world.lv2_features().add_feature(_options); _world.lv2_features().add_feature( - SPtr<LV2Features::Feature>( - new LV2Features::EmptyFeature(LV2_BUF_SIZE__powerOf2BlockLength))); + std::make_shared<LV2Features::EmptyFeature>( + LV2_BUF_SIZE__powerOf2BlockLength)); _world.lv2_features().add_feature( - SPtr<LV2Features::Feature>( - new LV2Features::EmptyFeature(LV2_BUF_SIZE__fixedBlockLength))); + std::make_shared<LV2Features::EmptyFeature>( + LV2_BUF_SIZE__fixedBlockLength)); _world.lv2_features().add_feature( - SPtr<LV2Features::Feature>( - new LV2Features::EmptyFeature(LV2_BUF_SIZE__boundedBlockLength))); + std::make_shared<LV2Features::EmptyFeature>( + LV2_BUF_SIZE__boundedBlockLength)); _world.lv2_features().add_feature( - SPtr<LV2Features::Feature>( - new LV2Features::EmptyFeature(LV2_STATE__loadDefaultState))); + std::make_shared<LV2Features::EmptyFeature>( + LV2_STATE__loadDefaultState)); if (world.conf().option("dump").get<int32_t>()) { _interface = std::make_shared<Tee>( @@ -159,7 +159,7 @@ Engine::~Engine() thread_ctx->join(); } - const SPtr<Store> store = this->store(); + const auto store = this->store(); if (store) { for (auto& s : *store) { if (!std::dynamic_pointer_cast<NodeImpl>(s.second)->parent()) { @@ -273,7 +273,7 @@ Engine::steal_task(unsigned start_thread) return nullptr; } -SPtr<Store> +std::shared_ptr<Store> Engine::store() const { return _world.store(); @@ -337,7 +337,7 @@ Engine::main_iteration() } void -Engine::set_driver(const SPtr<Driver>& driver) +Engine::set_driver(const std::shared_ptr<Driver>& driver) { _driver = driver; for (const auto& ctx : _run_contexts) { @@ -376,7 +376,8 @@ Engine::reset_load() void Engine::init(double sample_rate, uint32_t block_length, size_t seq_size) { - set_driver(SPtr<Driver>(new DirectDriver(*this, sample_rate, block_length, seq_size))); + set_driver(std::make_shared<DirectDriver>( + *this, sample_rate, block_length, seq_size)); } bool @@ -511,14 +512,14 @@ Engine::log() const } void -Engine::register_client(const SPtr<Interface>& client) +Engine::register_client(const std::shared_ptr<Interface>& client) { log().info("Registering client <%1%>\n", client->uri().c_str()); _broadcaster->register_client(client); } bool -Engine::unregister_client(const SPtr<Interface>& client) +Engine::unregister_client(const std::shared_ptr<Interface>& client) { log().info("Unregistering client <%1%>\n", client->uri().c_str()); return _broadcaster->unregister_client(client); diff --git a/src/server/Engine.hpp b/src/server/Engine.hpp index 445ac649..ec0319ed 100644 --- a/src/server/Engine.hpp +++ b/src/server/Engine.hpp @@ -25,7 +25,6 @@ #include "ingen/EngineBase.hpp" #include "ingen/Properties.hpp" #include "ingen/ingen.h" -#include "ingen/memory.hpp" #include <chrono> #include <condition_variable> @@ -94,15 +93,15 @@ public: unsigned run(uint32_t sample_count) override; void quit() override; bool main_iteration() override; - void register_client(const SPtr<Interface>& client) override; - bool unregister_client(const SPtr<Interface>& client) override; + void register_client(const std::shared_ptr<Interface>& client) override; + bool unregister_client(const std::shared_ptr<Interface>& client) override; void listen() override; /** Return a random [0..1] float with uniform distribution */ float frand() { return _uniform_dist(_rand_engine); } - void set_driver(const SPtr<Driver>& driver); + void set_driver(const std::shared_ptr<Driver>& driver); /** Return the frame time to execute an event that arrived now. * @@ -137,14 +136,14 @@ public: ingen::World& world() const { return _world; } Log& log() const; - const SPtr<Interface>& interface() const { return _interface; } - const SPtr<EventWriter>& event_writer() const { return _event_writer; } + const std::shared_ptr<Interface>& interface() const { return _interface; } + const std::shared_ptr<EventWriter>& event_writer() const { return _event_writer; } const std::unique_ptr<AtomReader>& atom_interface() const { return _atom_interface; } const std::unique_ptr<BlockFactory>& block_factory() const { return _block_factory; } const std::unique_ptr<Broadcaster>& broadcaster() const { return _broadcaster; } const std::unique_ptr<BufferFactory>& buffer_factory() const { return _buffer_factory; } const std::unique_ptr<ControlBindings>& control_bindings() const { return _control_bindings; } - const SPtr<Driver>& driver() const { return _driver; } + const std::shared_ptr<Driver>& driver() const { return _driver; } const std::unique_ptr<PostProcessor>& post_processor() const { return _post_processor; } const std::unique_ptr<Raul::Maid>& maid() const { return _maid; } const std::unique_ptr<UndoStack>& undo_stack() const { return _undo_stack; } @@ -167,7 +166,7 @@ public: void signal_tasks_available(); Task* steal_task(unsigned start_thread); - SPtr<Store> store() const; + std::shared_ptr<Store> store() const; SampleRate sample_rate() const; SampleCount block_length() const; @@ -183,10 +182,10 @@ public: private: ingen::World& _world; - SPtr<LV2Options> _options; + std::shared_ptr<LV2Options> _options; std::unique_ptr<BufferFactory> _buffer_factory; std::unique_ptr<Raul::Maid> _maid; - SPtr<Driver> _driver; + std::shared_ptr<Driver> _driver; std::unique_ptr<Worker> _worker; std::unique_ptr<Worker> _sync_worker; std::unique_ptr<Broadcaster> _broadcaster; @@ -197,8 +196,8 @@ private: std::unique_ptr<PostProcessor> _post_processor; std::unique_ptr<PreProcessor> _pre_processor; std::unique_ptr<SocketListener> _listener; - SPtr<EventWriter> _event_writer; - SPtr<Interface> _interface; + std::shared_ptr<EventWriter> _event_writer; + std::shared_ptr<Interface> _interface; std::unique_ptr<AtomReader> _atom_interface; GraphImpl* _root_graph; diff --git a/src/server/Event.hpp b/src/server/Event.hpp index 93c175b8..89e6ec1a 100644 --- a/src/server/Event.hpp +++ b/src/server/Event.hpp @@ -22,12 +22,12 @@ #include "ingen/Interface.hpp" #include "ingen/Node.hpp" #include "ingen/Status.hpp" -#include "ingen/memory.hpp" #include "raul/Deletable.hpp" #include "raul/Noncopyable.hpp" #include "raul/Path.hpp" #include <atomic> +#include <memory> namespace ingen { namespace server { @@ -107,7 +107,7 @@ public: inline Engine& engine() { return _engine; } protected: - Event(Engine& engine, SPtr<Interface> client, int32_t id, FrameTime time) + Event(Engine& engine, std::shared_ptr<Interface> client, int32_t id, FrameTime time) : _engine(engine) , _next(nullptr) , _request_client(std::move(client)) @@ -149,14 +149,14 @@ protected: return _status; } - Engine& _engine; - std::atomic<Event*> _next; - SPtr<Interface> _request_client; - int32_t _request_id; - FrameTime _time; - Status _status; - std::string _err_subject; - Mode _mode; + Engine& _engine; + std::atomic<Event*> _next; + std::shared_ptr<Interface> _request_client; + int32_t _request_id; + FrameTime _time; + Status _status; + std::string _err_subject; + Mode _mode; }; } // namespace server diff --git a/src/server/EventWriter.hpp b/src/server/EventWriter.hpp index 3bf1d03b..184cefb7 100644 --- a/src/server/EventWriter.hpp +++ b/src/server/EventWriter.hpp @@ -23,7 +23,8 @@ #include "ingen/Interface.hpp" #include "ingen/Message.hpp" #include "ingen/URI.hpp" -#include "ingen/memory.hpp" + +#include <memory> namespace ingen { namespace server { @@ -39,11 +40,12 @@ public: URI uri() const override { return URI("ingen:/clients/event_writer"); } - SPtr<Interface> respondee() const override { + std::shared_ptr<Interface> respondee() const override { return _respondee; } - void set_respondee(const SPtr<Interface>& respondee) override { + void set_respondee(const std::shared_ptr<Interface>& respondee) override + { _respondee = respondee; } @@ -70,9 +72,9 @@ public: void operator()(const Undo&); protected: - Engine& _engine; - SPtr<Interface> _respondee; - Event::Mode _event_mode; + Engine& _engine; + std::shared_ptr<Interface> _respondee; + Event::Mode _event_mode; private: SampleCount now() const; diff --git a/src/server/GraphImpl.cpp b/src/server/GraphImpl.cpp index 4d1d7856..fca0ec4f 100644 --- a/src/server/GraphImpl.cpp +++ b/src/server/GraphImpl.cpp @@ -29,6 +29,7 @@ #include "ingen/Forge.hpp" #include "ingen/URIs.hpp" #include "ingen/World.hpp" +#include "ingen/memory.hpp" #include "raul/Maid.hpp" #include <cassert> @@ -276,13 +277,13 @@ GraphImpl::remove_block(BlockImpl& block) } void -GraphImpl::add_arc(const SPtr<ArcImpl>& a) +GraphImpl::add_arc(const std::shared_ptr<ArcImpl>& a) { ThreadManager::assert_thread(THREAD_PRE_PROCESS); _arcs.emplace(std::make_pair(a->tail(), a->head()), a); } -SPtr<ArcImpl> +std::shared_ptr<ArcImpl> GraphImpl::remove_arc(const PortImpl* tail, const PortImpl* dst_port) { ThreadManager::assert_thread(THREAD_PRE_PROCESS); diff --git a/src/server/GraphImpl.hpp b/src/server/GraphImpl.hpp index 455e9c8a..2ff4cdff 100644 --- a/src/server/GraphImpl.hpp +++ b/src/server/GraphImpl.hpp @@ -21,7 +21,6 @@ #include "DuplexPort.hpp" #include "ThreadManager.hpp" -#include "ingen/memory.hpp" #include "lv2/urid/urid.h" #include <cassert> @@ -157,12 +156,13 @@ public: /** Add an arc to this graph. * Pre-processing thread only. */ - void add_arc(const SPtr<ArcImpl>& a); + void add_arc(const std::shared_ptr<ArcImpl>& a); /** Remove an arc from this graph. * Pre-processing thread only. */ - SPtr<ArcImpl> remove_arc(const PortImpl* tail, const PortImpl* dst_port); + std::shared_ptr<ArcImpl> + remove_arc(const PortImpl* tail, const PortImpl* dst_port); bool has_arc(const PortImpl* tail, const PortImpl* dst_port) const; diff --git a/src/server/InputPort.cpp b/src/server/InputPort.cpp index d238398a..ab951aca 100644 --- a/src/server/InputPort.cpp +++ b/src/server/InputPort.cpp @@ -29,6 +29,7 @@ #include "ingen/Atom.hpp" #include "ingen/Node.hpp" #include "ingen/URIs.hpp" +#include "ingen/memory.hpp" #include "raul/Array.hpp" #include <cassert> diff --git a/src/server/InputPort.hpp b/src/server/InputPort.hpp index ad8b10a4..1bb29b9c 100644 --- a/src/server/InputPort.hpp +++ b/src/server/InputPort.hpp @@ -22,7 +22,6 @@ #include "PortType.hpp" #include "types.hpp" -#include "ingen/memory.hpp" #include "lv2/urid/urid.h" #include <boost/intrusive/options.hpp> @@ -30,6 +29,7 @@ #include <cstdint> #include <cstdlib> +#include <memory> namespace Raul { class Symbol; } diff --git a/src/server/InternalBlock.cpp b/src/server/InternalBlock.cpp index 4aa4cff2..f7072184 100644 --- a/src/server/InternalBlock.cpp +++ b/src/server/InternalBlock.cpp @@ -28,6 +28,7 @@ #include <cstddef> #include <cstdint> +#include <memory> namespace Raul { class Symbol; diff --git a/src/server/JackDriver.cpp b/src/server/JackDriver.cpp index b3f669ce..969961cd 100644 --- a/src/server/JackDriver.cpp +++ b/src/server/JackDriver.cpp @@ -32,6 +32,7 @@ #include "ingen/URIMap.hpp" #include "ingen/World.hpp" #include "ingen/fmt.hpp" +#include "ingen/memory.hpp" #include "lv2/atom/util.h" #include <jack/midiport.h> @@ -568,11 +569,10 @@ JackDriver::_session_cb(jack_session_event_t* event) jack_get_client_name(_client), event->client_uuid); - SPtr<Serialiser> serialiser = _engine.world().serialiser(); - if (serialiser) { + if (auto serialiser = _engine.world().serialiser()) { std::lock_guard<std::mutex> lock(_engine.world().rdf_mutex()); - SPtr<Node> root(_engine.root_graph(), NullDeleter<Node>); + std::shared_ptr<Node> root(_engine.root_graph(), NullDeleter<Node>); serialiser->write_bundle(root, URI(std::string("file://") + event->session_dir)); } diff --git a/src/server/LV2Block.cpp b/src/server/LV2Block.cpp index 7855a0f1..fb1e3192 100644 --- a/src/server/LV2Block.cpp +++ b/src/server/LV2Block.cpp @@ -76,7 +76,7 @@ LV2Block::~LV2Block() drop_instances(_prepared_instances); } -SPtr<LV2Block::Instance> +std::shared_ptr<LV2Block::Instance> LV2Block::make_instance(URIs& uris, SampleRate rate, uint32_t voice, @@ -180,7 +180,7 @@ LV2Block::prepare_poly(BufferFactory& bufs, uint32_t poly) _prepared_instances = bufs.maid().make_managed<Instances>( poly, *_instances, nullptr); for (uint32_t i = _polyphony; i < _prepared_instances->size(); ++i) { - SPtr<Instance> inst = make_instance(bufs.uris(), rate, i, true); + auto inst = make_instance(bufs.uris(), rate, i, true); if (!inst) { _prepared_instances.reset(); return false; @@ -653,8 +653,8 @@ void LV2Block::apply_state(const std::unique_ptr<Worker>& worker, const LilvState* state) { - World& world = parent_graph()->engine().world(); - SPtr<LV2_Feature> sched; + World& world = parent_graph()->engine().world(); + std::shared_ptr<LV2_Feature> sched; if (worker) { sched = worker->schedule_feature()->feature(world, this); } diff --git a/src/server/LV2Block.hpp b/src/server/LV2Block.hpp index 0413a245..66bf8517 100644 --- a/src/server/LV2Block.hpp +++ b/src/server/LV2Block.hpp @@ -22,6 +22,7 @@ #include "types.hpp" #include "ingen/LV2Features.hpp" +#include "ingen/memory.hpp" #include "lilv/lilv.h" #include "lv2/worker/worker.h" #include "raul/Array.hpp" @@ -103,16 +104,14 @@ protected: LilvInstance* const instance; }; - SPtr<Instance> make_instance(URIs& uris, - SampleRate rate, - uint32_t voice, - bool preparing); + std::shared_ptr<Instance> + make_instance(URIs& uris, SampleRate rate, uint32_t voice, bool preparing); inline LilvInstance* instance(uint32_t voice) { return static_cast<LilvInstance*>((*_instances)[voice]->instance); } - using Instances = Raul::Array<SPtr<Instance>>; + using Instances = Raul::Array<std::shared_ptr<Instance>>; static void drop_instances(const MPtr<Instances>& instances) { if (instances) { @@ -149,13 +148,13 @@ protected: static LV2_Worker_Status work_respond( LV2_Worker_Respond_Handle handle, uint32_t size, const void* data); - LV2Plugin* _lv2_plugin; - MPtr<Instances> _instances; - MPtr<Instances> _prepared_instances; - const LV2_Worker_Interface* _worker_iface; - std::mutex _work_mutex; - Responses _responses; - SPtr<LV2Features::FeatureArray> _features; + LV2Plugin* _lv2_plugin; + MPtr<Instances> _instances; + MPtr<Instances> _prepared_instances; + const LV2_Worker_Interface* _worker_iface; + std::mutex _work_mutex; + Responses _responses; + std::shared_ptr<LV2Features::FeatureArray> _features; }; } // namespace server diff --git a/src/server/LV2Options.hpp b/src/server/LV2Options.hpp index 33f5781b..d7493276 100644 --- a/src/server/LV2Options.hpp +++ b/src/server/LV2Options.hpp @@ -21,6 +21,8 @@ #include "ingen/URIs.hpp" #include "lv2/options/options.h" +#include <memory> + namespace ingen { namespace server { @@ -38,7 +40,7 @@ public: const char* uri() const override { return LV2_OPTIONS__options; } - SPtr<LV2_Feature> feature(World& w, Node* n) override { + std::shared_ptr<LV2_Feature> feature(World& w, Node* n) override { const LV2_Options_Option options[] = { { LV2_OPTIONS_INSTANCE, 0, _uris.bufsz_minBlockLength, sizeof(int32_t), _uris.atom_Int, &_block_length }, @@ -55,7 +57,7 @@ public: f->URI = LV2_OPTIONS__options; f->data = malloc(sizeof(options)); memcpy(f->data, options, sizeof(options)); - return SPtr<LV2_Feature>(f, &free_feature); + return std::shared_ptr<LV2_Feature>(f, &free_feature); } private: diff --git a/src/server/LV2ResizeFeature.hpp b/src/server/LV2ResizeFeature.hpp index 322aacb8..ddad2ea7 100644 --- a/src/server/LV2ResizeFeature.hpp +++ b/src/server/LV2ResizeFeature.hpp @@ -24,6 +24,8 @@ #include "ingen/LV2Features.hpp" #include "lv2/resize-port/resize-port.h" +#include <memory> + namespace ingen { namespace server { @@ -44,7 +46,7 @@ struct ResizeFeature : public ingen::LV2Features::Feature { const char* uri() const { return LV2_RESIZE_PORT_URI; } - SPtr<LV2_Feature> feature(World& w, Node* n) { + std::shared_ptr<LV2_Feature> feature(World& w, Node* n) { BlockImpl* block = dynamic_cast<BlockImpl*>(n); if (!block) { return nullptr; @@ -56,7 +58,7 @@ struct ResizeFeature : public ingen::LV2Features::Feature { LV2_Feature* f = (LV2_Feature*)malloc(sizeof(LV2_Feature)); f->URI = LV2_RESIZE_PORT_URI; f->data = data; - return SPtr<LV2_Feature>(f, &free_feature); + return std::shared_ptr<LV2_Feature>(f, &free_feature); } }; diff --git a/src/server/PortImpl.cpp b/src/server/PortImpl.cpp index 714c57f7..a6d2ff26 100644 --- a/src/server/PortImpl.cpp +++ b/src/server/PortImpl.cpp @@ -26,6 +26,7 @@ #include "ingen/Forge.hpp" #include "ingen/URIs.hpp" #include "ingen/World.hpp" +#include "ingen/memory.hpp" #include "lv2/atom/util.h" #include "raul/Array.hpp" #include "raul/Maid.hpp" diff --git a/src/server/PortImpl.hpp b/src/server/PortImpl.hpp index c0d44ef6..0c12f85d 100644 --- a/src/server/PortImpl.hpp +++ b/src/server/PortImpl.hpp @@ -24,11 +24,13 @@ #include "types.hpp" #include "ingen/Atom.hpp" +#include "ingen/memory.hpp" #include "raul/Array.hpp" #include <atomic> #include <cstdint> #include <cstdlib> +#include <memory> namespace ingen { namespace server { diff --git a/src/server/PreProcessContext.hpp b/src/server/PreProcessContext.hpp index a1bdbb5f..558349f8 100644 --- a/src/server/PreProcessContext.hpp +++ b/src/server/PreProcessContext.hpp @@ -20,6 +20,8 @@ #include "CompiledGraph.hpp" #include "GraphImpl.hpp" +#include "ingen/memory.hpp" + #include <unordered_set> namespace Raul { class Maid; } diff --git a/src/server/RunContext.hpp b/src/server/RunContext.hpp index 10414bde..bc09f7c3 100644 --- a/src/server/RunContext.hpp +++ b/src/server/RunContext.hpp @@ -17,7 +17,6 @@ #ifndef INGEN_ENGINE_RUNCONTEXT_HPP #define INGEN_ENGINE_RUNCONTEXT_HPP -#include "ingen/memory.hpp" #include "types.hpp" #include "lv2/urid/urid.h" diff --git a/src/server/SocketListener.cpp b/src/server/SocketListener.cpp index 272aa627..9d8d461d 100644 --- a/src/server/SocketListener.cpp +++ b/src/server/SocketListener.cpp @@ -33,6 +33,7 @@ #include <cstdint> #include <cstdlib> #include <cstring> +#include <memory> #include <sstream> #include <string> #include <thread> @@ -170,14 +171,14 @@ ingen_listen(Engine* engine, Raul::Socket* unix_sock, Raul::Socket* net_sock) } if (pfds[0].revents & POLLIN) { - SPtr<Raul::Socket> conn = unix_sock->accept(); + auto conn = unix_sock->accept(); if (conn) { new SocketServer(world, *engine, conn); } } if (pfds[1].revents & POLLIN) { - SPtr<Raul::Socket> conn = net_sock->accept(); + auto conn = net_sock->accept(); if (conn) { new SocketServer(world, *engine, conn); } diff --git a/src/server/SocketServer.hpp b/src/server/SocketServer.hpp index 9f762ddf..76cfa76a 100644 --- a/src/server/SocketServer.hpp +++ b/src/server/SocketServer.hpp @@ -29,6 +29,8 @@ #include "ingen/World.hpp" #include "raul/Socket.hpp" +#include <memory> + namespace ingen { namespace server { @@ -36,19 +38,19 @@ namespace server { class SocketServer { public: - SocketServer(World& world, - server::Engine& engine, - const SPtr<Raul::Socket>& sock) + SocketServer(World& world, + server::Engine& engine, + const std::shared_ptr<Raul::Socket>& sock) : _engine(engine) , _sink(world.conf().option("dump").get<int32_t>() - ? SPtr<Interface>( - new Tee({SPtr<Interface>(new EventWriter(engine)), - SPtr<Interface>(new StreamWriter(world.uri_map(), + ? std::shared_ptr<Interface>( + new Tee({std::shared_ptr<Interface>(new EventWriter(engine)), + std::shared_ptr<Interface>(new StreamWriter(world.uri_map(), world.uris(), URI("ingen:/engine"), stderr, ColorContext::Color::CYAN))})) - : SPtr<Interface>(new EventWriter(engine))) + : std::shared_ptr<Interface>(new EventWriter(engine))) , _reader(new SocketReader(world, *_sink, sock)) , _writer(new SocketWriter(world.uri_map(), world.uris(), @@ -72,10 +74,10 @@ protected: } private: - server::Engine& _engine; - SPtr<Interface> _sink; - SPtr<SocketReader> _reader; - SPtr<SocketWriter> _writer; + server::Engine& _engine; + std::shared_ptr<Interface> _sink; + std::shared_ptr<SocketReader> _reader; + std::shared_ptr<SocketWriter> _writer; }; } // namespace server diff --git a/src/server/Worker.cpp b/src/server/Worker.cpp index 1180fa47..a0747ae8 100644 --- a/src/server/Worker.cpp +++ b/src/server/Worker.cpp @@ -25,6 +25,7 @@ #include "lv2/worker/worker.h" #include <cstdlib> +#include <memory> namespace ingen { @@ -91,7 +92,7 @@ Worker::request(LV2Block* block, return LV2_WORKER_SUCCESS; } -SPtr<LV2_Feature> +std::shared_ptr<LV2_Feature> Worker::Schedule::feature(World&, Node* n) { auto* block = dynamic_cast<LV2Block*>(n); @@ -108,7 +109,7 @@ Worker::Schedule::feature(World&, Node* n) f->URI = LV2_WORKER__schedule; f->data = data; - return SPtr<LV2_Feature>(f, &free_feature); + return std::shared_ptr<LV2_Feature>(f, &free_feature); } Worker::Worker(Log& log, uint32_t buffer_size, bool synchronous) diff --git a/src/server/Worker.hpp b/src/server/Worker.hpp index cc79629c..7d5c1f02 100644 --- a/src/server/Worker.hpp +++ b/src/server/Worker.hpp @@ -18,7 +18,6 @@ #define INGEN_ENGINE_WORKER_HPP #include "ingen/LV2Features.hpp" -#include "ingen/memory.hpp" #include "lv2/worker/worker.h" #include "raul/RingBuffer.hpp" #include "raul/Semaphore.hpp" @@ -46,7 +45,7 @@ public: const char* uri() const override { return LV2_WORKER__schedule; } - SPtr<LV2_Feature> feature(World& world, Node* n) override; + std::shared_ptr<LV2_Feature> feature(World& world, Node* n) override; const bool synchronous; }; @@ -55,10 +54,10 @@ public: uint32_t size, const void* data); - SPtr<Schedule> schedule_feature() { return _schedule; } + std::shared_ptr<Schedule> schedule_feature() { return _schedule; } private: - SPtr<Schedule> _schedule; + std::shared_ptr<Schedule> _schedule; Log& _log; Raul::Semaphore _sem; diff --git a/src/server/events/Connect.cpp b/src/server/events/Connect.cpp index b269ca45..444bd4b7 100644 --- a/src/server/events/Connect.cpp +++ b/src/server/events/Connect.cpp @@ -39,15 +39,16 @@ namespace ingen { namespace server { namespace events { -Connect::Connect(Engine& engine, - const SPtr<Interface>& client, - SampleCount timestamp, - const ingen::Connect& msg) - : Event(engine, client, msg.seq, timestamp) - , _msg(msg) - , _graph(nullptr) - , _head(nullptr) -{} +Connect::Connect(Engine& engine, + const std::shared_ptr<Interface>& client, + SampleCount timestamp, + const ingen::Connect& msg) + : Event(engine, client, msg.seq, timestamp) + , _msg(msg) + , _graph(nullptr) + , _head(nullptr) +{ +} bool Connect::pre_process(PreProcessContext& ctx) diff --git a/src/server/events/Connect.hpp b/src/server/events/Connect.hpp index 305ad7a8..217860ac 100644 --- a/src/server/events/Connect.hpp +++ b/src/server/events/Connect.hpp @@ -22,6 +22,10 @@ #include "PortImpl.hpp" #include "types.hpp" +#include "ingen/memory.hpp" + +#include <memory> + namespace ingen { namespace server { @@ -38,10 +42,10 @@ namespace events { class Connect : public Event { public: - Connect(Engine& engine, - const SPtr<Interface>& client, - SampleCount timestamp, - const ingen::Connect& msg); + Connect(Engine& engine, + const std::shared_ptr<Interface>& client, + SampleCount timestamp, + const ingen::Connect& msg); bool pre_process(PreProcessContext& ctx) override; void execute(RunContext& ctx) override; @@ -49,16 +53,16 @@ public: void undo(Interface& target) override; private: - const ingen::Connect _msg; - GraphImpl* _graph; - InputPort* _head; - MPtr<CompiledGraph> _compiled_graph; - SPtr<ArcImpl> _arc; - MPtr<PortImpl::Voices> _voices; - Properties _tail_remove; - Properties _tail_add; - Properties _head_remove; - Properties _head_add; + const ingen::Connect _msg; + GraphImpl* _graph; + InputPort* _head; + MPtr<CompiledGraph> _compiled_graph; + std::shared_ptr<ArcImpl> _arc; + MPtr<PortImpl::Voices> _voices; + Properties _tail_remove; + Properties _tail_add; + Properties _head_remove; + Properties _head_add; }; } // namespace events diff --git a/src/server/events/Copy.cpp b/src/server/events/Copy.cpp index dbe57dc0..d57849b2 100644 --- a/src/server/events/Copy.cpp +++ b/src/server/events/Copy.cpp @@ -37,15 +37,15 @@ namespace ingen { namespace server { namespace events { -Copy::Copy(Engine& engine, - const SPtr<Interface>& client, - SampleCount timestamp, - const ingen::Copy& msg) - : Event(engine, client, msg.seq, timestamp) - , _msg(msg) - , _old_block(nullptr) - , _parent(nullptr) - , _block(nullptr) +Copy::Copy(Engine& engine, + const std::shared_ptr<Interface>& client, + SampleCount timestamp, + const ingen::Copy& msg) + : Event(engine, client, msg.seq, timestamp) + , _msg(msg) + , _old_block(nullptr) + , _parent(nullptr) + , _block(nullptr) {} bool diff --git a/src/server/events/Copy.hpp b/src/server/events/Copy.hpp index aa1eae5d..fb788873 100644 --- a/src/server/events/Copy.hpp +++ b/src/server/events/Copy.hpp @@ -20,6 +20,10 @@ #include "CompiledGraph.hpp" #include "Event.hpp" +#include "ingen/memory.hpp" + +#include <memory> + namespace ingen { namespace server { @@ -35,10 +39,10 @@ namespace events { class Copy : public Event { public: - Copy(Engine& engine, - const SPtr<Interface>& client, - SampleCount timestamp, - const ingen::Copy& msg); + Copy(Engine& engine, + const std::shared_ptr<Interface>& client, + SampleCount timestamp, + const ingen::Copy& msg); bool pre_process(PreProcessContext& ctx) override; void execute(RunContext& ctx) override; @@ -50,11 +54,11 @@ private: bool engine_to_filesystem(PreProcessContext& ctx); bool filesystem_to_engine(PreProcessContext& ctx); - const ingen::Copy _msg; - SPtr<BlockImpl> _old_block; - GraphImpl* _parent; - BlockImpl* _block; - MPtr<CompiledGraph> _compiled_graph; + const ingen::Copy _msg; + std::shared_ptr<BlockImpl> _old_block; + GraphImpl* _parent; + BlockImpl* _block; + MPtr<CompiledGraph> _compiled_graph; }; } // namespace events diff --git a/src/server/events/CreateBlock.cpp b/src/server/events/CreateBlock.cpp index 4b48cfde..c443645a 100644 --- a/src/server/events/CreateBlock.cpp +++ b/src/server/events/CreateBlock.cpp @@ -32,23 +32,24 @@ #include "raul/Maid.hpp" #include "raul/Path.hpp" +#include <memory> #include <utility> namespace ingen { namespace server { namespace events { -CreateBlock::CreateBlock(Engine& engine, - const SPtr<Interface>& client, - int32_t id, - SampleCount timestamp, - const Raul::Path& path, - Properties& properties) - : Event(engine, client, id, timestamp) - , _path(path) - , _properties(properties) - , _graph(nullptr) - , _block(nullptr) +CreateBlock::CreateBlock(Engine& engine, + const std::shared_ptr<Interface>& client, + int32_t id, + SampleCount timestamp, + const Raul::Path& path, + Properties& properties) + : Event(engine, client, id, timestamp) + , _path(path) + , _properties(properties) + , _graph(nullptr) + , _block(nullptr) {} bool @@ -56,8 +57,8 @@ CreateBlock::pre_process(PreProcessContext& ctx) { using iterator = Properties::const_iterator; - const ingen::URIs& uris = _engine.world().uris(); - const SPtr<Store> store = _engine.store(); + const ingen::URIs& uris = _engine.world().uris(); + const std::shared_ptr<Store> store = _engine.store(); // Check sanity of target path if (_path.is_root()) { diff --git a/src/server/events/CreateBlock.hpp b/src/server/events/CreateBlock.hpp index a9f43a80..dc2efa58 100644 --- a/src/server/events/CreateBlock.hpp +++ b/src/server/events/CreateBlock.hpp @@ -21,7 +21,10 @@ #include "CompiledGraph.hpp" #include "Event.hpp" +#include "ingen/memory.hpp" + #include <cstdint> +#include <memory> namespace ingen { namespace server { @@ -38,12 +41,12 @@ namespace events { class CreateBlock : public Event { public: - CreateBlock(Engine& engine, - const SPtr<Interface>& client, - int32_t id, - SampleCount timestamp, - const Raul::Path& path, - Properties& properties); + CreateBlock(Engine& engine, + const std::shared_ptr<Interface>& client, + int32_t id, + SampleCount timestamp, + const Raul::Path& path, + Properties& properties); bool pre_process(PreProcessContext& ctx) override; void execute(RunContext& ctx) override; diff --git a/src/server/events/CreateGraph.cpp b/src/server/events/CreateGraph.cpp index 7a1d9a75..1b04482f 100644 --- a/src/server/events/CreateGraph.cpp +++ b/src/server/events/CreateGraph.cpp @@ -26,26 +26,28 @@ #include "ingen/Store.hpp" #include "ingen/URIs.hpp" #include "ingen/World.hpp" +#include "ingen/memory.hpp" #include "raul/Maid.hpp" #include "raul/Path.hpp" +#include <memory> #include <utility> namespace ingen { namespace server { namespace events { -CreateGraph::CreateGraph(Engine& engine, - const SPtr<Interface>& client, - int32_t id, - SampleCount timestamp, - const Raul::Path& path, - const Properties& properties) - : Event(engine, client, id, timestamp) - , _path(path) - , _properties(properties) - , _graph(nullptr) - , _parent(nullptr) +CreateGraph::CreateGraph(Engine& engine, + const std::shared_ptr<Interface>& client, + int32_t id, + SampleCount timestamp, + const Raul::Path& path, + const Properties& properties) + : Event(engine, client, id, timestamp) + , _path(path) + , _properties(properties) + , _graph(nullptr) + , _parent(nullptr) {} void diff --git a/src/server/events/CreateGraph.hpp b/src/server/events/CreateGraph.hpp index 7fbf9bdc..ea24891d 100644 --- a/src/server/events/CreateGraph.hpp +++ b/src/server/events/CreateGraph.hpp @@ -41,12 +41,12 @@ namespace events { class CreateGraph : public Event { public: - CreateGraph(Engine& engine, - const SPtr<Interface>& client, - int32_t id, - SampleCount timestamp, - const Raul::Path& path, - const Properties& properties); + CreateGraph(Engine& engine, + const std::shared_ptr<Interface>& client, + int32_t id, + SampleCount timestamp, + const Raul::Path& path, + const Properties& properties); bool pre_process(PreProcessContext& ctx) override; void execute(RunContext& ctx) override; diff --git a/src/server/events/CreatePort.cpp b/src/server/events/CreatePort.cpp index 2520378c..2cf66386 100644 --- a/src/server/events/CreatePort.cpp +++ b/src/server/events/CreatePort.cpp @@ -30,30 +30,32 @@ #include "ingen/URIMap.hpp" #include "ingen/URIs.hpp" #include "ingen/World.hpp" +#include "ingen/memory.hpp" #include "raul/Array.hpp" #include "raul/Path.hpp" #include <cassert> +#include <memory> #include <utility> namespace ingen { namespace server { namespace events { -CreatePort::CreatePort(Engine& engine, - const SPtr<Interface>& client, - int32_t id, - SampleCount timestamp, - const Raul::Path& path, - const Properties& properties) - : Event(engine, client, id, timestamp) - , _path(path) - , _port_type(PortType::UNKNOWN) - , _buf_type(0) - , _graph(nullptr) - , _graph_port(nullptr) - , _engine_port(nullptr) - , _properties(properties) +CreatePort::CreatePort(Engine& engine, + const std::shared_ptr<Interface>& client, + int32_t id, + SampleCount timestamp, + const Raul::Path& path, + const Properties& properties) + : Event(engine, client, id, timestamp) + , _path(path) + , _port_type(PortType::UNKNOWN) + , _buf_type(0) + , _graph(nullptr) + , _graph_port(nullptr) + , _engine_port(nullptr) + , _properties(properties) { const ingen::URIs& uris = _engine.world().uris(); diff --git a/src/server/events/CreatePort.hpp b/src/server/events/CreatePort.hpp index 9ad8987a..c0f57655 100644 --- a/src/server/events/CreatePort.hpp +++ b/src/server/events/CreatePort.hpp @@ -21,12 +21,14 @@ #include "Event.hpp" #include "PortType.hpp" +#include "ingen/memory.hpp" #include "lv2/urid/urid.h" #include "raul/Path.hpp" #include <boost/optional/optional.hpp> #include <cstdint> +#include <memory> namespace ingen { namespace server { @@ -44,12 +46,12 @@ namespace events { class CreatePort : public Event { public: - CreatePort(Engine& engine, - const SPtr<Interface>& client, - int32_t id, - SampleCount timestamp, - const Raul::Path& path, - const Properties& properties); + CreatePort(Engine& engine, + const std::shared_ptr<Interface>& client, + int32_t id, + SampleCount timestamp, + const Raul::Path& path, + const Properties& properties); bool pre_process(PreProcessContext& ctx) override; void execute(RunContext& ctx) override; diff --git a/src/server/events/Delete.cpp b/src/server/events/Delete.cpp index d0a77a31..fb5035ec 100644 --- a/src/server/events/Delete.cpp +++ b/src/server/events/Delete.cpp @@ -31,6 +31,7 @@ #include "ingen/Forge.hpp" #include "ingen/Store.hpp" #include "ingen/World.hpp" +#include "ingen/memory.hpp" #include "raul/Maid.hpp" #include "raul/Path.hpp" @@ -44,10 +45,10 @@ namespace ingen { namespace server { namespace events { -Delete::Delete(Engine& engine, - const SPtr<Interface>& client, - FrameTime timestamp, - const ingen::Del& msg) +Delete::Delete(Engine& engine, + const std::shared_ptr<Interface>& client, + FrameTime timestamp, + const ingen::Del& msg) : Event(engine, client, msg.seq, timestamp) , _msg(msg) , _engine_port(nullptr) diff --git a/src/server/events/Delete.hpp b/src/server/events/Delete.hpp index c556bbd9..bda7a784 100644 --- a/src/server/events/Delete.hpp +++ b/src/server/events/Delete.hpp @@ -22,6 +22,7 @@ #include "GraphImpl.hpp" #include "ingen/Store.hpp" +#include "ingen/memory.hpp" #include <cstdint> #include <map> @@ -46,10 +47,10 @@ class DisconnectAll; class Delete : public Event { public: - Delete(Engine& engine, - const SPtr<Interface>& client, - FrameTime timestamp, - const ingen::Del& msg); + Delete(Engine& engine, + const std::shared_ptr<Interface>& client, + FrameTime timestamp, + const ingen::Del& msg); ~Delete() override; @@ -64,8 +65,8 @@ private: const ingen::Del _msg; Raul::Path _path; - SPtr<BlockImpl> _block; ///< Non-null iff a block - SPtr<DuplexPort> _port; ///< Non-null iff a port + std::shared_ptr<BlockImpl> _block; ///< Non-null iff a block + std::shared_ptr<DuplexPort> _port; ///< Non-null iff a port EnginePort* _engine_port; MPtr<GraphImpl::Ports> _ports_array; ///< New (external) ports for Graph MPtr<CompiledGraph> _compiled_graph; ///< Graph's new process order diff --git a/src/server/events/Delta.cpp b/src/server/events/Delta.cpp index 2dc9e22b..04b30630 100644 --- a/src/server/events/Delta.cpp +++ b/src/server/events/Delta.cpp @@ -33,8 +33,10 @@ #include "ingen/Store.hpp" #include "ingen/URIs.hpp" #include "ingen/World.hpp" +#include "ingen/memory.hpp" #include "raul/Maid.hpp" +#include <memory> #include <mutex> #include <set> #include <string> @@ -48,10 +50,10 @@ class PreProcessContext; namespace events { -Delta::Delta(Engine& engine, - const SPtr<Interface>& client, - SampleCount timestamp, - const ingen::Put& msg) +Delta::Delta(Engine& engine, + const std::shared_ptr<Interface>& client, + SampleCount timestamp, + const ingen::Put& msg) : Event(engine, client, msg.seq, timestamp) , _create_event(nullptr) , _subject(msg.uri) @@ -67,10 +69,10 @@ Delta::Delta(Engine& engine, init(); } -Delta::Delta(Engine& engine, - const SPtr<Interface>& client, - SampleCount timestamp, - const ingen::Delta& msg) +Delta::Delta(Engine& engine, + const std::shared_ptr<Interface>& client, + SampleCount timestamp, + const ingen::Delta& msg) : Event(engine, client, msg.seq, timestamp) , _create_event(nullptr) , _subject(msg.uri) @@ -87,10 +89,10 @@ Delta::Delta(Engine& engine, init(); } -Delta::Delta(Engine& engine, - const SPtr<Interface>& client, - SampleCount timestamp, - const ingen::SetProperty& msg) +Delta::Delta(Engine& engine, + const std::shared_ptr<Interface>& client, + SampleCount timestamp, + const ingen::SetProperty& msg) : Event(engine, client, msg.seq, timestamp) , _subject(msg.subject) , _properties{{msg.predicate, msg.value}} diff --git a/src/server/events/Delta.hpp b/src/server/events/Delta.hpp index c4199262..40c3cc27 100644 --- a/src/server/events/Delta.hpp +++ b/src/server/events/Delta.hpp @@ -21,6 +21,7 @@ #include "ControlBindings.hpp" #include "Event.hpp" +#include "ingen/memory.hpp" #include "lilv/lilv.h" #include <boost/optional/optional.hpp> @@ -48,20 +49,20 @@ class SetPortValue; class Delta : public Event { public: - Delta(Engine& engine, - const SPtr<Interface>& client, - SampleCount timestamp, - const ingen::Put& msg); + Delta(Engine& engine, + const std::shared_ptr<Interface>& client, + SampleCount timestamp, + const ingen::Put& msg); - Delta(Engine& engine, - const SPtr<Interface>& client, - SampleCount timestamp, - const ingen::Delta& msg); + Delta(Engine& engine, + const std::shared_ptr<Interface>& client, + SampleCount timestamp, + const ingen::Delta& msg); - Delta(Engine& engine, - const SPtr<Interface>& client, - SampleCount timestamp, - const ingen::SetProperty& msg); + Delta(Engine& engine, + const std::shared_ptr<Interface>& client, + SampleCount timestamp, + const ingen::SetProperty& msg); ~Delta() override = default; @@ -78,11 +79,7 @@ public: Execution get_execution() const override; private: - enum class Type { - SET, - PUT, - PATCH - }; + enum class Type { SET, PUT, PATCH }; enum class SpecialType { NONE, diff --git a/src/server/events/Disconnect.cpp b/src/server/events/Disconnect.cpp index 3df5fd64..4918e5bf 100644 --- a/src/server/events/Disconnect.cpp +++ b/src/server/events/Disconnect.cpp @@ -29,6 +29,7 @@ #include "ThreadManager.hpp" #include "ingen/Store.hpp" +#include "ingen/memory.hpp" #include "raul/Maid.hpp" #include "raul/Path.hpp" @@ -43,10 +44,10 @@ namespace ingen { namespace server { namespace events { -Disconnect::Disconnect(Engine& engine, - const SPtr<Interface>& client, - SampleCount timestamp, - const ingen::Disconnect& msg) +Disconnect::Disconnect(Engine& engine, + const std::shared_ptr<Interface>& client, + SampleCount timestamp, + const ingen::Disconnect& msg) : Event(engine, client, msg.seq, timestamp) , _msg(msg) , _graph(nullptr) diff --git a/src/server/events/Disconnect.hpp b/src/server/events/Disconnect.hpp index d6a455c8..8b43d0d0 100644 --- a/src/server/events/Disconnect.hpp +++ b/src/server/events/Disconnect.hpp @@ -20,6 +20,7 @@ #include "CompiledGraph.hpp" #include "Event.hpp" #include "PortImpl.hpp" +#include "ingen/memory.hpp" #include "types.hpp" #include <memory> @@ -39,10 +40,10 @@ namespace events { class Disconnect : public Event { public: - Disconnect(Engine& engine, - const SPtr<Interface>& client, - SampleCount timestamp, - const ingen::Disconnect& msg); + Disconnect(Engine& engine, + const std::shared_ptr<Interface>& client, + SampleCount timestamp, + const ingen::Disconnect& msg); bool pre_process(PreProcessContext& ctx) override; void execute(RunContext& ctx) override; @@ -59,11 +60,11 @@ public: inline InputPort* head() { return _head; } private: - Engine& _engine; - PortImpl* _tail; - InputPort* _head; - SPtr<ArcImpl> _arc; - MPtr<PortImpl::Voices> _voices; + Engine& _engine; + PortImpl* _tail; + InputPort* _head; + std::shared_ptr<ArcImpl> _arc; + MPtr<PortImpl::Voices> _voices; }; private: diff --git a/src/server/events/DisconnectAll.cpp b/src/server/events/DisconnectAll.cpp index cc4284ff..47f8092a 100644 --- a/src/server/events/DisconnectAll.cpp +++ b/src/server/events/DisconnectAll.cpp @@ -32,6 +32,7 @@ #include "raul/Maid.hpp" #include "raul/Path.hpp" +#include <memory> #include <mutex> #include <set> #include <utility> @@ -40,16 +41,16 @@ namespace ingen { namespace server { namespace events { -DisconnectAll::DisconnectAll(Engine& engine, - const SPtr<Interface>& client, - SampleCount timestamp, - const ingen::DisconnectAll& msg) - : Event(engine, client, msg.seq, timestamp) - , _msg(msg) - , _parent(nullptr) - , _block(nullptr) - , _port(nullptr) - , _deleting(false) +DisconnectAll::DisconnectAll(Engine& engine, + const std::shared_ptr<Interface>& client, + SampleCount timestamp, + const ingen::DisconnectAll& msg) + : Event(engine, client, msg.seq, timestamp) + , _msg(msg) + , _parent(nullptr) + , _block(nullptr) + , _port(nullptr) + , _deleting(false) { } diff --git a/src/server/events/DisconnectAll.hpp b/src/server/events/DisconnectAll.hpp index 09d1165f..9080d3e7 100644 --- a/src/server/events/DisconnectAll.hpp +++ b/src/server/events/DisconnectAll.hpp @@ -21,9 +21,11 @@ #include "Disconnect.hpp" #include "Event.hpp" +#include "ingen/memory.hpp" #include "raul/Path.hpp" #include <list> +#include <memory> namespace ingen { namespace server { @@ -43,10 +45,10 @@ class Disconnect; class DisconnectAll : public Event { public: - DisconnectAll(Engine& engine, - const SPtr<Interface>& client, - SampleCount timestamp, - const ingen::DisconnectAll& msg); + DisconnectAll(Engine& engine, + const std::shared_ptr<Interface>& client, + SampleCount timestamp, + const ingen::DisconnectAll& msg); DisconnectAll(Engine& engine, GraphImpl* parent, diff --git a/src/server/events/Get.cpp b/src/server/events/Get.cpp index 9194226d..1399fd6d 100644 --- a/src/server/events/Get.cpp +++ b/src/server/events/Get.cpp @@ -31,16 +31,17 @@ #include "ingen/World.hpp" #include <cstdint> +#include <memory> #include <mutex> namespace ingen { namespace server { namespace events { -Get::Get(Engine& engine, - const SPtr<Interface>& client, - SampleCount timestamp, - const ingen::Get& msg) +Get::Get(Engine& engine, + const std::shared_ptr<Interface>& client, + SampleCount timestamp, + const ingen::Get& msg) : Event(engine, client, msg.seq, timestamp) , _msg(msg) , _object(nullptr) diff --git a/src/server/events/Get.hpp b/src/server/events/Get.hpp index 0c3d053d..2ccb88e3 100644 --- a/src/server/events/Get.hpp +++ b/src/server/events/Get.hpp @@ -22,6 +22,8 @@ #include "Event.hpp" #include "types.hpp" +#include <memory> + namespace ingen { namespace server { @@ -39,10 +41,10 @@ namespace events { class Get : public Event { public: - Get(Engine& engine, - const SPtr<Interface>& client, - SampleCount timestamp, - const ingen::Get& msg); + Get(Engine& engine, + const std::shared_ptr<Interface>& client, + SampleCount timestamp, + const ingen::Get& msg); bool pre_process(PreProcessContext& ctx) override; void execute(RunContext&) override; diff --git a/src/server/events/Mark.cpp b/src/server/events/Mark.cpp index d7eb1804..8db6335c 100644 --- a/src/server/events/Mark.cpp +++ b/src/server/events/Mark.cpp @@ -20,6 +20,8 @@ #include "PreProcessContext.hpp" #include "UndoStack.hpp" +#include "ingen/memory.hpp" + #include <memory> #include <utility> @@ -27,19 +29,19 @@ namespace ingen { namespace server { namespace events { -Mark::Mark(Engine& engine, - const SPtr<Interface>& client, - SampleCount timestamp, - const ingen::BundleBegin& msg) +Mark::Mark(Engine& engine, + const std::shared_ptr<Interface>& client, + SampleCount timestamp, + const ingen::BundleBegin& msg) : Event(engine, client, msg.seq, timestamp) , _type(Type::BUNDLE_BEGIN) , _depth(-1) {} -Mark::Mark(Engine& engine, - const SPtr<Interface>& client, - SampleCount timestamp, - const ingen::BundleEnd& msg) +Mark::Mark(Engine& engine, + const std::shared_ptr<Interface>& client, + SampleCount timestamp, + const ingen::BundleEnd& msg) : Event(engine, client, msg.seq, timestamp) , _type(Type::BUNDLE_END) , _depth(-1) diff --git a/src/server/events/Mark.hpp b/src/server/events/Mark.hpp index 2bcdafb2..b6279f0c 100644 --- a/src/server/events/Mark.hpp +++ b/src/server/events/Mark.hpp @@ -19,7 +19,10 @@ #include "Event.hpp" +#include "ingen/memory.hpp" + #include <map> +#include <memory> namespace ingen { namespace server { @@ -40,15 +43,15 @@ namespace events { class Mark : public Event { public: - Mark(Engine& engine, - const SPtr<Interface>& client, - SampleCount timestamp, - const ingen::BundleBegin& msg); - - Mark(Engine& engine, - const SPtr<Interface>& client, - SampleCount timestamp, - const ingen::BundleEnd& msg); + Mark(Engine& engine, + const std::shared_ptr<Interface>& client, + SampleCount timestamp, + const ingen::BundleBegin& msg); + + Mark(Engine& engine, + const std::shared_ptr<Interface>& client, + SampleCount timestamp, + const ingen::BundleEnd& msg); void mark(PreProcessContext& ctx) override; bool pre_process(PreProcessContext& ctx) override; diff --git a/src/server/events/Move.cpp b/src/server/events/Move.cpp index d7262143..13d92ef2 100644 --- a/src/server/events/Move.cpp +++ b/src/server/events/Move.cpp @@ -25,16 +25,17 @@ #include "GraphImpl.hpp" #include "events/Move.hpp" +#include <memory> #include <mutex> namespace ingen { namespace server { namespace events { -Move::Move(Engine& engine, - const SPtr<Interface>& client, - SampleCount timestamp, - const ingen::Move& msg) +Move::Move(Engine& engine, + const std::shared_ptr<Interface>& client, + SampleCount timestamp, + const ingen::Move& msg) : Event(engine, client, msg.seq, timestamp) , _msg(msg) { diff --git a/src/server/events/Move.hpp b/src/server/events/Move.hpp index 5c71ce96..7037388f 100644 --- a/src/server/events/Move.hpp +++ b/src/server/events/Move.hpp @@ -22,6 +22,8 @@ #include "ingen/Store.hpp" #include "raul/Path.hpp" +#include <memory> + namespace ingen { namespace server { @@ -36,10 +38,10 @@ namespace events { class Move : public Event { public: - Move(Engine& engine, - const SPtr<Interface>& client, - SampleCount timestamp, - const ingen::Move& msg); + Move(Engine& engine, + const std::shared_ptr<Interface>& client, + SampleCount timestamp, + const ingen::Move& msg); bool pre_process(PreProcessContext& ctx) override; void execute(RunContext& ctx) override; diff --git a/src/server/events/SetPortValue.cpp b/src/server/events/SetPortValue.cpp index 66511a0c..c8c60e04 100644 --- a/src/server/events/SetPortValue.cpp +++ b/src/server/events/SetPortValue.cpp @@ -31,20 +31,21 @@ #include "ingen/World.hpp" #include <cassert> +#include <memory> namespace ingen { namespace server { namespace events { /** Internal */ -SetPortValue::SetPortValue(Engine& engine, - const SPtr<Interface>& client, - int32_t id, - SampleCount timestamp, - PortImpl* port, - const Atom& value, - bool activity, - bool synthetic) +SetPortValue::SetPortValue(Engine& engine, + const std::shared_ptr<Interface>& client, + int32_t id, + SampleCount timestamp, + PortImpl* port, + const Atom& value, + bool activity, + bool synthetic) : Event(engine, client, id, timestamp) , _port(port) , _value(value) diff --git a/src/server/events/SetPortValue.hpp b/src/server/events/SetPortValue.hpp index df30d514..576b01a0 100644 --- a/src/server/events/SetPortValue.hpp +++ b/src/server/events/SetPortValue.hpp @@ -25,6 +25,7 @@ #include "ingen/Atom.hpp" #include <cstdint> +#include <memory> namespace ingen { namespace server { @@ -40,14 +41,14 @@ namespace events { class SetPortValue : public Event { public: - SetPortValue(Engine& engine, - const SPtr<Interface>& client, - int32_t id, - SampleCount timestamp, - PortImpl* port, - const Atom& value, - bool activity, - bool synthetic = false); + SetPortValue(Engine& engine, + const std::shared_ptr<Interface>& client, + int32_t id, + SampleCount timestamp, + PortImpl* port, + const Atom& value, + bool activity, + bool synthetic = false); bool pre_process(PreProcessContext& ctx) override; void execute(RunContext& ctx) override; diff --git a/src/server/events/Undo.cpp b/src/server/events/Undo.cpp index c855dbfb..22695415 100644 --- a/src/server/events/Undo.cpp +++ b/src/server/events/Undo.cpp @@ -22,23 +22,24 @@ #include "ingen/AtomReader.hpp" #include <deque> +#include <memory> namespace ingen { namespace server { namespace events { -Undo::Undo(Engine& engine, - const SPtr<Interface>& client, - SampleCount timestamp, - const ingen::Undo& msg) +Undo::Undo(Engine& engine, + const std::shared_ptr<Interface>& client, + SampleCount timestamp, + const ingen::Undo& msg) : Event(engine, client, msg.seq, timestamp) , _is_redo(false) {} -Undo::Undo(Engine& engine, - const SPtr<Interface>& client, - SampleCount timestamp, - const ingen::Redo& msg) +Undo::Undo(Engine& engine, + const std::shared_ptr<Interface>& client, + SampleCount timestamp, + const ingen::Redo& msg) : Event(engine, client, msg.seq, timestamp) , _is_redo(true) {} diff --git a/src/server/events/Undo.hpp b/src/server/events/Undo.hpp index 1fdaa4dd..7be79a39 100644 --- a/src/server/events/Undo.hpp +++ b/src/server/events/Undo.hpp @@ -21,6 +21,8 @@ #include "UndoStack.hpp" #include "types.hpp" +#include <memory> + namespace ingen { namespace server { namespace events { @@ -32,15 +34,15 @@ namespace events { class Undo : public Event { public: - Undo(Engine& engine, - const SPtr<Interface>& client, - SampleCount timestamp, - const ingen::Undo& msg); - - Undo(Engine& engine, - const SPtr<Interface>& client, - SampleCount timestamp, - const ingen::Redo& msg); + Undo(Engine& engine, + const std::shared_ptr<Interface>& client, + SampleCount timestamp, + const ingen::Undo& msg); + + Undo(Engine& engine, + const std::shared_ptr<Interface>& client, + SampleCount timestamp, + const ingen::Redo& msg); bool pre_process(PreProcessContext& ctx) override; void execute(RunContext& ctx) override; diff --git a/src/server/ingen_engine.cpp b/src/server/ingen_engine.cpp index fba2e434..429ac8e1 100644 --- a/src/server/ingen_engine.cpp +++ b/src/server/ingen_engine.cpp @@ -21,12 +21,14 @@ #include "ingen/Module.hpp" #include "ingen/World.hpp" +#include <memory> + using namespace ingen; struct IngenEngineModule : public ingen::Module { void load(ingen::World& world) override { server::set_denormal_flags(world.log()); - SPtr<server::Engine> engine(new server::Engine(world)); + auto engine = std::make_shared<server::Engine>(world); world.set_engine(engine); if (!world.interface()) { world.set_interface(engine->interface()); diff --git a/src/server/ingen_jack.cpp b/src/server/ingen_jack.cpp index 62fef4e3..0bbf2640 100644 --- a/src/server/ingen_jack.cpp +++ b/src/server/ingen_jack.cpp @@ -23,6 +23,7 @@ #include "ingen/Module.hpp" #include "ingen/World.hpp" +#include <memory> #include <string> using namespace ingen; @@ -45,7 +46,7 @@ struct IngenJackModule : public ingen::Module { world.conf().option("jack-name").ptr<char>(), nullptr); - engine->set_driver(SPtr<server::Driver>(driver)); + engine->set_driver(std::shared_ptr<server::Driver>(driver)); } }; diff --git a/src/server/ingen_lv2.cpp b/src/server/ingen_lv2.cpp index ed86ee03..d1fb293e 100644 --- a/src/server/ingen_lv2.cpp +++ b/src/server/ingen_lv2.cpp @@ -88,7 +88,7 @@ class Lib { public: explicit Lib(const char* bundle_path); - using Graphs = std::vector<SPtr<const LV2Graph>>; + using Graphs = std::vector<std::shared_ptr<const LV2Graph>>; Graphs graphs; }; @@ -434,7 +434,8 @@ using namespace ingen; using namespace ingen::server; static void -ingen_lv2_main(const SPtr<Engine>& engine, const SPtr<LV2Driver>& driver) +ingen_lv2_main(const std::shared_ptr<Engine>& engine, + const std::shared_ptr<LV2Driver>& driver) { while (true) { // Wait until there is work to be done @@ -452,7 +453,7 @@ ingen_lv2_main(const SPtr<Engine>& engine, const SPtr<LV2Driver>& driver) struct IngenPlugin { std::unique_ptr<ingen::World> world; - SPtr<Engine> engine; + std::shared_ptr<Engine> engine; std::unique_ptr<std::thread> main; LV2_URID_Map* map = nullptr; int argc = 0; @@ -472,7 +473,7 @@ find_graphs(const URI& manifest_uri) Lib::Graphs graphs; for (const auto& r : resources) { - graphs.push_back(SPtr<const LV2Graph>(new LV2Graph(r))); + graphs.push_back(std::make_shared<LV2Graph>(r)); } return graphs; @@ -572,11 +573,11 @@ ingen_instantiate(const LV2_Descriptor* descriptor, "queue-size", plugin->world->forge().make(std::max(block_length, seq_size) * 4)); - SPtr<server::Engine> engine(new server::Engine(*plugin->world)); + auto engine = std::make_shared<server::Engine>(*plugin->world); plugin->engine = engine; plugin->world->set_engine(engine); - SPtr<Interface> interface = engine->interface(); + std::shared_ptr<Interface> interface = engine->interface(); plugin->world->set_interface(interface); @@ -584,7 +585,7 @@ ingen_instantiate(const LV2_Descriptor* descriptor, server::ThreadManager::single_threaded = true; auto* driver = new LV2Driver(*engine, block_length, seq_size, rate); - engine->set_driver(SPtr<ingen::server::Driver>(driver)); + engine->set_driver(std::shared_ptr<ingen::server::Driver>(driver)); engine->activate(); server::ThreadManager::single_threaded = true; @@ -611,7 +612,7 @@ ingen_instantiate(const LV2_Descriptor* descriptor, /* Register client after loading graph so the to-ui ring does not overflow. Since we are not yet rolling, it won't be drained, causing a deadlock. */ - SPtr<Interface> client(&driver->writer(), NullDeleter<Interface>); + std::shared_ptr<Interface> client(&driver->writer(), NullDeleter<Interface>); interface->set_respondee(client); engine->register_client(client); @@ -780,7 +781,7 @@ ingen_restore(LV2_Handle instance, #if 0 // Remove existing root graph contents - SPtr<Engine> engine = plugin->engine; + std::shared_ptr<Engine> engine = plugin->engine; for (const auto& b : engine->root_graph()->blocks()) { plugin->world->interface()->del(b.uri()); } diff --git a/src/server/ingen_portaudio.cpp b/src/server/ingen_portaudio.cpp index f5d95fb0..93180eba 100644 --- a/src/server/ingen_portaudio.cpp +++ b/src/server/ingen_portaudio.cpp @@ -20,7 +20,8 @@ #include "ingen/Log.hpp" #include "ingen/Module.hpp" #include "ingen/World.hpp" -#include "ingen/memory.hpp" + +#include <memory> namespace ingen { namespace server { class Driver; } } @@ -38,7 +39,7 @@ struct IngenPortAudioModule : public ingen::Module { auto* driver = new server::PortAudioDriver(*engine); driver->attach(); - engine->set_driver(SPtr<server::Driver>(driver)); + engine->set_driver(std::shared_ptr<server::Driver>(driver)); } }; diff --git a/src/server/internals/BlockDelay.cpp b/src/server/internals/BlockDelay.cpp index 2974ca18..cd9dbf9b 100644 --- a/src/server/internals/BlockDelay.cpp +++ b/src/server/internals/BlockDelay.cpp @@ -26,6 +26,8 @@ #include "raul/Array.hpp" #include "raul/Maid.hpp" +#include <memory> + namespace ingen { namespace server { diff --git a/src/server/internals/Controller.cpp b/src/server/internals/Controller.cpp index f2498eba..22549ae4 100644 --- a/src/server/internals/Controller.cpp +++ b/src/server/internals/Controller.cpp @@ -32,6 +32,7 @@ #include <cassert> #include <cmath> #include <initializer_list> +#include <memory> namespace ingen { namespace server { diff --git a/src/server/internals/Note.hpp b/src/server/internals/Note.hpp index 48320ac3..f101d466 100644 --- a/src/server/internals/Note.hpp +++ b/src/server/internals/Note.hpp @@ -20,7 +20,10 @@ #include "InternalBlock.hpp" #include "types.hpp" +#include "ingen/memory.hpp" + #include <cstdint> +#include <memory> namespace ingen { namespace server { diff --git a/src/server/internals/Time.cpp b/src/server/internals/Time.cpp index 3f5d2d8e..d81ca04d 100644 --- a/src/server/internals/Time.cpp +++ b/src/server/internals/Time.cpp @@ -29,6 +29,8 @@ #include "lv2/atom/util.h" #include "lv2/midi/midi.h" +#include <memory> + namespace ingen { namespace server { namespace internals { diff --git a/src/server/internals/Trigger.cpp b/src/server/internals/Trigger.cpp index d6dad889..cc966eb3 100644 --- a/src/server/internals/Trigger.cpp +++ b/src/server/internals/Trigger.cpp @@ -32,6 +32,7 @@ #include <cassert> #include <cmath> +#include <memory> namespace ingen { namespace server { |