diff options
author | David Robillard <d@drobilla.net> | 2012-07-31 15:12:38 +0000 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2012-07-31 15:12:38 +0000 |
commit | 8d559e4991a491b612e63d5a4deff0ab48a3d3dd (patch) | |
tree | 06da8b1d71f8068f12bc3f476b90734b67d9120c /src/server/AudioBuffer.hpp | |
parent | a41af6e41d60f8724809486b94ce1e6281c3bc31 (diff) | |
download | ingen-8d559e4991a491b612e63d5a4deff0ab48a3d3dd.tar.gz ingen-8d559e4991a491b612e63d5a4deff0ab48a3d3dd.tar.bz2 ingen-8d559e4991a491b612e63d5a4deff0ab48a3d3dd.zip |
Merge AudioBuffer into Buffer and avoid all the casting.
git-svn-id: http://svn.drobilla.net/lad/trunk/ingen@4584 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src/server/AudioBuffer.hpp')
-rw-r--r-- | src/server/AudioBuffer.hpp | 76 |
1 files changed, 0 insertions, 76 deletions
diff --git a/src/server/AudioBuffer.hpp b/src/server/AudioBuffer.hpp deleted file mode 100644 index ca519650..00000000 --- a/src/server/AudioBuffer.hpp +++ /dev/null @@ -1,76 +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/>. -*/ - -#ifndef INGEN_ENGINE_AUDIOBUFFER_HPP -#define INGEN_ENGINE_AUDIOBUFFER_HPP - -#include <cassert> -#include <cmath> -#include <cstddef> - -#include <boost/utility.hpp> - -#include "ingen/URIs.hpp" - -#include "Buffer.hpp" -#include "BufferFactory.hpp" -#include "Context.hpp" -#include "types.hpp" - -namespace Ingen { -namespace Server { - -class AudioBuffer : public Buffer -{ -public: - AudioBuffer(BufferFactory& bufs, LV2_URID type, uint32_t size); - - void clear(); - - void set_block(Sample val, size_t start_offset, size_t end_offset); - void copy(Context& context, const Buffer* src); - - float peak(Context& context) const; - - inline bool is_control() const { return _type == _factory.uris().atom_Float; } - - inline Sample* data() const { - return (is_control()) - ? (Sample*)LV2_ATOM_BODY(atom()) - : (Sample*)LV2_ATOM_CONTENTS(LV2_Atom_Vector, atom()); - } - - inline SampleCount nframes() const { - return (is_control()) - ? 1 - : (_capacity - sizeof(LV2_Atom_Vector)) / sizeof(Sample); - } - - inline Sample& value_at(size_t offset) const { - assert(offset < nframes()); - return data()[offset]; - } - - void prepare_write(Context& context) {} - -private: - LV2_Atom_Vector* vector() { return (LV2_Atom_Vector*)atom(); } -}; - -} // namespace Server -} // namespace Ingen - -#endif // INGEN_ENGINE_AUDIOBUFFER_HPP |