svcore  1.9
CodedAudioFileReader Class Reference

#include <CodedAudioFileReader.h>

Inheritance diagram for CodedAudioFileReader:
Collaboration diagram for CodedAudioFileReader:

List of all members.

Public Types

enum  CacheMode { CacheInTemporaryFile, CacheInMemory }
typedef std::map< QString,
QString > 
TagMap

Signals

void progress (int)
void frameCountChanged ()

Public Member Functions

virtual ~CodedAudioFileReader ()
virtual void getInterleavedFrames (int start, int count, SampleBlock &frames) const
 Return interleaved samples for count frames from index start.
virtual int getNativeRate () const
virtual bool isQuicklySeekable () const
 Intermediate cache means all CodedAudioFileReaders are quickly seekable.
bool isOK () const
virtual QString getError () const
int getFrameCount () const
int getChannelCount () const
int getSampleRate () const
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 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.
virtual int getDecodeCompletion () const
virtual bool isUpdating () const

Protected Member Functions

 CodedAudioFileReader (CacheMode cacheMode, int targetRate, bool normalised)
void initialiseDecodeCache ()
void addSamplesToDecodeCache (float **samples, int nframes)
void addSamplesToDecodeCache (float *samplesInterleaved, int nframes)
void addSamplesToDecodeCache (const SampleBlock &interleaved)
void finishDecodeCache ()
bool isDecodeCacheInitialised () const
void startSerialised (QString id)
void endSerialised ()

Protected Attributes

QMutex m_cacheMutex
CacheMode m_cacheMode
SampleBlock m_data
QReadWriteLock m_dataLock
bool m_initialised
Serialiserm_serialiser
int m_fileRate
QString m_cacheFileName
SNDFILE * m_cacheFileWritePtr
WavFileReaderm_cacheFileReader
float * m_cacheWriteBuffer
int m_cacheWriteBufferIndex
int m_cacheWriteBufferSize
Resamplerm_resampler
float * m_resampleBuffer
int m_fileFrameCount
bool m_normalised
float m_max
float m_gain
int m_frameCount
int m_channelCount
int m_sampleRate

Private Member Functions

void pushBuffer (float *interleaved, int sz, bool final)
void pushBufferResampling (float *interleaved, int sz, float ratio, bool final)
void pushBufferNonResampling (float *interleaved, int sz)

Detailed Description

Definition at line 29 of file CodedAudioFileReader.h.


Member Typedef Documentation

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

Definition at line 65 of file AudioFileReader.h.


Member Enumeration Documentation

Enumerator:
CacheInTemporaryFile 
CacheInMemory 

Definition at line 36 of file CodedAudioFileReader.h.


Constructor & Destructor Documentation

CodedAudioFileReader::CodedAudioFileReader ( CacheMode  cacheMode,
int  targetRate,
bool  normalised 
) [protected]

Member Function Documentation

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

Return interleaved samples for count frames from index start.

The resulting sample block 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.

Implements AudioFileReader.

Definition at line 409 of file CodedAudioFileReader.cpp.

References CacheInMemory, CacheInTemporaryFile, WavFileReader::getInterleavedFrames(), AudioFileReader::isOK(), m_cacheFileReader, m_cacheMode, AudioFileReader::m_channelCount, m_data, m_dataLock, m_gain, m_initialised, m_normalised, and SVDEBUG.

virtual int CodedAudioFileReader::getNativeRate ( ) const [inline, virtual]

Reimplemented from AudioFileReader.

Definition at line 44 of file CodedAudioFileReader.h.

References m_fileRate.

virtual bool CodedAudioFileReader::isQuicklySeekable ( ) const [inline, virtual]

Intermediate cache means all CodedAudioFileReaders are quickly seekable.

Implements AudioFileReader.

Definition at line 47 of file CodedAudioFileReader.h.

void CodedAudioFileReader::pushBuffer ( float *  interleaved,
int  sz,
bool  final 
) [private]
virtual QString AudioFileReader::getError ( ) const [inline, virtual, inherited]
virtual QString AudioFileReader::getLocation ( ) const [inline, virtual, inherited]

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

Reimplemented in OggVorbisFileReader, MP3FileReader, DecodingWavFileReader, and WavFileReader.

Definition at line 49 of file AudioFileReader.h.

Referenced by WaveFileModel::getLocation().

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().

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

Reimplemented in OggVorbisFileReader, MP3FileReader, WavFileReader, and DecodingWavFileReader.

Definition at line 99 of file AudioFileReader.h.

Referenced by WaveFileModel::isReady().

virtual bool AudioFileReader::isUpdating ( ) const [inline, virtual, inherited]
void AudioFileReader::frameCountChanged ( ) [signal, inherited]

Member Data Documentation

QReadWriteLock CodedAudioFileReader::m_dataLock [mutable, protected]

Definition at line 81 of file CodedAudioFileReader.h.

Referenced by getInterleavedFrames(), and pushBufferNonResampling().

Definition at line 83 of file CodedAudioFileReader.h.

Referenced by endSerialised(), and startSerialised().

Definition at line 86 of file CodedAudioFileReader.h.

Referenced by initialiseDecodeCache(), and ~CodedAudioFileReader().

Definition at line 95 of file CodedAudioFileReader.h.

Referenced by pushBuffer(), and pushBufferResampling().

Definition at line 97 of file CodedAudioFileReader.h.

Referenced by getInterleavedFrames(), and pushBufferNonResampling().

float CodedAudioFileReader::m_max [protected]

Definition at line 98 of file CodedAudioFileReader.h.

Referenced by pushBufferNonResampling().

float CodedAudioFileReader::m_gain [protected]

Definition at line 99 of file CodedAudioFileReader.h.

Referenced by getInterleavedFrames(), and pushBufferNonResampling().


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