2 Copyright 2008-2012 David Robillard <http://drobilla.net>
4 Permission to use, copy, modify, and/or distribute this software for any
5 purpose with or without fee is hereby granted, provided that the above
6 copyright notice and this permission notice appear in all copies.
8 THIS SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
9 WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
10 MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
11 ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
12 WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
13 ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
14 OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
29 Format of actual buffer.
33 An (old) ev:EventBuffer (LV2_Event_Buffer).
38 A (new) atom:Sequence (LV2_Atom_Sequence).
44 An abstract/opaque LV2 event buffer.
46 typedef struct LV2_Evbuf_Impl LV2_Evbuf;
49 An iterator over an LV2_Evbuf.
57 Allocate a new, empty event buffer.
58 URIDs for atom:Chunk and atom:Sequence must be passed for LV2_EVBUF_ATOM.
61 lv2_evbuf_new(uint32_t capacity,
64 uint32_t atom_Sequence);
67 Free an event buffer allocated with lv2_evbuf_new.
70 lv2_evbuf_free(LV2_Evbuf* evbuf);
73 Reset and change the type of an existing event buffer.
74 URIDs for atom:Chunk and atom:Sequence must be passed for LV2_EVBUF_ATOM.
77 lv2_evbuf_set_type(LV2_Evbuf* evbuf, LV2_Evbuf_Type type);
80 Clear and initialize an existing event buffer.
81 The contents of buf are ignored entirely and overwritten, except capacity
83 If input is false and this is an atom buffer, the buffer will be prepared
84 for writing by the plugin. This MUST be called before every run cycle.
87 lv2_evbuf_reset(LV2_Evbuf* evbuf, bool input);
90 Return the total padded size of the events stored in the buffer.
93 lv2_evbuf_get_size(LV2_Evbuf* evbuf);
96 Return the actual buffer implementation.
97 The format of the buffer returned depends on the buffer type.
100 lv2_evbuf_get_buffer(LV2_Evbuf* evbuf);
103 Return an iterator to the start of @p buf.
106 lv2_evbuf_begin(LV2_Evbuf* evbuf);
109 Return an iterator to the end of @a buf.
112 lv2_evbuf_end(LV2_Evbuf* evbuf);
115 Check if @p iter is valid.
116 @return True if @p iter is valid, otherwise false (past end of buffer)
119 lv2_evbuf_is_valid(LV2_Evbuf_Iterator iter);
122 Advance @p iter forward one event.
123 @p iter must be valid.
124 @return True if @p iter is valid, otherwise false (reached end of buffer)
127 lv2_evbuf_next(LV2_Evbuf_Iterator iter);
130 Dereference an event iterator (i.e. get the event currently pointed to).
131 @p iter must be valid.
132 @p type Set to the type of the event.
133 @p size Set to the size of the event.
134 @p data Set to the contents of the event.
135 @return True on success.
138 lv2_evbuf_get(LV2_Evbuf_Iterator iter,
146 Write an event at @p iter.
147 The event (if any) pointed to by @p iter will be overwritten, and @p iter
148 incremented to point to the following event (i.e. several calls to this
149 function can be done in sequence without twiddling iter in-between).
150 @return True if event was written, otherwise false (buffer is full).
153 lv2_evbuf_write(LV2_Evbuf_Iterator* iter,
158 const uint8_t* data);
164 #endif /* LV2_EVBUF_H */