svcore  1.9
WavFileReader Class Reference

Reader for audio files using libsndfile. More...

#include <WavFileReader.h>

Inheritance diagram for WavFileReader:
Collaboration diagram for WavFileReader:

List of all members.

Public Types

typedef std::map< QString,
QString > 
TagMap

Signals

void frameCountChanged ()

Public Member Functions

 WavFileReader (FileSource source, bool fileUpdating=false)
virtual ~WavFileReader ()
virtual QString getLocation () const
 Return the location of the audio data in the reader (as passed in to the FileSource constructor, for example).
virtual QString getError () const
virtual bool isQuicklySeekable () const
 Return true if this file supports fast seek and random access.
virtual void getInterleavedFrames (int start, int count, SampleBlock &frames) const
 Must be safe to call from multiple threads with different arguments on the same object at the same time.
virtual int getDecodeCompletion () const
bool isUpdating () const
void updateFrameCount ()
void updateDone ()
bool isOK () const
int getFrameCount () const
int getChannelCount () const
int getSampleRate () const
virtual int getNativeRate () const
virtual QString getTitle () const
 Return the title of the work in the audio file, if known.
virtual QString getMaker () const
 Return the "maker" of the work in the audio file, if known.
virtual TagMap getTags () const
virtual void getDeInterleavedFrames (int start, int count, std::vector< SampleBlock > &frames) const
 Return de-interleaved samples for count frames from index start.

Static Public Member Functions

static void getSupportedExtensions (std::set< QString > &extensions)
static bool supportsExtension (QString ext)
static bool supportsContentType (QString type)
static bool supports (FileSource &source)

Protected Attributes

SF_INFO m_fileInfo
SNDFILE * m_file
FileSource m_source
QString m_path
QString m_error
bool m_seekable
QMutex m_mutex
float * m_buffer
int m_bufsiz
int m_lastStart
int m_lastCount
bool m_updating
int m_frameCount
int m_channelCount
int m_sampleRate

Detailed Description

Reader for audio files using libsndfile.

This is typically intended for seekable file types that can be read directly (e.g. WAV, AIFF etc).

Compressed files supported by libsndfile (e.g. Ogg, FLAC) should normally be read using DecodingWavFileReader instead (which decodes to an intermediate cached file).

Definition at line 36 of file WavFileReader.h.


Member Typedef Documentation

typedef std::map<QString, QString> AudioFileReader::TagMap [inherited]

Definition at line 65 of file AudioFileReader.h.


Constructor & Destructor Documentation

Definition at line 81 of file WavFileReader.cpp.

References m_buffer, and m_file.


Member Function Documentation

virtual QString WavFileReader::getLocation ( ) const [inline, virtual]

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

Reimplemented from AudioFileReader.

Definition at line 42 of file WavFileReader.h.

References FileSource::getLocation(), and m_source.

virtual QString WavFileReader::getError ( ) const [inline, virtual]

Reimplemented from AudioFileReader.

Definition at line 43 of file WavFileReader.h.

References m_error.

Referenced by DecodingWavFileReader::DecodingWavFileReader(), and CodedAudioFileReader::initialiseDecodeCache().

