summaryrefslogtreecommitdiffstats
path: root/ingen/AtomForgeSink.hpp
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2017-12-17 20:33:47 +0100
committerDavid Robillard <d@drobilla.net>2019-01-12 18:19:58 +0100
commit79fe75853ed8205674335f88e4e9c0e9dec137f9 (patch)
tree7e139dd4cff621b719ab751974883ed62cf68b6d /ingen/AtomForgeSink.hpp
parentcc3d7ef610e5f93086eb46406cc600ee81a23e98 (diff)
downloadingen-79fe75853ed8205674335f88e4e9c0e9dec137f9.tar.gz
ingen-79fe75853ed8205674335f88e4e9c0e9dec137f9.tar.bz2
ingen-79fe75853ed8205674335f88e4e9c0e9dec137f9.zip
Use LV2 atom forge C++ bindings
Diffstat (limited to 'ingen/AtomForgeSink.hpp')
-rw-r--r--ingen/AtomForgeSink.hpp21
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;