svcore  1.9
DecodingWavFileReader Class Reference

#include <DecodingWavFileReader.h>

Inheritance diagram for DecodingWavFileReader:
Collaboration diagram for DecodingWavFileReader:

List of all members.

Classes

class  DecodeThread

Public Types

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

Public Slots

void cancelled ()

Signals

void progress (int)
void frameCountChanged ()

Public Member Functions

 DecodingWavFileReader (FileSource source, ResampleMode resampleMode, CacheMode cacheMode, int targetRate=0, bool normalised=false, ProgressReporter *reporter=0)
virtual ~DecodingWavFileReader ()
virtual QString getError () 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 int getDecodeCompletion () const
virtual bool isUpdating () const
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
int getFrameCount () const
int getChannelCount () const
int getSampleRate () 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 Member Functions

void addBlock (const SampleBlock &frames)
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

FileSource m_source
QString m_path
QString m_error
bool m_cancelled
int m_processed
int m_completion
WavFileReaderm_original
ProgressReporterm_reporter
DecodeThreadm_decodeThread
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

Detailed Description

Definition at line 28 of file DecodingWavFileReader.h.


Member Typedef Documentation

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

Definition at line 65 of file AudioFileReader.h.


Member Enumeration Documentation

Enumerator:
ResampleAtOnce 
ResampleThreaded 

Definition at line 32 of file DecodingWavFileReader.h.

Enumerator:
CacheInTemporaryFile 
CacheInMemory 

Definition at line 36 of file CodedAudioFileReader.h.


Constructor & Destructor Documentation


Member Function Documentation

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

Reimplemented from AudioFileReader.

Definition at line 45 of file DecodingWavFileReader.h.

References m_error.

virtual QString DecodingWavFileReader::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 46 of file DecodingWavFileReader.h.

References FileSource::getLocation(), and m_source.

void DecodingWavFileReader::getSupportedExtensions ( std::set< QString > &  extensions) [static]

Definition at line 170 of file DecodingWavFileReader.cpp.

bool DecodingWavFileReader::supportsExtension ( QString  ext) [static]

Definition at line 176 of file DecodingWavFileReader.cpp.

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

Definition at line 182 of file DecodingWavFileReader.cpp.

bool DecodingWavFileReader::supports ( FileSource source) [static]

Definition at line 188 of file DecodingWavFileReader.cpp.

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

Reimplemented from AudioFileReader.

Definition at line 52 of file DecodingWavFileReader.h.

References m_completion.

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

Reimplemented from AudioFileReader.

Definition at line 54 of file DecodingWavFileReader.h.

References m_decodeThread.

Definition at line 112 of file DecodingWavFileReader.cpp.

References m_cancelled.

Referenced by DecodingWavFileReader().

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

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 CodedAudioFileReader::CacheInMemory, CodedAudioFileReader::CacheInTemporaryFile, WavFileReader::getInterleavedFrames(), AudioFileReader::isOK(), CodedAudioFileReader::m_cacheFileReader, CodedAudioFileReader::m_cacheMode, AudioFileReader::m_channelCount, CodedAudioFileReader::m_data, CodedAudioFileReader::m_dataLock, CodedAudioFileReader::m_gain, CodedAudioFileReader::m_initialised, CodedAudioFileReader::m_normalised, and SVDEBUG.

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

Reimplemented from AudioFileReader.

Definition at line 44 of file CodedAudioFileReader.h.

References CodedAudioFileReader::m_fileRate.

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

Intermediate cache means all CodedAudioFileReaders are quickly seekable.

Implements AudioFileReader.

Definition at line 47 of file CodedAudioFileReader.h.

void CodedAudioFileReader::progress ( int  ) [signal, inherited]
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]

Member Data Documentation

Definition at line 62 of file DecodingWavFileReader.h.

Referenced by getLocation().

QString DecodingWavFileReader::m_path [protected]

Definition at line 63 of file DecodingWavFileReader.h.

Referenced by DecodingWavFileReader().

QString DecodingWavFileReader::m_error [protected]

Definition at line 64 of file DecodingWavFileReader.h.

Referenced by DecodingWavFileReader(), and getError().

Definition at line 66 of file DecodingWavFileReader.h.

Referenced by addBlock().

QReadWriteLock CodedAudioFileReader::m_dataLock [mutable, protected, inherited]
float CodedAudioFileReader::m_max [protected, inherited]

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