virtual bool WavFileReader::isQuicklySeekable ( ) const [inline, 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.

Implements AudioFileReader.

Definition at line 45 of file WavFileReader.h.

References m_seekable.

void WavFileReader::getInterleavedFrames ( int  start,
int  count,
SampleBlock frames 
) const [virtual]

Must be safe to call from multiple threads with different arguments on the same object at the same time.

Implements AudioFileReader.

Definition at line 126 of file WavFileReader.cpp.

References m_buffer, m_bufsiz, AudioFileReader::m_channelCount, m_file, m_fileInfo, m_lastCount, m_lastStart, and m_mutex.

Referenced by DecodingWavFileReader::DecodingWavFileReader(), CodedAudioFileReader::getInterleavedFrames(), and DecodingWavFileReader::DecodeThread::run().

void WavFileReader::getSupportedExtensions ( std::set< QString > &  extensions) [static]
bool WavFileReader::supportsExtension ( QString  ext) [static]

Definition at line 216 of file WavFileReader.cpp.

References getSupportedExtensions().

Referenced by supports().

bool WavFileReader::supportsContentType ( QString  type) [static]

Definition at line 224 of file WavFileReader.cpp.

Referenced by supports().

virtual int WavFileReader::getDecodeCompletion ( ) const [inline, virtual]

Reimplemented from AudioFileReader.

Definition at line 59 of file WavFileReader.h.

bool WavFileReader::isUpdating ( ) const [inline, virtual]

Reimplemented from AudioFileReader.

Definition at line 61 of file WavFileReader.h.

References m_updating.

Definition at line 119 of file WavFileReader.cpp.

References m_updating, and updateFrameCount().

Referenced by WritableWaveFileModel::setCompletion().

virtual int AudioFileReader::getNativeRate ( ) const [inline, virtual, inherited]

Reimplemented in CodedAudioFileReader.

Definition at line 43 of file AudioFileReader.h.

References AudioFileReader::m_sampleRate.

Referenced by WaveFileModel::getNativeRate().

virtual QString AudioFileReader::getTitle ( ) const [inline, virtual, inherited]

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.

Reimplemented in OggVorbisFileReader, and MP3FileReader.

Definition at line 56 of file AudioFileReader.h.

Referenced by WaveFileModel::getTitle(), and WaveFileModel::WaveFileModel().

virtual QString AudioFileReader::getMaker ( ) const [inline, virtual, inherited]

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

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

Reimplemented in OggVorbisFileReader, and MP3FileReader.

Definition at line 63 of file AudioFileReader.h.

Referenced by WaveFileModel::getMaker().

virtual TagMap AudioFileReader::getTags ( ) const [inline, virtual, inherited]

Reimplemented in OggVorbisFileReader, and MP3FileReader.

Definition at line 66 of file AudioFileReader.h.

void AudioFileReader::getDeInterleavedFrames ( int  start,
int  count,
std::vector< SampleBlock > &  frames 
) const [virtual, inherited]

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 19 of file AudioFileReader.cpp.

References AudioFileReader::getChannelCount(), and AudioFileReader::getInterleavedFrames().

void AudioFileReader::frameCountChanged ( ) [signal, inherited]

Referenced by updateFrameCount().


Member Data Documentation

SF_INFO WavFileReader::m_fileInfo [protected]

Definition at line 67 of file WavFileReader.h.

Referenced by getInterleavedFrames(), updateFrameCount(), and WavFileReader().

SNDFILE* WavFileReader::m_file [protected]

Definition at line 70 of file WavFileReader.h.

Referenced by getLocation().

QString WavFileReader::m_path [protected]

Definition at line 71 of file WavFileReader.h.

Referenced by updateFrameCount(), and WavFileReader().

QString WavFileReader::m_error [protected]

Definition at line 72 of file WavFileReader.h.

Referenced by getError(), and WavFileReader().

bool WavFileReader::m_seekable [protected]

Definition at line 74 of file WavFileReader.h.

Referenced by isQuicklySeekable(), and WavFileReader().

QMutex WavFileReader::m_mutex [mutable, protected]

Definition at line 76 of file WavFileReader.h.

Referenced by getInterleavedFrames(), and updateFrameCount().

float* WavFileReader::m_buffer [mutable, protected]

Definition at line 77 of file WavFileReader.h.

Referenced by getInterleavedFrames(), and ~WavFileReader().

int WavFileReader::m_bufsiz [mutable, protected]

Definition at line 78 of file WavFileReader.h.

Referenced by getInterleavedFrames().

int WavFileReader::m_lastStart [mutable, protected]

Definition at line 79 of file WavFileReader.h.

Referenced by getInterleavedFrames().

int WavFileReader::m_lastCount [mutable, protected]

Definition at line 80 of file WavFileReader.h.

Referenced by getInterleavedFrames().

bool WavFileReader::m_updating [protected]

Definition at line 82 of file WavFileReader.h.

Referenced by isUpdating(), and updateDone().


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