Inherited some JUCE applications - important questions

Hi,
I’ve just inherited a couple of old applications coded in JUCE and I have spent some time analysing the code. I have two immediate questions and would appreciate any initial guidance.

  1. The above mentioned code is written in JUCE 3.3.1. My first task will be to upgrade to the latest JUCE - what should my expectations be for level of difficulty? Are there any particular issues that I should pay special attention to?

  2. Both of the applications play MP3 files and, looking at the docs and the JUCE code itself, it clearly states that to play any particular format, you must register that format first. However, nowhere in the code is the MP3 format being registered. I can see calls to AudioFormatManager::registerBasicFormats() but that only registers WAV and AIFF. Further, the file juce_audio_formats.h in the JuceLibraryCode has MP3 set to no:

#ifndef JUCE_USE_MP3AUDIOFORMAT
#define JUCE_USE_MP3AUDIOFORMAT 0
#endif

So my guess is that there is no setting in the development tool that has enabled MP3.

My immediate concern, then, is whether the code that I am looking at is the same as running in production - or not. Is there any way whereby JUCE can play MP3 format files without a specific call to registerFormat()?

Kind regards,
ac

  1. You should expect medium difficulty. We’ve tried to keep things backwards compatible, but lots of things are different now. I’ve not actually migrated a plug-in myself though, perhaps someone who has jumped through all the hoops can chime in…?

  2. Can you just compile the code you’ve been given and see if that loads MP3s? If so, stepping through the code in a debugger will show you what’s happening.

The JUCE_USE_MP3AUDIOFORMAT flag controls whether or not the library uses its built-in MP3 decoder. If the flag is set, you get the built-in decoder. If the flag is clear, the library relies on the operating system.

So your app can read MP3 files in either case. I think this used to be more of an issue when the owners of the patents for MP3 were requiring paid licenses. See the comments at the start of juce_MP3AudioFormat.cpp.

I’ve found that the built-in decoder is a little more forgiving; it will open and decode MP3 files with format errors that the system decoders for both macOS & Windows rejected.

Matt

That is a mistake in the documentation. @t0m @jules In current Juce, registerBasicFormats registers all the formats that have been enabled in AppConfig.h. (Or checked as enabled in the Projucer project.)

Yep, I’ll get that fixed.

t0m.

Many thanks for your feedback. To answer you question in point 2, no, I can’t. I only have a git repo and no original development environment that generated the repo. So, I need to get a working development environment first - i.e. upgrade…

Regards,
ac

Xenakios,
Many thanks for your feedback.

Regards,
ac