[LV2] Another Question

Michael R. Fisher mfisher31 at gmail.com
Sat Dec 28 10:20:38 PST 2013


With lv2-c++-tools, the ctor and dtor of your plugin match up with 'instantiate' and 'cleanup' respectively.  




> On Dec 27, 2013, at 8:23 AM, Warren Koontz <profwub at gmail.com> wrote:
> 
> 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
> _______________________________________________
> Devel mailing list
> Devel at lists.lv2plug.in
> http://lists.lv2plug.in/listinfo.cgi/devel-lv2plug.in
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lv2plug.in/pipermail/devel-lv2plug.in/attachments/20131228/7bd6d812/attachment-0002.htm>


More information about the Devel mailing list