AudioCDReader Class Reference

Inheritance diagram for AudioCDReader:

AudioFormatReader List of all members.

Detailed Description

A type of AudioFormatReader that reads from an audio CD.

One of these can be used to read a CD as if it's one big audio stream. Use the getPositionOfTrackStart() method to find where the individual tracks are within the stream.

See also:
AudioFormatReader


Public Member Functions

 ~AudioCDReader ()
 Destructor.
bool read (int **destSamples, int64 startSampleInFile, int numSamples)
 Implementation of the AudioFormatReader method.
bool isCDStillPresent () const
 Checks whether the CD has been removed from the drive.
int getNumTracks () const
 Returns the total number of tracks (audio + data).
int getPositionOfTrackStart (int trackNum) const
 Finds the sample offset of the start of a track.
bool isTrackAudio (int trackNum) const
 Returns true if a given track is an audio track.
void refreshTrackLengths ()
 Refreshes the object's table of contents.
void enableIndexScanning (bool enabled)
 Enables scanning for indexes within tracks.
int getLastIndex () const
 Returns the index number found during the last read() call.
const Array< int > findIndexesInTrack (const int trackNumber)
 Scans a track to find the position of any indexes within it.
int getCDDBId ()
 Returns the CDDB id number for the CD.
void ejectDisk ()
 Tries to eject the disk.

Static Public Member Functions

static const StringArray getAvailableCDNames ()
 Returns a list of names of Audio CDs currently available for reading.
static AudioCDReadercreateReaderForCD (const int index)
 Tries to create an AudioFormatReader that can read from an Audio CD.
static int compareElements (const File *const, const File *const) throw ()


Constructor & Destructor Documentation

AudioCDReader::~AudioCDReader  ) 
 

Destructor.


Member Function Documentation

static const StringArray AudioCDReader::getAvailableCDNames  )  [static]
 

Returns a list of names of Audio CDs currently available for reading.

If there's a CD drive but no CD in it, this might return an empty list, or possibly a device that can be opened but which has no tracks, depending on the platform.

See also:
createReaderForCD

static AudioCDReader* AudioCDReader::createReaderForCD const int  index  )  [static]
 

Tries to create an AudioFormatReader that can read from an Audio CD.

Parameters:
index the index of one of the available CDs - use getAvailableCDNames() to find out how many there are.
Returns:
a new AudioCDReader object, or 0 if it couldn't be created. The caller will be responsible for deleting the object returned.

bool AudioCDReader::read int **  destSamples,
int64  startSampleInFile,
int  numSamples
[virtual]
 

Implementation of the AudioFormatReader method.

Implements AudioFormatReader.

bool AudioCDReader::isCDStillPresent  )  const
 

Checks whether the CD has been removed from the drive.

int AudioCDReader::getNumTracks  )  const
 

Returns the total number of tracks (audio + data).

int AudioCDReader::getPositionOfTrackStart int  trackNum  )  const
 

Finds the sample offset of the start of a track.

Parameters:
trackNum the track number, where 0 is the first track.

bool AudioCDReader::isTrackAudio int  trackNum  )  const
 

Returns true if a given track is an audio track.

Parameters:
trackNum the track number, where 0 is the first track.

void AudioCDReader::refreshTrackLengths  ) 
 

Refreshes the object's table of contents.

If the disc has been ejected and a different one put in since this object was created, this will cause it to update its idea of how many tracks there are, etc.

void AudioCDReader::enableIndexScanning bool  enabled  ) 
 

Enables scanning for indexes within tracks.

See also:
getLastIndex

int AudioCDReader::getLastIndex  )  const
 

Returns the index number found during the last read() call.

Index scanning is turned off by default - turn it on with enableIndexScanning().

Then when the read() method is called, if it comes across an index within that block, the index number is stored and returned by this method.

Some devices might not support indexes, of course.

(If you don't know what CD indexes are, it's unlikely you'll ever need them).

See also:
enableIndexScanning

const Array<int> AudioCDReader::findIndexesInTrack const int  trackNumber  ) 
 

Scans a track to find the position of any indexes within it.

Parameters:
trackNumber the track to look in, where 0 is the first track on the disc
Returns:
an array of sample positions of any index points found (not including the index that marks the start of the track)

int AudioCDReader::getCDDBId  ) 
 

Returns the CDDB id number for the CD.

It's not a great way of identifying a disc, but it's traditional.

void AudioCDReader::ejectDisk  ) 
 

Tries to eject the disk.

Of course this might not be possible, if some other process is using it.

static int AudioCDReader::compareElements const File const,
const File const
throw () [static]
 


The documentation for this class was generated from the following file: