From d3c0df029087b2c7c7f26a4365e85f8e500cc33e Mon Sep 17 00:00:00 2001 From: David Robillard Date: Thu, 6 Oct 2011 22:56:03 +0000 Subject: Align members of NodeImpl for slightly less memory consumption per node. git-svn-id: http://svn.drobilla.net/lad/trunk/ingen@3533 a436a847-0d15-0410-975c-d299462d15a1 --- src/server/LV2Node.hpp | 12 +++++------- src/server/NodeImpl.cpp | 12 ++++++++---- src/server/NodeImpl.hpp | 41 ++++++++++++++++++----------------------- src/server/OutputPort.hpp | 9 +++++---- 4 files changed, 36 insertions(+), 38 deletions(-) (limited to 'src/server') diff --git a/src/server/LV2Node.hpp b/src/server/LV2Node.hpp index 0e7e08ed..6fc91afc 100644 --- a/src/server/LV2Node.hpp +++ b/src/server/LV2Node.hpp @@ -68,13 +68,11 @@ protected: typedef Raul::Array< SharedPtr > Instances; - LV2Plugin* _lv2_plugin; - Instances* _instances; - Instances* _prepared_instances; - - LV2_Contexts_MessageContext* _message_funcs; - - SharedPtr _features; + LV2Plugin* _lv2_plugin; + Instances* _instances; + Instances* _prepared_instances; + LV2_Contexts_MessageContext* _message_funcs; + SharedPtr _features; }; } // namespace Server diff --git a/src/server/NodeImpl.cpp b/src/server/NodeImpl.cpp index 4b52fd6b..7fed6704 100644 --- a/src/server/NodeImpl.cpp +++ b/src/server/NodeImpl.cpp @@ -35,17 +35,21 @@ using namespace std; namespace Ingen { namespace Server { -NodeImpl::NodeImpl(PluginImpl* plugin, const Raul::Symbol& symbol, bool polyphonic, PatchImpl* parent, SampleRate srate) +NodeImpl::NodeImpl(PluginImpl* plugin, + const Raul::Symbol& symbol, + bool polyphonic, + PatchImpl* parent, + SampleRate srate) : GraphObjectImpl(plugin->uris(), parent, symbol) , _plugin(plugin) - , _polyphonic(polyphonic) + , _ports(NULL) + , _valid_ports(NULL) , _polyphony((polyphonic && parent) ? parent->internal_poly() : 1) , _srate(srate) - , _valid_ports(NULL) , _input_ready(1) , _process_lock(0) , _n_inputs_ready(0) - , _ports(NULL) + , _polyphonic(polyphonic) , _activated(false) , _traversed(false) { diff --git a/src/server/NodeImpl.hpp b/src/server/NodeImpl.hpp index 6d9ef14b..d0d7b14e 100644 --- a/src/server/NodeImpl.hpp +++ b/src/server/NodeImpl.hpp @@ -144,11 +144,10 @@ public: virtual void post_process(Context& context); /** Set the buffer of a port to a given buffer (e.g. connect plugin to buffer) */ - virtual void set_port_buffer( - uint32_t voice, - uint32_t port_num, - boost::intrusive_ptr buf, - SampleCount offset); + virtual void set_port_buffer(uint32_t voice, + uint32_t port_num, + boost::intrusive_ptr buf, + SampleCount offset); virtual Port* port(uint32_t index) const; virtual PortImpl* port_impl(uint32_t index) const { return (*_ports)[index]; } @@ -171,7 +170,7 @@ public: virtual bool apply_poly(Raul::Maid& maid, uint32_t poly); /** Information about the Plugin this Node is an instance of. - * Not the best name - not all nodes come from plugins (ie Patch) + * Not the best name - not all nodes come from plugins (e.g. Patch) */ virtual PluginImpl* plugin_impl() const { return _plugin; } @@ -199,23 +198,19 @@ public: void traversed(bool b) { _traversed = b; } protected: - PluginImpl* _plugin; - - bool _polyphonic; - uint32_t _polyphony; - SampleRate _srate; - - void* _valid_ports; ///< Valid port flags for message context - - Raul::Semaphore _input_ready; ///< Parallelism: input ready signal - Raul::AtomicInt _process_lock; ///< Parallelism: Waiting on inputs 'lock' - Raul::AtomicInt _n_inputs_ready; ///< Parallelism: # input ready signals this cycle - Raul::Array* _ports; ///< Access in audio thread only - std::list _providers; ///< Nodes connected to this one's input ports - std::list _dependants; ///< Nodes this one's output ports are connected to - - bool _activated; - bool _traversed; ///< Flag for process order algorithm + PluginImpl* _plugin; + Raul::Array* _ports; ///< Access in audio thread only + void* _valid_ports; ///< Valid port flags for message context + uint32_t _polyphony; + SampleRate _srate; + Raul::Semaphore _input_ready; ///< Parallelism: input ready signal + Raul::AtomicInt _process_lock; ///< Parallelism: Waiting on inputs 'lock' + Raul::AtomicInt _n_inputs_ready; ///< Parallelism: # input ready signals this cycle + std::list _providers; ///< Nodes connected to this one's input ports + std::list _dependants; ///< Nodes this one's output ports are connected to + bool _polyphonic; + bool _activated; + bool _traversed; ///< Flag for process order algorithm }; } // namespace Server diff --git a/src/server/OutputPort.hpp b/src/server/OutputPort.hpp index a076209b..168ab7c4 100644 --- a/src/server/OutputPort.hpp +++ b/src/server/OutputPort.hpp @@ -18,8 +18,9 @@ #ifndef INGEN_ENGINE_OUTPUTPORT_HPP #define INGEN_ENGINE_OUTPUTPORT_HPP -#include #include +#include + #include "PortImpl.hpp" namespace Ingen { @@ -44,10 +45,12 @@ public: const Raul::Symbol& symbol, uint32_t index, uint32_t poly, - PortType type, + PortType type, const Raul::Atom& value, size_t buffer_size=0); + virtual ~OutputPort() {} + bool get_buffers(BufferFactory& bufs, Raul::Array* buffers, uint32_t poly) const; @@ -55,8 +58,6 @@ public: void pre_process(Context& context); void post_process(Context& context); - virtual ~OutputPort() {} - bool is_input() const { return false; } bool is_output() const { return true; } }; -- cgit v1.2.1