2015-09-06 19:57:33 +02:00
|
|
|
#include "./id3genres.h"
|
2015-04-22 19:22:01 +02:00
|
|
|
|
|
|
|
using namespace std;
|
|
|
|
|
2018-03-06 23:09:15 +01:00
|
|
|
namespace TagParser {
|
2015-04-22 19:22:01 +02:00
|
|
|
|
|
|
|
/*!
|
2016-06-10 23:08:01 +02:00
|
|
|
* \class Id3Genres
|
2021-07-02 03:00:50 +02:00
|
|
|
* \brief The Id3Genres class converts pre-defined ID3 genres to strings and vice versa.
|
2015-04-22 19:22:01 +02:00
|
|
|
*/
|
|
|
|
|
|
|
|
/*!
|
|
|
|
* \brief Returns all known genre names.
|
|
|
|
*/
|
2021-01-30 21:53:06 +01:00
|
|
|
const std::string_view *Id3Genres::genreNames()
|
2015-04-22 19:22:01 +02:00
|
|
|
{
|
2021-01-30 21:53:06 +01:00
|
|
|
static const std::string_view names[] = { "Blues", "Classic Rock", "Country", "Dance", "Disco", "Funk", "Grunge", "Hip-Hop", "Jazz", "Metal",
|
2019-06-16 17:42:14 +02:00
|
|
|
"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",
|
2018-03-07 01:17:50 +01:00
|
|
|
"Ethnic", "Gothic", "Darkwave", "Techno-Industrial", "Electronic", "Pop-Folk", "Eurodance", "Dream", "Southern Rock", "Comedy", "Cult",
|
2021-07-02 03:00:50 +02:00
|
|
|
"Gangsta", "Top 40", "Christian Rap", "Pop/Funk", "Jungle", "Native American", "Cabaret", "New Wave", "Psychedelic", "Rave", "Showtunes",
|
2018-03-07 01:17:50 +01:00
|
|
|
"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", "Goa",
|
|
|
|
"Drum & Bass", "Club-House", "Hardcore Techno", "Terror", "Indie", "BritPop", "Negerpunk", "Polsk Punk", "Beat", "Christian Gangsta Rap",
|
|
|
|
"Heavy Metal", "Black Metal", "Crossover", "Contemporary Christian", "Christian Rock", "Merengue", "Salsa", "Thrash Metal", "Anime", "Jpop",
|
|
|
|
"Synthpop", "Abstract", "Art Rock", "Baroque", "Bhangra", "Big Beat", "Breakbeat", "Chillout", "Downtempo", "Dub", "EBM", "Eclectic",
|
|
|
|
"Electro", "Electroclash", "Emo", "Experimental", "Garage", "Global", "IDM", "Illbient", "Industro-Goth", "Jam Band", "Krautrock",
|
|
|
|
"Leftfield", "Lounge", "Math Rock", "New Romantic", "Nu-Breakz", "Post-Punk", "Post-Rock", "Psytrance", "Shoegaze", "Space Rock", "Trop Rock",
|
|
|
|
"World Music", "Neoclassical", "Audiobook", "Audio Theatre", "Neue Deutsche Welle", "Podcast", "Indie Rock", "G-Funk", "Dubstep",
|
|
|
|
"Garage Rock", "Psybient" };
|
2015-04-22 19:22:01 +02:00
|
|
|
return names;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*!
|
2017-06-03 20:58:22 +02:00
|
|
|
* \brief Returns the numerical denotation of the specified \a genre or -1 if \a genre is unknown.
|
2019-02-13 18:06:02 +01:00
|
|
|
* \remarks If \a string is empty, the non-standard Id3Genres::emptyGenreIndex() is returned.
|
2015-04-22 19:22:01 +02:00
|
|
|
*/
|
2021-01-30 21:53:06 +01:00
|
|
|
int Id3Genres::indexFromString(std::string_view genre)
|
2015-04-22 19:22:01 +02:00
|
|
|
{
|
2019-02-13 18:06:02 +01:00
|
|
|
if (genre.empty()) {
|
|
|
|
return emptyGenreIndex();
|
|
|
|
}
|
2021-01-30 21:53:06 +01:00
|
|
|
const string_view *ptr = genreNames();
|
2018-03-07 01:17:50 +01:00
|
|
|
for (int index = 0; index < genreCount(); ++ptr, ++index) {
|
|
|
|
if (genre == *ptr) {
|
2015-04-22 19:22:01 +02:00
|
|
|
return index;
|
|
|
|
}
|
|
|
|
}
|
2017-06-03 20:58:22 +02:00
|
|
|
return -1;
|
2015-04-22 19:22:01 +02:00
|
|
|
}
|
|
|
|
|
2018-03-07 01:17:50 +01:00
|
|
|
} // namespace TagParser
|