Straightforward function to get the song title from the metadataValues of an AudioFormatReader?

I’m implementing some simple audio file reading functionality using AudioFormatManager::createReaderFor. The returned reader instance has a public metadataValues member which might contain the song title as metadata. Depending on the actual format, the key to look for differs – or might not be contained at all. I wonder if there is some helper function in juce that I’m overlooking that just checks all the possible keys being used for song titles in the various formats and returns the title or an empty string in case the file loaded defines no title.

In case there is no such function, is there any list of which exact metadata keys to look for for the various formats?

There isn’t a unified theory of metadata across codecs unfortunately! Since it’s a per codec thing (more or less), you’d have to check each AudioFormat subclass to know what JUCE supports.

For example, the WavAudioFormat supports a wide array of RIFF, ASWG, BWAV, and ACID tags. While AiffAudioFormat supports some apple tags.