mod-audio / max-gen-skeleton

Skeleton for creating MAX gen~ based plugins
8 stars 2 forks source link

Doesn't work with MAX 8.1.8 exports #2

Open dromer opened 3 years ago

dromer commented 3 years ago

I guess enough things changed in the past ~4 years that this template is no longer compatible.

falkTX commented 3 years ago

what kind of error do you get?

dromer commented 3 years ago

One thing is that NUMINS and NUMOUTS aren't properly replaced in source/DistrhoPluginInfo.h. Instead they just say:

#define DISTRHO_PLUGIN_NUM_INPUTS  ;
#define DISTRHO_PLUGIN_NUM_OUTPUTS ;

After manually correcting these (I exported the gigaverb project under a new name, btw) and building:

make all -C source
make[1]: Entering directory '/home/dreamer/Sources/_downloads/DISTRHO/max-gen-skeleton/source'
g++ DistrhoPluginMaxGen.cpp -Wall -Wextra -pipe -fPIC -DPIC -DNDEBUG -O3 -ffast-math -mtune=generic -msse -msse2 -fdata-sections -ffunction-sections -mfpmath=sse -fvisibility=hidden -DHAVE_JACK -std=c++0x -std=gnu++0x -fvisibility-inlines-hidden  -I. -Idpf/distrho -Igen_dsp -I../plugin -Wno-unused-parameter -DGENLIB_USE_FASTMATH -DGENLIB_USE_FLOAT32 -DGENLIB_USE_JSON=0 -MD -MP -c -o DistrhoPluginMaxGen.cpp.o
In file included from ../plugin/gen_exported.h:27,
                 from ../plugin/gen_exported.cpp:1,
                 from DistrhoPluginMaxGen.cpp:19:
gen_dsp/genlib_ops.h:146:32: error: ‘t_sample exp2(t_sample)’ conflicts with a previous declaration
 inline t_sample exp2(t_sample v) { return pow(t_sample(2.), v); }
                                ^
In file included from dpf/distrho/extra/../DistrhoUtils.hpp:27,
                 from dpf/distrho/extra/String.hpp:20,
                 from dpf/distrho/DistrhoPlugin.hpp:20,
                 from DistrhoPluginMaxGen.hpp:20,
                 from DistrhoPluginMaxGen.cpp:17:
/usr/include/c++/8/cmath:1342:3: note: previous declaration ‘constexpr float std::exp2(float)’
   exp2(float __x)
   ^~~~
In file included from ../plugin/gen_exported.h:27,
                 from ../plugin/gen_exported.cpp:1,
                 from DistrhoPluginMaxGen.cpp:19:
gen_dsp/genlib_ops.h:148:33: error: ‘t_sample trunc(t_sample)’ conflicts with a previous declaration
 inline t_sample trunc(t_sample v) {
                                 ^
In file included from dpf/distrho/extra/../DistrhoUtils.hpp:27,
                 from dpf/distrho/extra/String.hpp:20,
                 from dpf/distrho/DistrhoPlugin.hpp:20,
                 from DistrhoPluginMaxGen.hpp:20,
                 from DistrhoPluginMaxGen.cpp:17:
/usr/include/c++/8/cmath:1828:3: note: previous declaration ‘constexpr float std::trunc(float)’
   trunc(float __x)
   ^~~~~
make[1]: *** [Makefile:154: DistrhoPluginMaxGen.cpp.o] Error 1
make[1]: Leaving directory '/home/dreamer/Sources/_downloads/DISTRHO/max-gen-skeleton/source'
make: *** [Makefile:35: plugin] Error 2
dromer commented 3 years ago

The first issue would resolve by setting cut -c 3 in the setup.sh script instead.

falkTX commented 3 years ago

I dont use max-gen myself, so I dont know many details. But the code in https://github.com/DISTRHO/DPF-Max-Gen should be up to date.

afaik the issue is old code using double where t_sample is expected

dromer commented 3 years ago

I do see some minute differences between the included gen_dsp/ and the one that is exported from max-gen. Simply using the exported folder instead of the one included here results in:

make all -C source
make[1]: Entering directory '/home/dreamer/Sources/_downloads/DISTRHO/max-gen-test/source'
g++ DistrhoPluginMaxGen.cpp -Wall -Wextra -pipe -fPIC -DPIC -DNDEBUG -O3 -ffast-math -mtune=generic -msse -msse2 -fdata-sections -ffunction-sections -mfpmath=sse -fvisibility=hidden -DHAVE_JACK -std=c++0x -std=gnu++0x -fvisibility-inlines-hidden  -I. -Idpf/distrho -Igen_dsp -I../plugin -Wno-unused-parameter -DGENLIB_USE_FASTMATH -DGENLIB_USE_FLOAT32 -DGENLIB_USE_JSON=0 -MD -MP -c -o DistrhoPluginMaxGen.cpp.o
In file included from ../plugin/gen_exported.h:27,
                 from ../plugin/gen_exported.cpp:1,
                 from DistrhoPluginMaxGen.cpp:19:
gen_dsp/genlib_ops.h:149:32: error: ‘t_sample exp2(t_sample)’ conflicts with a previous declaration
 inline t_sample exp2(t_sample v) { return pow(2., v); }
                                ^
In file included from dpf/distrho/extra/../DistrhoUtils.hpp:27,
                 from dpf/distrho/extra/String.hpp:20,
                 from dpf/distrho/DistrhoPlugin.hpp:20,
                 from DistrhoPluginMaxGen.hpp:20,
                 from DistrhoPluginMaxGen.cpp:17:
/usr/include/c++/8/cmath:1342:3: note: previous declaration ‘constexpr float std::exp2(float)’
   exp2(float __x)
   ^~~~
In file included from ../plugin/gen_exported.h:27,
                 from ../plugin/gen_exported.cpp:1,
                 from DistrhoPluginMaxGen.cpp:19:
gen_dsp/genlib_ops.h:151:33: error: ‘t_sample trunc(t_sample)’ conflicts with a previous declaration
 inline t_sample trunc(t_sample v) {
                                 ^
In file included from dpf/distrho/extra/../DistrhoUtils.hpp:27,
                 from dpf/distrho/extra/String.hpp:20,
                 from dpf/distrho/DistrhoPlugin.hpp:20,
                 from DistrhoPluginMaxGen.hpp:20,
                 from DistrhoPluginMaxGen.cpp:17:
/usr/include/c++/8/cmath:1828:3: note: previous declaration ‘constexpr float std::trunc(float)’
   trunc(float __x)
   ^~~~~
In file included from ../plugin/gen_exported.h:27,
                 from ../plugin/gen_exported.cpp:1,
                 from DistrhoPluginMaxGen.cpp:19:
gen_dsp/genlib_ops.h: In constructor ‘SineData::SineData()’:
gen_dsp/genlib_ops.h:1482:23: error: expected primary-expression before ‘(’ token
    mData[i] = t_sample(cos(i * GENLIB_PI * 2. / (t_sample)(dim)));
                       ^
In file included from DistrhoPluginMaxGen.hpp:21,
                 from DistrhoPluginMaxGen.cpp:17:
gen_dsp/genlib.h:147:34: error: expected ‘)’ before ‘;’ token
 #  define cos(x) fastercosfull(x);
                                  ^
gen_dsp/genlib_ops.h:1482:24: note: in expansion of macro ‘cos’
    mData[i] = t_sample(cos(i * GENLIB_PI * 2. / (t_sample)(dim)));
                        ^~~
In file included from ../plugin/gen_exported.h:27,
                 from ../plugin/gen_exported.cpp:1,
                 from DistrhoPluginMaxGen.cpp:19:
gen_dsp/genlib_ops.h:1482:23: note: to match this ‘(’
    mData[i] = t_sample(cos(i * GENLIB_PI * 2. / (t_sample)(dim)));
                       ^
gen_dsp/genlib_ops.h:1482:65: error: expected primary-expression before ‘)’ token
    mData[i] = t_sample(cos(i * GENLIB_PI * 2. / (t_sample)(dim)));
                                                                 ^
make[1]: *** [Makefile:154: DistrhoPluginMaxGen.cpp.o] Error 1
make[1]: Leaving directory '/home/dreamer/Sources/_downloads/DISTRHO/max-gen-test/source'
make: *** [Makefile:35: plugin] Error 2

Updating the included dpf doesn't change anything.

I know I'm kind of stumbling in the dark here. not sure what the best approach to get this to work is. the DPF-Max-Gen project certainly works, but it clearly states that for making your own exports you should use this template.

dromer commented 3 years ago

Here is the exported max-gen code: http://mrtoasted.com/~dreamer/max_gen/

Compared to https://github.com/DISTRHO/DPF-Max-Gen/tree/master/plugins/gigaverb there are definitely some minor differences.