From d8ca49b80ed7fbfe662fbbd178fc8b0342676847 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Wed, 13 Aug 2008 18:38:25 +0000 Subject: Remove essentially pointless BufferFactory namespace/files. git-svn-id: http://svn.drobilla.net/lad/ingen@1350 a436a847-0d15-0410-975c-d299462d15a1 --- src/libs/engine/Buffer.cpp | 38 +++++++++++++++++++++++++++++++++++ src/libs/engine/Buffer.hpp | 4 +++- src/libs/engine/BufferFactory.cpp | 41 -------------------------------------- src/libs/engine/BufferFactory.hpp | 35 -------------------------------- src/libs/engine/ConnectionImpl.cpp | 7 +++---- src/libs/engine/Makefile.am | 3 +-- src/libs/engine/PortImpl.cpp | 5 ++--- 7 files changed, 47 insertions(+), 86 deletions(-) create mode 100644 src/libs/engine/Buffer.cpp delete mode 100644 src/libs/engine/BufferFactory.cpp delete mode 100644 src/libs/engine/BufferFactory.hpp (limited to 'src/libs') diff --git a/src/libs/engine/Buffer.cpp b/src/libs/engine/Buffer.cpp new file mode 100644 index 00000000..d019146c --- /dev/null +++ b/src/libs/engine/Buffer.cpp @@ -0,0 +1,38 @@ +/* This file is part of Ingen. + * Copyright (C) 2007 Dave Robillard + * + * Ingen is free software; you can redistribute it and/or modify it under the + * terms of the GNU General Public License as published by the Free Software + * Foundation; either version 2 of the License, or (at your option) any later + * version. + * + * Ingen is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. See the GNU General Public License for details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#include "AudioBuffer.hpp" +#include "EventBuffer.hpp" + +namespace Ingen { + + +Buffer* +Buffer::create(DataType type, size_t size) +{ + if (type.is_control()) + return new AudioBuffer(1); + else if (type.is_audio()) + return new AudioBuffer(size); + else if (type.is_event()) + return new EventBuffer(size); + else + throw; +} + + +} // namespace Ingen diff --git a/src/libs/engine/Buffer.hpp b/src/libs/engine/Buffer.hpp index 3e3f7563..e388e2e8 100644 --- a/src/libs/engine/Buffer.hpp +++ b/src/libs/engine/Buffer.hpp @@ -36,6 +36,8 @@ public: , _size(size) , _joined_buf(NULL) {} + + static Buffer* create(Shared::DataType type, size_t size); /** Clear contents and reset state */ virtual void clear() = 0; @@ -43,7 +45,7 @@ public: virtual void* raw_data() = 0; virtual const void* raw_data() const = 0; - /** Rewing (ie reset read pointer), but leave contents unchanged */ + /** Rewind (ie reset read pointer), but leave contents unchanged */ virtual void rewind() const = 0; virtual void prepare_read(FrameTime start, SampleCount nframes) = 0; diff --git a/src/libs/engine/BufferFactory.cpp b/src/libs/engine/BufferFactory.cpp deleted file mode 100644 index 0358f9eb..00000000 --- a/src/libs/engine/BufferFactory.cpp +++ /dev/null @@ -1,41 +0,0 @@ -/* This file is part of Ingen. - * Copyright (C) 2007 Dave Robillard - * - * Ingen is free software; you can redistribute it and/or modify it under the - * terms of the GNU General Public License as published by the Free Software - * Foundation; either version 2 of the License, or (at your option) any later - * version. - * - * Ingen is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#include "BufferFactory.hpp" -#include "AudioBuffer.hpp" -#include "EventBuffer.hpp" - -namespace Ingen { -namespace BufferFactory { - - -Buffer* -create(DataType type, size_t size) -{ - if (type.is_control()) - return new AudioBuffer(1); - else if (type.is_audio()) - return new AudioBuffer(size); - else if (type.is_event()) - return new EventBuffer(size); - else - throw; -} - - -} // namespace BufferFactory -} // namespace Ingen diff --git a/src/libs/engine/BufferFactory.hpp b/src/libs/engine/BufferFactory.hpp deleted file mode 100644 index bac49c46..00000000 --- a/src/libs/engine/BufferFactory.hpp +++ /dev/null @@ -1,35 +0,0 @@ -/* This file is part of Ingen. - * Copyright (C) 2007 Dave Robillard - * - * Ingen is free software; you can redistribute it and/or modify it under the - * terms of the GNU General Public License as published by the Free Software - * Foundation; either version 2 of the License, or (at your option) any later - * version. - * - * Ingen is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef BUFFERFACTORY_H -#define BUFFERFACTORY_H - -#include "Buffer.hpp" - -namespace Ingen { - - -namespace BufferFactory { - - Buffer* create(DataType type, size_t size); - -} - - -} // namespace Ingen - -#endif // BUFFERFACTORY_H diff --git a/src/libs/engine/ConnectionImpl.cpp b/src/libs/engine/ConnectionImpl.cpp index 07884336..998b7eb3 100644 --- a/src/libs/engine/ConnectionImpl.cpp +++ b/src/libs/engine/ConnectionImpl.cpp @@ -21,7 +21,6 @@ #include "ConnectionImpl.hpp" #include "NodeImpl.hpp" #include "PortImpl.hpp" -#include "BufferFactory.hpp" #include "AudioBuffer.hpp" #include "ProcessContext.hpp" @@ -60,7 +59,7 @@ ConnectionImpl::ConnectionImpl(PortImpl* src_port, PortImpl* dst_port) _must_mix = false; // FIXME: kludge if (_must_mix) - _local_buffer = BufferFactory::create(dst_port->type(), dst_port->buffer(0)->size()); + _local_buffer = Buffer::create(dst_port->type(), dst_port->buffer(0)->size()); /* FIXME: 1->1 connections with a destination with fixed buffers copies unecessarily */ //cerr << src_port->path() << " -> " << dst_port->path() << " must mix: " << _must_mix << endl; @@ -80,7 +79,7 @@ ConnectionImpl::set_buffer_size(size_t size) assert(_local_buffer); delete _local_buffer; - _local_buffer = BufferFactory::create(_dst_port->type(), _dst_port->buffer(0)->size()); + _local_buffer = Buffer::create(_dst_port->type(), _dst_port->buffer(0)->size()); } _buffer_size = size; @@ -101,7 +100,7 @@ ConnectionImpl::prepare_poly(uint32_t poly) << "\t\tmust mix: " << _must_mix << " at poly " << poly << endl;*/ if (_must_mix && ! _local_buffer) - _local_buffer = BufferFactory::create(_dst_port->type(), _dst_port->buffer(0)->size()); + _local_buffer = Buffer::create(_dst_port->type(), _dst_port->buffer(0)->size()); } diff --git a/src/libs/engine/Makefile.am b/src/libs/engine/Makefile.am index f04d3f3d..b0035ba6 100644 --- a/src/libs/engine/Makefile.am +++ b/src/libs/engine/Makefile.am @@ -34,9 +34,8 @@ libingen_engine_la_SOURCES = \ AudioBuffer.cpp \ AudioBuffer.hpp \ AudioDriver.hpp \ + Buffer.cpp \ Buffer.hpp \ - BufferFactory.cpp \ - BufferFactory.hpp \ ClientBroadcaster.cpp \ ClientBroadcaster.hpp \ CompiledPatch.hpp \ diff --git a/src/libs/engine/PortImpl.cpp b/src/libs/engine/PortImpl.cpp index 46a32b78..9061ffc5 100644 --- a/src/libs/engine/PortImpl.cpp +++ b/src/libs/engine/PortImpl.cpp @@ -23,7 +23,6 @@ #include "interface/DataType.hpp" #include "AudioBuffer.hpp" #include "EventBuffer.hpp" -#include "BufferFactory.hpp" #include "ProcessContext.hpp" #include "SendPortActivityEvent.hpp" @@ -96,7 +95,7 @@ PortImpl::prepare_poly(uint32_t poly) if (poly > _poly) { _prepared_buffers = new Raul::Array(poly, *_buffers); for (uint32_t i = _poly; i < _prepared_buffers->size(); ++i) - _prepared_buffers->at(i) = BufferFactory::create(_type, _buffer_size); + _prepared_buffers->at(i) = Buffer::create(_type, _buffer_size); } return true; @@ -131,7 +130,7 @@ PortImpl::allocate_buffers() _buffers->alloc(_poly); for (uint32_t i=0; i < _poly; ++i) - _buffers->at(i) = BufferFactory::create(_type, _buffer_size); + _buffers->at(i) = Buffer::create(_type, _buffer_size); } -- cgit v1.2.1