libmusicbrainz3  3.0.3
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
MusicBrainz::Track Class Reference

Represents a track. More...

Inheritance diagram for MusicBrainz::Track:
MusicBrainz::Entity

Public Member Functions

 Track (const std::string &id=std::string(), const std::string &title=std::string())
 Constructor. More...
 
virtual ~Track ()
 Destructor. More...
 
std::string getTitle () const
 Returns the track's title. More...
 
void setTitle (const std::string &title)
 Sets the track's title. More...
 
ArtistgetArtist ()
 Returns the main artist of this track. More...
 
void setArtist (Artist *artist)
 Sets this track's main artist. More...
 
int getDuration () const
 Returns the duration of this track in milliseconds. More...
 
void setDuration (const int duration)
 Sets the duration of this track in milliseconds. More...
 
ReleaseListgetReleases ()
 Returns a list of releases from this artist. More...
 
int getNumReleases () const
 Returns number of releases. More...
 
ReleasegetRelease (int index)
 Returns an release specified by index. More...
 
void addRelease (Release *release)
 Adds a release to this artist's list of releases. More...
 
int getReleasesOffset () const
 Returns the offset of the release list. More...
 
void setReleasesOffset (const int offset)
 Sets the offset of the release list. More...
 
int getReleasesCount () const
 Returns the number of existing releases. More...
 
void setReleasesCount (const int count)
 Sets the count of the release list. More...
 
IsrcListgetIsrcs ()
 Returns the list of ISRCs for this track. More...
 
int getNumIsrcs () const
 Returns number of ISRCs. More...
 
std::string getIsrc (int index)
 Returns ISRC specified by index. More...
 
void addIsrc (const std::string &isrc)
 Adds an ISRC for this track. More...
 
- Public Member Functions inherited from MusicBrainz::Entity
virtual ~Entity ()
 Destructor. More...
 
virtual std::string getId () const
 Returns a MusicBrainz ID. More...
 
virtual void setId (const std::string &value)
 Sets a MusicBrainz ID. More...
 
RelationList getRelations (const std::string &targetType=std::string(), const std::string &relationType=std::string()) const
 Returns a list of relations. More...
 
void addRelation (Relation *relation)
 Adds a relation. More...
 
int getNumRelations () const
 Returns number of relations. More...
 
RelationgetRelation (int index)
 Returns an relation specified by index. More...
 
TagListgetTags ()
 
int getNumTags () const
 
TaggetTag (int index)
 
float getRating () const
 
void setRating (float rating)
 
int getRatingVoteCount () const
 
void setRatingVoteCount (int count)
 

Additional Inherited Members

- Protected Member Functions inherited from MusicBrainz::Entity
 Entity (const std::string &id)
 Constructor. More...
 

Detailed Description

Represents a track.

This class represents a track which may appear on one or more releases. A track may be associated with exactly one artist (the I{main} artist).

Using getReleases, you can find out on which releases this track appears. To get the track number, too, use the Release::getTracksOffset method.

Note
Currently, the MusicBrainz server doesn't support tracks to be on more than one release.
See Also
Release, Artist

Constructor & Destructor Documentation

MusicBrainz::Track::Track ( const std::string &  id = std::string(),
const std::string &  title = std::string() 
)

Constructor.

Parameters
ida string containing an absolute URI
titlea string containing the title
virtual MusicBrainz::Track::~Track ( )
virtual

Destructor.

Member Function Documentation

void MusicBrainz::Track::addIsrc ( const std::string &  isrc)

Adds an ISRC for this track.

Parameters
isrc
void MusicBrainz::Track::addRelease ( Release release)

Adds a release to this artist's list of releases.

Parameters
releasea pointer to Release object
Artist* MusicBrainz::Track::getArtist ( )

Returns the main artist of this track.

Returns
: a pointer to Artist object, or NULL
int MusicBrainz::Track::getDuration ( ) const

Returns the duration of this track in milliseconds.

Returns
an int containing the duration in milliseconds
std::string MusicBrainz::Track::getIsrc ( int  index)

Returns ISRC specified by index.

This is equivalent to getIsrcs()[index]

Returns
a string
See Also
getAliases
IsrcList& MusicBrainz::Track::getIsrcs ( )

Returns the list of ISRCs for this track.

Returns
a list of strings
int MusicBrainz::Track::getNumIsrcs ( ) const

Returns number of ISRCs.

This is equivalent to getIsrcs().size()

Returns
an int containing number of ISRCs
See Also
getIsrcs
int MusicBrainz::Track::getNumReleases ( ) const

Returns number of releases.

This is equivalent to getReleases().size()

Returns
an int containing number of releases
See Also
getReleases
Release* MusicBrainz::Track::getRelease ( int  index)

Returns an release specified by index.

This is equivalent to getReleases()[index]

Returns
a pointer to Release instance
See Also
getReleases
ReleaseList& MusicBrainz::Track::getReleases ( )

Returns a list of releases from this artist.

This may also include releases where this artist isn't the main artist but has just contributed one or more tracks (aka VA-Releases).

Returns
: a list of pointers to Release objects
int MusicBrainz::Track::getReleasesCount ( ) const

Returns the number of existing releases.

This may or may not match with the number of elements that getReleases and getNumReleases returns. If the count is higher than the list, it indicates that the list is incomplete.

Returns
an integer containing the count
See Also
getReleases
int MusicBrainz::Track::getReleasesOffset ( ) const

Returns the offset of the release list.

This is used if the track list is incomplete (ie. the web service only returned part of the tracks on this release). Note that the offset value is zero-based, which means track 0 is the first track.

Returns
an integer containing the offset
See Also
getReleases
std::string MusicBrainz::Track::getTitle ( ) const

Returns the track's title.

The style and format of this attribute is specified by the style guide.

Returns
a string containing an absolute URI
See Also
The MusicBrainz Style Guidelines
void MusicBrainz::Track::setArtist ( Artist artist)

Sets this track's main artist.

Parameters
artista pointer to Artist object, or NULL
void MusicBrainz::Track::setDuration ( const int  duration)

Sets the duration of this track in milliseconds.

Parameters
durationan int containing the duration in milliseconds
void MusicBrainz::Track::setReleasesCount ( const int  count)

Sets the count of the release list.

Parameters
countan integer containing the count
See Also
getReleasesCount
void MusicBrainz::Track::setReleasesOffset ( const int  offset)

Sets the offset of the release list.

Parameters
offsetan integer containing the offset
See Also
getReleasesOffset
void MusicBrainz::Track::setTitle ( const std::string &  title)

Sets the track's title.

Parameters
title,:a string containing the title
See Also
: getTitle