diff options
Diffstat (limited to 'ingen/AtomForgeSink.hpp')
-rw-r--r-- | ingen/AtomForgeSink.hpp | 21 |
1 files changed, 2 insertions, 19 deletions
diff --git a/ingen/AtomForgeSink.hpp b/ingen/AtomForgeSink.hpp index ed8b0b8b..872f66d8 100644 --- a/ingen/AtomForgeSink.hpp +++ b/ingen/AtomForgeSink.hpp @@ -32,24 +32,17 @@ namespace ingen { class AtomForgeSink { public: - explicit 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; @@ -81,16 +74,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; |