MP3AudioFormat vs WindowsMediaFormat|CoreAudioFormat?

Hey guys,

What’s the best way to choose between MP3AudioFormat versus WindowsMediaFormat and CoreAudioFormat for mp3 decoding?

I.e. I would prefer to use WindowsMediaFormat and CoreAudioFormat, but if neither exists, fall back to MP3AudioFormat.

Af far as I understand it CoreAudioFormat will always be there (we want to support OSX 10.5 and upwards), but WindowsMediaFormat might not be there in XP? <- notice the questionmark at the end of this sentence :wink:

grts,

  • bram

If you’re using an AudioFormatManager this is determined by the order in which the formats are registered. Your ordering sounds sensible so maybe MP3AudioFormat should be last in AudioFormatManager::registerBasicFormats()?

Mmmm, the problem is this:

void AudioFormatManager::registerBasicFormats()
{
    registerFormat (new WavAudioFormat(), true);
    registerFormat (new AiffAudioFormat(), false);

   #if JUCE_USE_FLAC
    registerFormat (new FlacAudioFormat(), false);
   #endif

   #if JUCE_USE_OGGVORBIS
    registerFormat (new OggVorbisAudioFormat(), false);
   #endif

   #if JUCE_MAC || JUCE_IOS
    registerFormat (new CoreAudioFormat(), false);
   #endif

   #if JUCE_USE_MP3AUDIOFORMAT
    registerFormat (new MP3AudioFormat(), false);
   #endif

   #if JUCE_USE_WINDOWS_MEDIA_FORMAT
    registerFormat (new WindowsMediaAudioFormat(), false);
   #endif
}

One:

–> #if JUCE_USE_WINDOWS_MEDIA_FORMAT
The inclusion of the WINDOWS_MEDIA_FORMAT is defined by a proprocessor definition and isn’t detected at runtime. I.e. if XP doesn’t support WINDOWS_MEDIA_FORMAT I suppose this will fail at runtime?
I would prefer not to do two builds (one for XP and one for “higher”)

Two:
Even Jules registers his Mp3-decoder before the WindowsMediaFormat…

But thx for mentioning the AudioFormatManager!

  • bram

Looking at WindowsMediaFormat, it is always included on Windows, no matter what version and by the looks of it can always decode mp3s. On the Mac the CoreAudioFormat asks the system what formats it can decode and generates the format list at runtime, perhaps WindowsMediaFormat should do the same, I’m not sure but I guess its safe to assume its available and can decode the formats it returns.

If you’re not using an AudioFormatManager I highly recommend it, it takes care of all these issues and will give you a wildcard string for all decodable formats (so you can use it in file choosers etc.). My point was that maybe Jules should add the WindowsMediaFormat before his own to prefer this. Personally I build with MP3AudioFormat disabled to avoid any potential licensing issues but I haven’t benchmarked the two so don’t know if MP3AudioFormat is more efficient.

I guess I’ll just test it on XP-SP3 to see if it works on it…
We have a fresh-installed-xp vmware image lying around here…

  • bram

You could call AudioFormatManager::clearFormats() and register the formats in the order you seem fit, that way you can determine the order yourself per platform.