diff options
author | David Robillard <d@drobilla.net> | 2012-08-11 02:13:56 +0000 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2012-08-11 02:13:56 +0000 |
commit | 571cbb33901b2a6b6fbc6f311723bc9bc561e731 (patch) | |
tree | 90c1731c8aea550277cf5b83b3429502a7fb3040 /src/server/Buffer.hpp | |
parent | 46eff0830c8894997fb624733fadcea9c6d74812 (diff) | |
download | ingen-571cbb33901b2a6b6fbc6f311723bc9bc561e731.tar.gz ingen-571cbb33901b2a6b6fbc6f311723bc9bc561e731.tar.bz2 ingen-571cbb33901b2a6b6fbc6f311723bc9bc561e731.zip |
Vectorizable (by GCC with -ftree-vectorize) mixing and Buffer::set_block().
Custom SSE accelerated peak detection when SSE is available at compile time.
Less mixing overhead in general.
git-svn-id: http://svn.drobilla.net/lad/trunk/ingen@4651 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src/server/Buffer.hpp')
-rw-r--r-- | src/server/Buffer.hpp | 40 |
1 files changed, 25 insertions, 15 deletions
diff --git a/src/server/Buffer.hpp b/src/server/Buffer.hpp index 329abb12..720b1073 100644 --- a/src/server/Buffer.hpp +++ b/src/server/Buffer.hpp @@ -27,6 +27,7 @@ #include "raul/Deletable.hpp" #include "raul/SharedPtr.hpp" +#include "BufferFactory.hpp" #include "PortType.hpp" #include "types.hpp" @@ -37,26 +38,34 @@ class Context; class Engine; class BufferFactory; -class Buffer : public boost::noncopyable, public Raul::Deletable +class Buffer : public boost::noncopyable { public: Buffer(BufferFactory& bufs, LV2_URID type, uint32_t capacity); - bool is_audio() const; - bool is_control() const; - bool is_sequence() const; + void clear(); + void resize(uint32_t size); + void copy(const Context& context, const Buffer* src); + void set_block(Sample val, SampleCount start, SampleCount end); + void prepare_write(Context& context); - virtual void clear(); - virtual void resize(uint32_t size); - virtual void copy(Context& context, const Buffer* src); - virtual void set_block(Sample val, SampleCount start, SampleCount end); - virtual void prepare_write(Context& context); + void* port_data(PortType port_type); + const void* port_data(PortType port_type) const; - void* port_data(PortType port_type, SampleCount offset); - const void* port_data(PortType port_type, SampleCount offset) const; + inline LV2_URID type() const { return _type; } + inline uint32_t capacity() const { return _capacity; } - LV2_URID type() const { return _type; } - uint32_t capacity() const { return _capacity; } + inline bool is_audio() const { + return _type == _factory.uris().atom_Sound; + } + + inline bool is_control() const { + return _type == _factory.uris().atom_Float; + } + + inline bool is_sequence() const { + return _type == _factory.uris().atom_Sequence; + } /// Audio buffers only inline const Sample* samples() const { @@ -89,7 +98,8 @@ public: } /// Audio buffers only - inline const Sample& value_at(size_t offset) const { + inline const Sample& value_at(SampleCount offset) const { + assert(is_audio() || is_control()); assert(offset < nframes()); return samples()[offset]; } @@ -124,7 +134,7 @@ protected: uint32_t _capacity; friend class BufferFactory; - virtual ~Buffer(); + ~Buffer(); private: void recycle(); |