[LV2] Another Question
Warren Koontz
profwub at gmail.com
Fri Dec 27 06:23:29 PST 2013
My plugin uses an array of buffers with different lengths. I am considering
options for implementation:
Programming 101 option:
#define ORDER 8 // number of buffers
#define MAXLEN 5000 // length of largest buffer
float buffer[ORDER][MAXLEN];
unsigned ptr[ORDER];
Programming 201 option:
#define ORDER 8
struct Buffer {
float *buf;
unsigned ptr;
} buffer[ORDER];
unsigned size[] = {/* list of buffer lengths */};
for (unsigned i = 0; i < ORDER; i++)
buffer[i].buf = new float[size[i]];
Programming 301 option:
class Buffer etc.
The latter two options require dynamic allocation and freeing. Can this be
safely done in activate and deactivate? I could also do the allocation in
the constructor for my plugin but, since I am using lv2-c++-tools and
inheriting from the plugin class, I am not sure where I can do the freeing.
I hate to go with the 101 option - looks too much like my MATLAB
implementation. But if it is the safest way ...
Thanks again.
Warren
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lv2plug.in/pipermail/devel-lv2plug.in/attachments/20131227/fa08402a/attachment.htm>
More information about the Devel
mailing list