From 43f3bebb6faf2e065bf8f61b66a04ceabb0dd5e5 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Thu, 6 Oct 2011 23:47:32 +0000 Subject: Tidy. git-svn-id: http://svn.drobilla.net/lad/trunk/ingen@3536 a436a847-0d15-0410-975c-d299462d15a1 --- src/server/InputPort.cpp | 6 ++++-- src/server/NodeImpl.cpp | 45 +++++++++++++++++++++++++++++---------------- src/server/OutputPort.cpp | 3 ++- src/server/PatchImpl.cpp | 21 ++++++++++++--------- 4 files changed, 47 insertions(+), 28 deletions(-) (limited to 'src/server') diff --git a/src/server/InputPort.cpp b/src/server/InputPort.cpp index 3525bb59..0a58c017 100644 --- a/src/server/InputPort.cpp +++ b/src/server/InputPort.cpp @@ -15,21 +15,23 @@ * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ -#include "InputPort.hpp" #include #include + #include "ingen/Patch.hpp" -#include "shared/LV2URIMap.hpp" + #include "AudioBuffer.hpp" #include "BufferFactory.hpp" #include "ConnectionImpl.hpp" #include "EventBuffer.hpp" +#include "InputPort.hpp" #include "NodeImpl.hpp" #include "Notification.hpp" #include "OutputPort.hpp" #include "ProcessContext.hpp" #include "ThreadManager.hpp" #include "mix.hpp" +#include "shared/LV2URIMap.hpp" #include "util.hpp" using namespace std; diff --git a/src/server/NodeImpl.cpp b/src/server/NodeImpl.cpp index 7fed6704..b64524a3 100644 --- a/src/server/NodeImpl.cpp +++ b/src/server/NodeImpl.cpp @@ -17,10 +17,11 @@ #include #include + #include "lv2/lv2plug.in/ns/ext/contexts/contexts.h" -#include "raul/List.hpp" #include "raul/Array.hpp" -#include "util.hpp" +#include "raul/List.hpp" + #include "AudioBuffer.hpp" #include "ClientBroadcaster.hpp" #include "EngineStore.hpp" @@ -29,6 +30,7 @@ #include "PluginImpl.hpp" #include "PortImpl.hpp" #include "ThreadManager.hpp" +#include "util.hpp" using namespace std; @@ -55,7 +57,6 @@ NodeImpl::NodeImpl(PluginImpl* plugin, { assert(_plugin); assert(_polyphony > 0); - assert(_parent == NULL || (_polyphony == parent->internal_poly() || _polyphony == 1)); } NodeImpl::~NodeImpl() @@ -92,12 +93,15 @@ NodeImpl::activate(BufferFactory& bufs) port->setup_buffers(bufs, port->poly()); port->connect_buffers(); for (uint32_t v = 0; v < _polyphony; ++v) { - if (!port->buffer(v)) - continue; - if (port->is_a(PortType::CONTROL)) - ((AudioBuffer*)port->buffer(v).get())->set_value(port->value().get_float(), 0, 0); - else - port->buffer(v)->clear(); + Buffer* const buf = port->buffer(v).get(); + if (buf) { + if (port->is_a(PortType::CONTROL)) { + ((AudioBuffer*)buf)->set_value( + port->value().get_float(), 0, 0); + } else { + buf->clear(); + } + } } } } @@ -149,12 +153,19 @@ NodeImpl::apply_poly(Raul::Maid& maid, uint32_t poly) } void -NodeImpl::set_buffer_size(Context& context, BufferFactory& bufs, PortType type, size_t size) +NodeImpl::set_buffer_size(Context& context, + BufferFactory& bufs, + PortType type, + size_t size) { - if (_ports) - for (size_t i = 0; i < _ports->size(); ++i) - if (_ports->at(i)->buffer_type() == type && _ports->at(i)->context() == context.id()) - _ports->at(i)->set_buffer_size(context, bufs, size); + if (_ports) { + for (size_t i = 0; i < _ports->size(); ++i) { + PortImpl* const p = _ports->at(i); + if (p->buffer_type() == type && p->context() == context.id()) { + p->set_buffer_size(context, bufs, size); + } + } + } } void @@ -252,8 +263,10 @@ NodeImpl::reset_valid_ports() } void -NodeImpl::set_port_buffer(uint32_t voice, uint32_t port_num, - BufferFactory::Ref buf, SampleCount offset) +NodeImpl::set_port_buffer(uint32_t voice, + uint32_t port_num, + BufferFactory::Ref buf, + SampleCount offset) { /*std::cout << path() << " set port " << port_num << " voice " << voice << " buffer " << buf << " offset " << offset << std::endl;*/ diff --git a/src/server/OutputPort.cpp b/src/server/OutputPort.cpp index ca217b49..05700a22 100644 --- a/src/server/OutputPort.cpp +++ b/src/server/OutputPort.cpp @@ -16,11 +16,12 @@ */ #include "ingen/Patch.hpp" -#include "shared/LV2URIMap.hpp" + #include "Buffer.hpp" #include "NodeImpl.hpp" #include "OutputPort.hpp" #include "ProcessContext.hpp" +#include "shared/LV2URIMap.hpp" using namespace std; diff --git a/src/server/PatchImpl.cpp b/src/server/PatchImpl.cpp index c99b0bb1..e253e7b3 100644 --- a/src/server/PatchImpl.cpp +++ b/src/server/PatchImpl.cpp @@ -18,19 +18,21 @@ #include #include #include + #include "raul/log.hpp" -#include "shared/World.hpp" -#include "shared/LV2URIMap.hpp" -#include "ThreadManager.hpp" + +#include "ConnectionImpl.hpp" +#include "Driver.hpp" +#include "DuplexPort.hpp" +#include "Engine.hpp" #include "NodeImpl.hpp" #include "PatchImpl.hpp" #include "PatchPlugin.hpp" #include "PortImpl.hpp" -#include "ConnectionImpl.hpp" -#include "DuplexPort.hpp" -#include "Engine.hpp" #include "ProcessSlave.hpp" -#include "Driver.hpp" +#include "ThreadManager.hpp" +#include "shared/LV2URIMap.hpp" +#include "shared/World.hpp" using namespace std; using namespace Raul; @@ -45,8 +47,9 @@ PatchImpl::PatchImpl(Engine& engine, SampleRate srate, uint32_t internal_poly) : NodeImpl(new PatchPlugin(*engine.world()->uris().get(), - engine.world()->uris()->ingen_Patch.c_str(), "patch", "Ingen Patch"), - symbol, poly, parent, srate) + engine.world()->uris()->ingen_Patch.c_str(), + "patch", "Ingen Patch"), + symbol, poly, parent, srate) , _engine(engine) , _internal_poly(internal_poly) , _compiled_patch(NULL) -- cgit v1.2.1