Represents an Audio CD.
More...
List of all members.
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.
|
Detailed Description
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.
Member Typedef Documentation
Constructor & Destructor Documentation
MusicBrainz::Disc::Disc |
( |
const std::string & |
id = std::string() |
) |
|
Constructor.
- Parameters:
-
| id | a string containing a 28-character DiscID |
virtual MusicBrainz::Disc::~Disc |
( |
|
) |
[virtual] |
Member Function Documentation
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.
- Parameters:
-
| track | an (offset, length) pair (values are ints) |
- See also:
- getTracks
int MusicBrainz::Disc::getFirstTrackNum |
( |
|
) |
const |
Returns the number of the first track on this disc.
- Returns:
- an int containing the track number
std::string MusicBrainz::Disc::getId |
( |
|
) |
const |
Returns the MusicBrainz DiscID.
- Returns:
- a string containing a 28-character DiscID
int MusicBrainz::Disc::getLastTrackNum |
( |
|
) |
const |
Returns the number of the last track on this disc.
- Returns:
- an int containing the track number
int MusicBrainz::Disc::getSectors |
( |
|
) |
const |
Returns the length of the disc in sectors.
- Returns:
- the length in sectors as an integer
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.
- Returns:
- a vector of (offset, length) pairs (values are ints)
void MusicBrainz::Disc::setFirstTrackNum |
( |
const int |
trackNum |
) |
|
Sets the number of the first track on this disc.
- Parameters:
-
| trackNum | an int containing the track number |
void MusicBrainz::Disc::setId |
( |
const std::string & |
value |
) |
|
Sets the MusicBrainz DiscId.
- Parameters:
-
| 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.
- Parameters:
-
| trackNum | an int containing the track number |
void MusicBrainz::Disc::setSectors |
( |
const int |
sectors |
) |
|
Sets the length of the disc in sectors.
- Parameters:
-
| sectors | the length in sectors as an integer |