AudioFileReader Class Referenceabstract

#include <AudioFileReader.h>

Inheritance diagram for AudioFileReader:
Inheritance graph
Collaboration diagram for AudioFileReader:
Collaboration graph

Public Types

typedef std::map< QString, QString > TagMap
 Return any tag pairs picked up from the audio file. More...
 

Signals

void frameCountChanged ()
 

Public Member Functions

virtual ~AudioFileReader ()
 
bool isOK () const
 Return true if the file was opened successfully and no error has subsequently occurred. More...
 
virtual QString getError () const
 If isOK() is false, return an error string. More...
 
sv_frame_t getFrameCount () const
 Return the number of audio sample frames (i.e. More...
 
int getChannelCount () const
 Return the number of channels in the file. More...
 
sv_samplerate_t getSampleRate () const
 Return the samplerate at which the file is being read. More...
 
virtual sv_samplerate_t getNativeRate () const
 Return the native samplerate of the file. More...
 
virtual QString getLocation () const =0
 Return the location of the audio data in the reader (as passed in to the FileSource constructor, for example). More...
 
virtual QString getLocalFilename () const =0
 Return the local file path of the audio data. More...
 
virtual QString getTitle () const =0
 Return the title of the work in the audio file, if known. More...
 
virtual QString getMaker () const =0
 Return the "maker" of the work in the audio file, if known. More...
 
virtual TagMap getTags () const
 
virtual bool isQuicklySeekable () const =0
 Return true if this file supports fast seek and random access. More...
 
virtual int getDecodeCompletion () const
 Return a percentage value indicating how far through decoding the audio file we are. More...
 
virtual bool isUpdating () const
 Return true if decoding is still in progress and the frame count may change. More...
 
virtual floatvec_t getInterleavedFrames (sv_frame_t start, sv_frame_t count) const =0
 Return interleaved samples for count frames from index start. More...
 
virtual std::vector< floatvec_tgetDeInterleavedFrames (sv_frame_t start, sv_frame_t count) const
 Return de-interleaved samples for count frames from index start. More...
 

Protected Attributes

sv_frame_t m_frameCount
 
int m_channelCount
 
sv_samplerate_t m_sampleRate
 

Detailed Description

Definition at line 27 of file AudioFileReader.h.

Member Typedef Documentation

typedef std::map<QString, QString> AudioFileReader::TagMap

Return any tag pairs picked up from the audio file.

See also getTitle and getMaker, and note that a reader which does not implement getTags may still return values from those.

Definition at line 117 of file AudioFileReader.h.

Constructor & Destructor Documentation

virtual AudioFileReader::~AudioFileReader ( )
inlinevirtual

Definition at line 32 of file AudioFileReader.h.

Member Function Documentation

virtual QString AudioFileReader::getError ( ) const
inlinevirtual

If isOK() is false, return an error string.

Reimplemented in MP3FileReader, WavFileReader, BQAFileReader, and DecodingWavFileReader.

Definition at line 43 of file AudioFileReader.h.

sv_frame_t AudioFileReader::getFrameCount ( ) const
inline

Return the number of audio sample frames (i.e.

samples per channel) in the file.

Definition at line 49 of file AudioFileReader.h.

References m_frameCount.

Referenced by DecodingWavFileReader::addBlock(), DecodingWavFileReader::DecodingWavFileReader(), AudioFileSizeEstimator::estimate(), ReadOnlyWaveFileModel::getFrameCount(), and WritableWaveFileModel::normaliseToTarget().

int AudioFileReader::getChannelCount ( ) const
inline
sv_samplerate_t AudioFileReader::getSampleRate ( ) const
inline

Return the samplerate at which the file is being read.

This is the rate requested when the file was opened, which may differ from the native rate of the file (in which case the file will be resampled as it is read).

Definition at line 62 of file AudioFileReader.h.

References m_sampleRate.

Referenced by AudioFileReaderFactory::createReader(), DecodingWavFileReader::DecodingWavFileReader(), AudioFileSizeEstimator::estimate(), ReadOnlyWaveFileModel::getSampleRate(), and ReadOnlyWaveFileModel::ReadOnlyWaveFileModel().

virtual sv_samplerate_t AudioFileReader::getNativeRate ( ) const
inlinevirtual

Return the native samplerate of the file.

This will differ from getSampleRate() if the file is being resampled because it was requested to open at a different rate from native.

Reimplemented in CodedAudioFileReader.

Definition at line 69 of file AudioFileReader.h.

References getLocalFilename(), getLocation(), getMaker(), getTitle(), and m_sampleRate.

Referenced by ReadOnlyWaveFileModel::getNativeRate().

virtual QString AudioFileReader::getLocation ( ) const
pure virtual

Return the location of the audio data in the reader (as passed in to the FileSource constructor, for example).

This might be a remote URL.

See also getLocalFilename().

Implemented in MP3FileReader, WavFileReader, BQAFileReader, and DecodingWavFileReader.

Referenced by ReadOnlyWaveFileModel::getLocation(), and getNativeRate().

virtual QString AudioFileReader::getLocalFilename ( ) const
pure virtual

Return the local file path of the audio data.

This is the filesystem location most likely to contain readable audio data, but it may be in a different place or format from the originally specified location - for example, if the file has been retrieved and decoded, then it will be the (possibly temporary) decode target file.

This returns a non-empty value only if there is some local filename that contains exactly the audio data being provided by this reader. In some cases this may not exist, for example when a file has been resampled or normalised directly into a memory buffer. In this case, return an empty string.

See also getLocation().

Implemented in CodedAudioFileReader, and WavFileReader.

Referenced by ReadOnlyWaveFileModel::getLocalFilename(), and getNativeRate().

virtual QString AudioFileReader::getTitle ( ) const
pure virtual

Return the title of the work in the audio file, if known.

This may be implemented by subclasses that support file tagging. This is not the same thing as the file name.

Implemented in MP3FileReader, WavFileReader, BQAFileReader, and DecodingWavFileReader.

Referenced by getNativeRate(), ReadOnlyWaveFileModel::getTitle(), and ReadOnlyWaveFileModel::ReadOnlyWaveFileModel().

virtual QString AudioFileReader::getMaker ( ) const
pure virtual

Return the "maker" of the work in the audio file, if known.

This could represent almost anything (band, composer, conductor, artist etc).

Implemented in MP3FileReader, WavFileReader, BQAFileReader, and DecodingWavFileReader.

Referenced by ReadOnlyWaveFileModel::getMaker(), and getNativeRate().

virtual TagMap AudioFileReader::getTags ( ) const
inlinevirtual

Reimplemented in MP3FileReader.

Definition at line 118 of file AudioFileReader.h.

References isQuicklySeekable().

virtual bool AudioFileReader::isQuicklySeekable ( ) const
pure virtual

Return true if this file supports fast seek and random access.

Typically this will be true for uncompressed formats and false for compressed ones.

Implemented in CodedAudioFileReader, and WavFileReader.

Referenced by AudioFileReaderFactory::createReader(), and getTags().

virtual int AudioFileReader::getDecodeCompletion ( ) const
inlinevirtual

Return a percentage value indicating how far through decoding the audio file we are.

This should be implemented by subclasses that will not know exactly how long the audio file is (in sample frames) until it has been completely decoded. A reader that initialises the frame count directly within its constructor should always return 100 from this.

Reimplemented in MP3FileReader, WavFileReader, BQAFileReader, and DecodingWavFileReader.

Definition at line 135 of file AudioFileReader.h.

Referenced by ReadOnlyWaveFileModel::isReady().

virtual bool AudioFileReader::isUpdating ( ) const
inlinevirtual

Return true if decoding is still in progress and the frame count may change.

Reimplemented in MP3FileReader, WavFileReader, BQAFileReader, and DecodingWavFileReader.

Definition at line 141 of file AudioFileReader.h.

References frameCountChanged(), getDeInterleavedFrames(), and getInterleavedFrames().

Referenced by ReadOnlyWaveFileModel::isReady().

virtual floatvec_t AudioFileReader::getInterleavedFrames ( sv_frame_t  start,
sv_frame_t  count 
) const
pure virtual

Return interleaved samples for count frames from index start.

The resulting vector will contain count * getChannelCount() samples (or fewer if end of file is reached).

The subclass implementations of this function must be thread-safe – that is, safe to call from multiple threads with different arguments on the same object at the same time.

Implemented in WavFileReader, and CodedAudioFileReader.

Referenced by ReadOnlyWaveFileModel::getData(), getDeInterleavedFrames(), ReadOnlyWaveFileModel::getMultiChannelData(), ReadOnlyWaveFileModel::getSummaries(), and isUpdating().

vector< floatvec_t > AudioFileReader::getDeInterleavedFrames ( sv_frame_t  start,
sv_frame_t  count 
) const
virtual

Return de-interleaved samples for count frames from index start.

Implemented in this class (it calls getInterleavedFrames and de-interleaves). The resulting vector will contain getChannelCount() sample blocks of count samples each (or fewer if end of file is reached).

Definition at line 21 of file AudioFileReader.cpp.

References getChannelCount(), and getInterleavedFrames().

Referenced by isUpdating().

void AudioFileReader::frameCountChanged ( )
signal

Member Data Documentation


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