From 254b434f0a79fea54bd963e8ff2e845a5b0cd3a6 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Mon, 19 Mar 2012 20:16:46 +0000 Subject: Partially functioning communication between Ingen LV2 plugin and UI. git-svn-id: http://svn.drobilla.net/lad/trunk/ingen@4078 a436a847-0d15-0410-975c-d299462d15a1 --- src/server/Buffer.hpp | 46 ++++++++++++++++++++++------------------------ 1 file changed, 22 insertions(+), 24 deletions(-) (limited to 'src/server/Buffer.hpp') diff --git a/src/server/Buffer.hpp b/src/server/Buffer.hpp index 0b3c9348..c2d5ac05 100644 --- a/src/server/Buffer.hpp +++ b/src/server/Buffer.hpp @@ -24,6 +24,7 @@ #include #include +#include "lv2/lv2plug.in/ns/ext/atom/atom.h" #include "raul/AtomicInt.hpp" #include "raul/Deletable.hpp" #include "raul/SharedPtr.hpp" @@ -42,32 +43,28 @@ class BufferFactory; class Buffer : public boost::noncopyable, public Raul::Deletable { public: - Buffer(BufferFactory& bufs, PortType type, size_t size) - : _factory(bufs) - , _type(type) - , _size(size) - , _next(NULL) - , _refs(0) - {} + Buffer(BufferFactory& bufs, LV2_URID type, uint32_t capacity); - /** Clear contents and reset state */ - virtual void clear() = 0; - - virtual void resize(size_t size) { _size = size; } - - virtual void* port_data(PortType port_type, SampleCount offset=0) = 0; - virtual const void* port_data(PortType port_type, SampleCount offset=0) const = 0; + virtual void clear(); + virtual void resize(uint32_t size); + virtual void copy(Context& context, const Buffer* src); + virtual void prepare_read(Context& context) {} + virtual void prepare_write(Context& context); - /** Rewind (ie reset read pointer), but leave contents unchanged */ - virtual void rewind() const {} + void* port_data(PortType port_type, SampleCount offset); + const void* port_data(PortType port_type, SampleCount offset) const; - virtual void copy(Context& context, const Buffer* src) = 0; + LV2_URID type() const { return _type; } + uint32_t capacity() const { return _capacity; } - virtual void prepare_read(Context& context) {} - virtual void prepare_write(Context& context) {} + /// Sequence buffers only + bool append_event(int64_t frames, + uint32_t size, + uint32_t type, + const uint8_t* data); - PortType type() const { return _type; } - size_t size() const { return _size; } + LV2_Atom* atom() { return _atom; } + const LV2_Atom* atom() const { return _atom; } inline void ref() { ++_refs; } @@ -78,11 +75,12 @@ public: protected: BufferFactory& _factory; - PortType _type; - size_t _size; + LV2_Atom* _atom; + LV2_URID _type; + uint32_t _capacity; friend class BufferFactory; - virtual ~Buffer() {} + virtual ~Buffer(); private: Buffer* _next; ///< Intrusive linked list for BufferFactory -- cgit v1.2.1