Juce modules and qualifiers

If I use events from the events module called “juce_events” I have to write things like juce::MouseEvent.

If I use dsp objects from the dsp module called “juce_dsp” I have to write things like dsp::AudioBlock

What’s the theory behind these different naming conventions? Both are juce modules and they are added in Projucer the same way and have the same type of names but one needs a more specified qualifier (dsp::) than the other (juce::).

The dsp namespace is nested in the juce namespace so you’d have to use juce::dsp::AudioBlock.

As for why the dsp namespace was added at all, I couldn’t say. I’d guess it’s simply to avoid name conflicts. For example there’s already juce::IIRFilter, then juce::dsp::IIR::Filter was added later (which isn’t a great example because that wouldn’t have caused a conflict, but stil…).

Are you sure?
I can use and compile using this declaration:
dsp::AudioBlock<float> anAudioblock;

But otherwise I guess you’ve answered my question. dsp:: has too much overlapping the usual juce namespace? Maybe indicating new modules will use this new qualifier name scheme?

Where are you calling dsp::AudioBlock from? If you’re already in the juce namespace, or the scope has using namespace juce; somewhere, you won’t need juce::.

IIRC the juce_dsp module was written by a contractor, not the main JUCE team so that may have played into it? I honestly couldn’t say for sure. Maybe future modules will follow the same trend, personally I hope they don’t.

I had “Add using namespace juce to JuceHeader.h” enabled in Projucer. So that’s where the namespace was set.

1 Like