#include <ipod_cpp.h>
Public Member Functions | |
IPodTrack (IPod &ipod) | |
Constructor, creates a new, empty track on the iPod. | |
IPodTrack (IPod &ipod, std::string filePath) | |
Constuctor, creates a new track from the supplied file on the iPod. | |
~IPodTrack () | |
Destructor, does not delete the track. | |
void | Remove (void) |
Removes the track from the iPod. | |
std::string | GetText (int tag) |
Retrieves a text attribute from the track. | |
void | SetText (int tag, std::string s) |
Sets a text attribute for the track. | |
bool | HasText (int tag) |
Indicates whether the track currently has a particular string. | |
uint32_t | GetAttribute (int tag) |
Return a numerical attribute for the track. | |
void | SetAttribute (int tag, uint32_t value) |
Set the value of an attribute for the track. | |
void | Upload (char *filePath, ipod_file_transfer_func callback=0, void *userData=0) |
Upload an audio file corresponding to this track. | |
void | Download (char *filePath, ipod_file_transfer_func callback=0, void *userData=0) |
Download an audio file corresponding to this track. | |
Friends | |
class | IPod |
IPodTrack::IPodTrack | ( | IPod & | ipod | ) |
Constructor, creates a new, empty track on the iPod.
ipod | the iPod on which to create the track |
IPodTrack::IPodTrack | ( | IPod & | ipod, | |
std::string | filePath | |||
) |
Constuctor, creates a new track from the supplied file on the iPod.
This is a quick and dirty way to add audio files to the iPod - you only have to supply a local file path to a supported audio file. The file will be analyzed to extract the appropriate tag and format information to populate the data structures, and the file will be uploaded to the iPod
ipod | the iPod on which to create the track | |
filePath | path to a .mp3, .m4a or .wav file |
void IPodTrack::Remove | ( | void | ) |
Removes the track from the iPod.
This method will remove the track from all playlists and from the master track list, and will remove the audio file from the iPod
std::string IPodTrack::GetText | ( | int | tag | ) |
Retrieves a text attribute from the track.
tag | an identifier for the string to be retrieved |
cout << "Title is " << track.GetText(IPOD_TITLE) << endl;
void IPodTrack::SetText | ( | int | tag, | |
std::string | s | |||
) |
Sets a text attribute for the track.
tag | an identifier for the string to be modified or added | |
s | the string to be assigned in the current encoding |
std:string title = "Dead Puppies"; track.SetText(IPOD_TITLE,title);
bool IPodTrack::HasText | ( | int | tag | ) |
Indicates whether the track currently has a particular string.
tag | an identifier for the string being queried |
uint32_t IPodTrack::GetAttribute | ( | int | tag | ) |
Return a numerical attribute for the track.
tag | an identifier for the attribute to be retrieved |
cout << "Sample rate is " << track.GetAttribute(IPOD_TRACK_SAMPLE_RATE) << endl;
void IPodTrack::SetAttribute | ( | int | tag, | |
uint32_t | value | |||
) |
Set the value of an attribute for the track.
tag | an identifier for the attribute to be modified | |
value | the new value for the attribute |
track.SetAttribute(IPOD_TRACK_ID,15);
void IPodTrack::Upload | ( | char * | filePath, | |
ipod_file_transfer_func | callback = 0 , |
|||
void * | userData = 0 | |||
) |
Upload an audio file corresponding to this track.
filePath | a path to the audio file to be uploaded | |
callback | a function to be called as the file is uploaded | |
userData | a pointer to a structure to be proved to the callback |
void IPodTrack::Download | ( | char * | filePath, | |
ipod_file_transfer_func | callback = 0 , |
|||
void * | userData = 0 | |||
) |
Download an audio file corresponding to this track.
filePath | a path to the audio file to be downloaded | |
callback | a function to be called as the file is downloaded | |
userData | a pointer to a structure to be proved to the callback |