Juce_dsp incompatible with Faust - dsp defined by both

dsp_module

#1

I got interested to try out some of the juce_dsp functions, and quickly ran into the problem that both juce_dsp and Faust define “dsp” (as a namespace and class, respectively). In the JUCE case, it can be disambiguated as juce::dsp::, but there is no namespace prefix for Faust classes, so all of its dsp class references are deemed ambiguous by the compiler. I have reported this to the Faust team, but another solution is to pick non-colliding names (much less work!).


#2

I ran into the same issue building Faust into JUCE. I resolved it with the explicit global namespace ::. It is indeed a pain and a hacky solution as the Faust compiler spits out a C++ file which I then manually edit to resolve the namespace.

You can see my working implementation here: https://github.com/creativeintent/temper/blob/master/Source/TemperDsp.cpp#L79

You can also set the DONT_SET_USING_JUCE_NAMESPACE preprocessor flag so that using namespace juce; is omitted from the JuceLibraryHeader. Then you end up needing the explicit juce:: all over the place but at least your dsp namespaces will no longer collide.

Anyway I think this one’s probably best fixed on the Faust side, perhaps by declaring a faust namespace of which dsp is a part. JUCE’s dsp namespace is already wrapped in the juce namespace, which is unique enough imo.


#3

TBH I do recommend that anyway nowadays. I think that in almost all the bigger projects we do, we tend to use explicit juce:: namespaces. Sure, it’s a bit more typing, but it makes the code easier to follow.


#4

Trying to understand the namespace politic in JUCE. So I see a general
namespace juce {…}, but then some sub-parts have their own : namespace juice { namespace dsp … } }, so what is the strategy ?