59 lines
2.3 KiB
C++
59 lines
2.3 KiB
C++
#include "./id3genres.h"
|
|
|
|
using namespace std;
|
|
|
|
namespace Media {
|
|
|
|
/*!
|
|
* \class Media::Id3Genres
|
|
* \brief Id3Genres converts pre-defined ID3 genres to strings and vise versa.
|
|
*/
|
|
|
|
/*!
|
|
* \brief Returns all known genre names.
|
|
*/
|
|
const char **Id3Genres::genreNames()
|
|
{
|
|
static const char *names[] = {
|
|
"Blues", "Classic Rock", "Country", "Dance", "Disco", "Funk", "Grunge",
|
|
"Hip-Hop", "Jazz", "Metal", "New Age", "Oldies", "Other", "Pop",
|
|
"R&B", "Rap", "Reggae", "Rock", "Techno", "Industrial", "Alternative",
|
|
"Ska", "Death Metal", "Pranks", "Soundtrack", "Euro-Techno", "Ambient", "Trip-Hop",
|
|
"Vocal", "Jazz+Funk", "Fusion", "Trance", "Classical", "Instrumental", "Acid",
|
|
"House", "Game", "Sound Clip", "Gospel", "Noise", "AlternRock", "Bass",
|
|
"Soul", "Punk", "Space", "Meditative", "Instrumental Pop", "Instrumental Rock", "Ethnic",
|
|
"Gothic", "Darkwave", "Techno-Industrial", "Electronic", "Pop-Folk", "Eurodance", "Dream",
|
|
"Southern Rock", "Comedy", "Cult", "Gangsta", "Top 40", "Christian Rap", "Pop/Funk",
|
|
"Jungle", "Native American", "Cabaret", "New Wave", "Psychadelic", "Rave", "Showtunes",
|
|
"Trailer", "Lo-Fi", "Tribal", "Acid Punk", "Acid Jazz", "Polka", "Retro",
|
|
"Musical", "Rock & Roll", "Hard Rock", "Folk", "Folk-Rock", "National Folk", "Swing",
|
|
"Fast Fusion", "Bebob", "Latin", "Revival", "Celtic", "Bluegrass", "Avantgarde",
|
|
"Gothic Rock", "Progressive Rock", "Psychedelic Rock", "Symphonic Rock", "Slow Rock", "Big Band", "Chorus",
|
|
"Easy Listening", "Acoustic", "Humour", "Speech", "Chanson", "Opera", "Chamber Music",
|
|
"Sonata", "Symphony", "Booty Bass", "Primus", "Porn Groove", "Satire", "Slow Jam",
|
|
"Club", "Tango", "Samba", "Folklore", "Ballad", "Power Ballad", "Rhythmic Soul",
|
|
"Freestyle", "Duet", "Punk Rock", "Drum Solo", "A capella", "Euro-House", "Dance Hall"
|
|
};
|
|
return names;
|
|
}
|
|
|
|
/*!
|
|
* \brief Returns the numerical denotation of the specified \a genre.
|
|
*/
|
|
int Id3Genres::indexFromString(const string &genre)
|
|
{
|
|
const char **ptr = genreNames();
|
|
int index = 0;
|
|
while(index < genreCount()) {
|
|
if(genre == *ptr) {
|
|
return index;
|
|
} else {
|
|
++ptr;
|
|
++index;
|
|
}
|
|
}
|
|
return 0;
|
|
}
|
|
|
|
}
|