55 SCORE_PLUGIN_LV2_EXPORT
static uint32_t sequence_type;
56 SCORE_PLUGIN_LV2_EXPORT
static uint32_t chunk_type;
59 alignas(8) LV2_Atom_Sequence atoms;
60 LV2_Atom_Buffer(uint32_t capacity, uint32_t ct, uint32_t seq_type,
bool input)
64 sequence_type = seq_type;
68 void reset(
bool input)
72 atoms.atom.size =
sizeof(LV2_Atom_Sequence_Body);
73 atoms.atom.type = sequence_type;
77 atoms.atom.size = capacity;
78 atoms.atom.type = chunk_type;
87 if(atoms.atom.type == sequence_type)
88 return atoms.atom.size -
sizeof(LV2_Atom_Sequence_Body);
94 LV2_Atom_Sequence* get_sequence(
LV2_Atom_Buffer* buf) {
return &buf->atoms; }
111 static uint32_t pad_size(uint32_t size) {
return (size + 7) & (~7); }
120 return (buf->atoms.atom.size > 0);
128 offset = pad_size(buf->get_size());
130 return (offset < buf->capacity -
sizeof(LV2_Atom_Event));
135 bool is_valid() {
return offset < buf->get_size(); }
144 LV2_Atom_Sequence* atoms = &buf->atoms;
146 = ((LV2_Atom_Event*)((
char*)LV2_ATOM_CONTENTS(LV2_Atom_Sequence, atoms) + offset))
148 offset += pad_size(
sizeof(LV2_Atom_Event) + size);
155 LV2_Atom_Event* get(uint8_t** data)
160 auto atoms = &buf->atoms;
162 = (LV2_Atom_Event*)((
char*)LV2_ATOM_CONTENTS(LV2_Atom_Sequence, atoms) + offset);
164 *data = (uint8_t*)LV2_ATOM_BODY(&ev->body);
171 uint32_t frames, uint32_t , uint32_t type, uint32_t size,
174 LV2_Atom_Sequence* atoms = &buf->atoms;
175 if(buf->capacity -
sizeof(LV2_Atom) - atoms->atom.size
176 <
sizeof(LV2_Atom_Event) + size)
180 = (LV2_Atom_Event*)((
char*)LV2_ATOM_CONTENTS(LV2_Atom_Sequence, atoms) + offset);
182 ev->time.frames = frames;
183 ev->body.type = type;
184 ev->body.size = size;
186 memcpy(LV2_ATOM_BODY(&ev->body), data, size);
188 size = pad_size(
sizeof(LV2_Atom_Event) + size);
189 atoms->atom.size += size;