grame-cncm / faust

Functional programming language for signal processing and sound synthesis
http://faust.grame.fr
Other
2.58k stars 322 forks source link

Csound architecture generated plugins do not compile with Microsoft C++ #94

Closed gogins closed 6 years ago

gogins commented 6 years ago

With Microsoft Visual Studio 2015 (Visual C++ 19), a generated Csound plugin opcode does not compile, with this error:

blowBottle_linux_csound-64bits.cpp(1790): error C2229: struct 'dataspace' has an illegal zero-sized array

Please be aware that currently, on Windows, Csound is by default built with Microsoft Visual Studio 2015 or 2017.

It is possible to work around the error by adding 1 to sizes like this:

struct dataspace {
    OPDS      h;                          /* basic attributes */
    MYFLT*    aout[FAUST_OUTPUTS];        /* output buffers   */
    MYFLT*    ain[1+FAUST_INPUTS];        /* input buffers    */
    MYFLT*    ktl[FAUST_ACTIVES];         /* controls         */
    dsp*      DSP;                        /* the Faust generated object */
    CSUI*     interface;                  /* do the mapping between CSound controls and DSP fields */
    AUXCH     dspmem;                     /* aux memory allocated once to store the DSP object */
    AUXCH     intmem;                     /* aux memory allocated once to store the interface object */
};

I think the sizes of the arrays in dataspace should all start at 1, but I don't know if this will cause side effects.

sletz commented 6 years ago

Can you send me the blowBottle_linux_csound-64bits.cpp file as well as the original Faust DSP file? Thanks.

gogins commented 6 years ago

I have attached the file to the issue report in GitHub, and also to this email. This is simply the stock blowBottle example from Git, that is the original Faust DSP file.

Thanks, Mike


Michael Gogins Irreducible Productions http://michaelgogins.tumblr.com Michael dot Gogins at gmail dot com

On Thu, Nov 23, 2017 at 8:35 AM, Stéphane Letz notifications@github.com wrote:

Can you send me the blowBottle_linux_csound-64bits.cpp file as well as the original Faust DSP file? Thanks.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/grame-cncm/faust/issues/94#issuecomment-346661577, or mute the thread https://github.com/notifications/unsubscribe-auth/AGCDJcpiA3VGTUWRZPyb5umq_PpT4fs_ks5s5Z7ZgaJpZM4Qo_k5 .

sletz commented 6 years ago

Then I think we should better do:

struct dataspace { OPDS h; / basic attributes / MYFLT aout[FAUST_OUTPUTS+1]; / output buffers / MYFLT ain[FAUST_INPUTS+1]; / input buffers / MYFLT ktl[FAUST_ACTIVES+1]; / controls / dsp DSP; / the Faust generated object / CSUI interface; / do the mapping between CSound controls and DSP fields / AUXCH dspmem; / aux memory allocated once to store the DSP object / AUXCH intmem; / aux memory allocated once to store the interface object */ };

since any of FAUST_OUTPUTS, FAUST_INPUTS, FAUST_ACTIVES can be 0. Can you test that and report?

gogins commented 6 years ago

I am doing this now.

Regards, Mike


Michael Gogins Irreducible Productions http://michaelgogins.tumblr.com Michael dot Gogins at gmail dot com

On Thu, Nov 23, 2017 at 9:45 AM, Stéphane Letz notifications@github.com wrote:

Then I think we should better do:

struct dataspace { OPDS h; / basic attributes / MYFLT aout[FAUST_OUTPUTS+1]; / output buffers / MYFLT ain[FAUST_INPUTS+1]; / input buffers / MYFLT ktl[FAUST_ACTIVES+1]; / controls / dsp DSP; / the Faust generated object / CSUI interface; / do the mapping between CSound controls and DSP fields / AUXCH dspmem; / aux memory allocated once to store the DSP object / AUXCH intmem; / aux memory allocated once to store the interface object */ };

since and of FAUST_OUTPUTS, FAUST_INPUTS, FAUST_ACTIVES can be 0. Can you test that and report?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/grame-cncm/faust/issues/94#issuecomment-346673939, or mute the thread https://github.com/notifications/unsubscribe-auth/AGCDJcU4DA3kVqP01GI-0q7l9q5yBifDks5s5a86gaJpZM4Qo_k5 .

gogins commented 6 years ago

This solution does not work as the indexing of the sections goes off by 1 element for every zero sized array. This causes the opcode to crash. I am trying to come up with an elegant solution.

sletz commented 6 years ago

OK. Can you also correct the other issue here (https://github.com/grame-cncm/faust/issues/96) at the same time, since it concerns the same file ?