1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
|
#pragma once
#include <QString>
#include <QUuid>
#include "sources/audiosource.h"
#include "track/bpm.h"
#include "track/replaygain.h"
#include "track/serato/tags.h"
#include "util/duration.h"
#include "util/macros.h"
namespace mixxx {
class TrackInfo final {
// Track properties (in alphabetical order)
PROPERTY_SET_BYVAL_GET_BYREF(QString, artist, Artist)
PROPERTY_SET_BYVAL_GET_BYREF(Bpm, bpm, Bpm)
PROPERTY_SET_BYVAL_GET_BYREF(QString, comment, Comment)
PROPERTY_SET_BYVAL_GET_BYREF(QString, composer, Composer)
#if defined(__EXTRA_METADATA__)
PROPERTY_SET_BYVAL_GET_BYREF(QString, conductor, Conductor)
PROPERTY_SET_BYVAL_GET_BYREF(QString, discNumber, DiscNumber)
PROPERTY_SET_BYVAL_GET_BYREF(QString, discTotal, DiscTotal)
PROPERTY_SET_BYVAL_GET_BYREF(QString, encoder, Encoder)
PROPERTY_SET_BYVAL_GET_BYREF(QString, encoderSettings, EncoderSettings)
#endif // __EXTRA_METADATA__
PROPERTY_SET_BYVAL_GET_BYREF(QString, genre, Genre)
PROPERTY_SET_BYVAL_GET_BYREF(QString, grouping, Grouping)
#if defined(__EXTRA_METADATA__)
PROPERTY_SET_BYVAL_GET_BYREF(QString, isrc, ISRC)
#endif // __EXTRA_METADATA__
PROPERTY_SET_BYVAL_GET_BYREF(QString, key, Key)
#if defined(__EXTRA_METADATA__)
PROPERTY_SET_BYVAL_GET_BYREF(QString, language, Language)
PROPERTY_SET_BYVAL_GET_BYREF(QString, lyricist, Lyricist)
PROPERTY_SET_BYVAL_GET_BYREF(QString, mood, Mood)
PROPERTY_SET_BYVAL_GET_BYREF(QString, movement, Movement)
PROPERTY_SET_BYVAL_GET_BYREF(QUuid, musicBrainzArtistId, MusicBrainzArtistId)
PROPERTY_SET_BYVAL_GET_BYREF(QUuid, musicBrainzRecordingId, MusicBrainzRecordingId)
PROPERTY_SET_BYVAL_GET_BYREF(QUuid, musicBrainzReleaseId, MusicBrainzReleaseId)
PROPERTY_SET_BYVAL_GET_BYREF(QUuid, musicBrainzWorkId, MusicBrainzWorkId)
PROPERTY_SET_BYVAL_GET_BYREF(QString, remixer, Remixer)
#endif // __EXTRA_METADATA__
PROPERTY_SET_BYVAL_GET_BYREF(ReplayGain, replayGain, ReplayGain)
#if defined(__EXTRA_METADATA__)
PROPERTY_SET_BYVAL_GET_BYREF(SeratoTags, seratoTags, SeratoTags)
PROPERTY_SET_BYVAL_GET_BYREF(QString, subtitle, Subtitle)
#endif // __EXTRA_METADATA__
PROPERTY_SET_BYVAL_GET_BYREF(QString, title, Title)
PROPERTY_SET_BYVAL_GET_BYREF(QString, trackNumber, TrackNumber)
PROPERTY_SET_BYVAL_GET_BYREF(QString, trackTotal, TrackTotal)
#if defined(__EXTRA_METADATA__)
PROPERTY_SET_BYVAL_GET_BYREF(QString, work, Work)
#endif // __EXTRA_METADATA__
PROPERTY_SET_BYVAL_GET_BYREF(QString, year, Year) // = release date
public:
TrackInfo() = default;
TrackInfo(TrackInfo&&) = default;
TrackInfo(const TrackInfo&) = default;
/*non-virtual*/ ~TrackInfo() = default;
TrackInfo& operator=(TrackInfo&&) = default;
TrackInfo& operator=(const TrackInfo&) = default;
// Returns true if modified
bool parseArtistTitleFromFileName(
QString fileName,
bool splitArtistTitle);
// Adjusts floating-point properties to match their string representation
// in file tags to account for rounding errors.
void normalizeBeforeExport() {
refBpm().normalizeBeforeExport();
refReplayGain().normalizeBeforeExport();
}
bool compareEq(
const TrackInfo& trackInfo,
Bpm::Comparison cmpBpm = Bpm::Comparison::Default) const;
};
inline
bool operator==(const TrackInfo& lhs, const TrackInfo& rhs) {
return lhs.compareEq(rhs);
}
inline
bool operator!=(const TrackInfo& lhs, const TrackInfo& rhs) {
return !(lhs == rhs);
}
QDebug operator<<(QDebug dbg, const TrackInfo& arg);
} // namespace mixxx
Q_DECLARE_METATYPE(mixxx::TrackInfo)
|