libmusicbrainz3
3.0.2
|
Represents an Audio CD. More...
Public Types | |
typedef std::pair< int, int > | Track |
typedef std::vector< Disc::Track > | TrackList |
Public Member Functions | |
Disc (const std::string &id=std::string()) | |
Constructor. | |
virtual | ~Disc () |
Destructor. | |
std::string | getId () const |
Returns the MusicBrainz DiscID. | |
void | setId (const std::string &value) |
Sets the MusicBrainz DiscId. | |
int | getSectors () const |
Returns the length of the disc in sectors. | |
void | setSectors (const int sectors) |
Sets the length of the disc in sectors. | |
int | getFirstTrackNum () const |
Returns the number of the first track on this disc. | |
void | setFirstTrackNum (const int trackNum) |
Sets the number of the first track on this disc. | |
int | getLastTrackNum () const |
Returns the number of the last track on this disc. | |
void | setLastTrackNum (const int trackNum) |
Sets the number of the last track on this disc. | |
Disc::TrackList & | getTracks () |
Returns the sector offset and length of this disc. | |
void | addTrack (Disc::Track track) |
Adds a track to the list. |
Represents an Audio CD.
This class represents an Audio CD. A disc can have an ID (the MusicBrainz DiscID), which is calculated from the CD's table of contents (TOC). There may also be data from the TOC like the length of the disc in sectors, as well as position and length of the tracks.
Note that different TOCs, maybe due to different pressings, lead to different DiscIDs. Conversely, if two different discs have the same TOC, they also have the same DiscID (which is unlikely but not impossible). DiscIDs are always 28 characters long and look like this: 'J68I_CDcUFdCRCIbHSEbTBCbooA-'. Sometimes they are also referred to as CDIndex IDs.
The MusicBrainz web service (WebService) only returns the DiscID and the number of sectors. The DiscID calculation function readDisc, however, can retrieve the other attributes of Disc from an Audio CD in the disc drive.
typedef std::pair<int, int> MusicBrainz::Disc::Track |
typedef std::vector<Disc::Track> MusicBrainz::Disc::TrackList |
MusicBrainz::Disc::Disc | ( | const std::string & | id = std::string() | ) |
Constructor.
id | a string containing a 28-character DiscID |
|
virtual |
Destructor.
void MusicBrainz::Disc::addTrack | ( | Disc::Track | track | ) |
Adds a track to the list.
This method adds an (offset, length) pair to the list of tracks. The leadout track must not be added. The total length of the disc can be set using setSectors.
track | an (offset, length) pair (values are ints) |
int MusicBrainz::Disc::getFirstTrackNum | ( | ) | const |
Returns the number of the first track on this disc.
std::string MusicBrainz::Disc::getId | ( | ) | const |
Returns the MusicBrainz DiscID.
int MusicBrainz::Disc::getLastTrackNum | ( | ) | const |
Returns the number of the last track on this disc.
int MusicBrainz::Disc::getSectors | ( | ) | const |
Returns the length of the disc in sectors.
Disc::TrackList& MusicBrainz::Disc::getTracks | ( | ) |
Returns the sector offset and length of this disc.
This method returns a list of tuples containing the track offset and length in sectors for all tracks on this disc. The track offset is measured from the beginning of the disc, the length is relative to the track's offset. Note that the leadout track is not included.
void MusicBrainz::Disc::setFirstTrackNum | ( | const int | trackNum | ) |
Sets the number of the first track on this disc.
trackNum | an int containing the track number |
void MusicBrainz::Disc::setId | ( | const std::string & | value | ) |
Sets the MusicBrainz DiscId.
value | a string containing a 28-character DiscID |
void MusicBrainz::Disc::setLastTrackNum | ( | const int | trackNum | ) |
Sets the number of the last track on this disc.
trackNum | an int containing the track number |
void MusicBrainz::Disc::setSectors | ( | const int | sectors | ) |
Sets the length of the disc in sectors.
sectors | the length in sectors as an integer |