diff options
Diffstat (limited to 'ingen/AtomForgeSink.hpp')
-rw-r--r-- | ingen/AtomForgeSink.hpp | 24 |
1 files changed, 4 insertions, 20 deletions
diff --git a/ingen/AtomForgeSink.hpp b/ingen/AtomForgeSink.hpp index 5520906c..b32d9679 100644 --- a/ingen/AtomForgeSink.hpp +++ b/ingen/AtomForgeSink.hpp @@ -17,9 +17,10 @@ #ifndef INGEN_ATOMFORGESINK_HPP #define INGEN_ATOMFORGESINK_HPP +#include <cassert> #include <cstdlib> -#include "lv2/lv2plug.in/ns/ext/atom/forge.h" +#include "lv2/lv2plug.in/ns/ext/atom/util.h" namespace Ingen { @@ -27,24 +28,17 @@ namespace Ingen { class AtomForgeSink { public: - AtomForgeSink(LV2_Atom_Forge* forge = nullptr) + AtomForgeSink() : _capacity(8 * sizeof(LV2_Atom)) , _size(0) , _buf((LV2_Atom*)calloc(8, sizeof(LV2_Atom))) { - if (forge) { - set_forge_sink(forge); - } } ~AtomForgeSink() { free(_buf); } - void set_forge_sink(LV2_Atom_Forge* forge) { - lv2_atom_forge_set_sink(forge, c_append, c_deref, this); - } - /** Append some data and return a reference to its start. */ - intptr_t append(const void* buf, uint32_t len) { + intptr_t write(const void* buf, uint32_t len) { // Record offset of the start of this write (+1 to avoid NULL) const intptr_t ref = _size + 1; @@ -76,16 +70,6 @@ public: void clear() { _buf->type = 0; _buf->size = 0; _size = 0; } - static LV2_Atom_Forge_Ref - c_append(void* handle, const void* buf, uint32_t len) { - return ((AtomForgeSink*)handle)->append(buf, len); - } - - static LV2_Atom* - c_deref(void* handle, LV2_Atom_Forge_Ref ref) { - return ((AtomForgeSink*)handle)->deref(ref); - } - private: size_t _capacity; size_t _size; |