svcore  1.9
DecodingWavFileReader Class Reference

#include <DecodingWavFileReader.h>

Inheritance diagram for DecodingWavFileReader:
Collaboration diagram for DecodingWavFileReader:

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). More...
 
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. More...
 
virtual int getNativeRate () const
 
virtual bool isQuicklySeekable () const
 Intermediate cache means all CodedAudioFileReaders are quickly seekable. More...
 
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. More...
 
virtual QString getMaker () const
 Return the "maker" of the work in the audio file, if known. More...
 
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. More...
 

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

◆ TagMap

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

Definition at line 65 of file AudioFileReader.h.

Member Enumeration Documentation

◆ ResampleMode

Enumerator
ResampleAtOnce 
ResampleThreaded 

Definition at line 32 of file DecodingWavFileReader.h.

◆ CacheMode

Enumerator
CacheInTemporaryFile 
CacheInMemory 

Definition at line 36 of file CodedAudioFileReader.h.

Constructor & Destructor Documentation

◆ DecodingWavFileReader()

◆ ~DecodingWavFileReader()

DecodingWavFileReader::~DecodingWavFileReader ( )
virtual

Definition at line 100 of file DecodingWavFileReader.cpp.

References m_cancelled, m_decodeThread, and m_original.

Member Function Documentation

◆ getError()

virtual QString DecodingWavFileReader::getError ( ) const
inlinevirtual

Reimplemented from AudioFileReader.

Definition at line 45 of file DecodingWavFileReader.h.

References m_error.

◆ getLocation()

virtual QString DecodingWavFileReader::getLocation ( ) const
inlinevirtual

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.

◆ getSupportedExtensions()

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

◆ supportsExtension()

bool DecodingWavFileReader::supportsExtension ( QString  ext)
static

Definition at line 176 of file DecodingWavFileReader.cpp.

References WavFileReader::supportsExtension().

◆ supportsContentType()

bool DecodingWavFileReader::supportsContentType ( QString  type)
static

Definition at line 182 of file DecodingWavFileReader.cpp.

References WavFileReader::supportsContentType().

◆ supports()

bool DecodingWavFileReader::supports ( FileSource source)
static

Definition at line 188 of file DecodingWavFileReader.cpp.

References WavFileReader::supports().

◆ getDecodeCompletion()

virtual int DecodingWavFileReader::getDecodeCompletion ( ) const
inlinevirtual

Reimplemented from AudioFileReader.

Definition at line 52 of file DecodingWavFileReader.h.

References m_completion.

◆ isUpdating()

virtual bool DecodingWavFileReader::isUpdating ( ) const
inlinevirtual

Reimplemented from AudioFileReader.

Definition at line 54 of file DecodingWavFileReader.h.

References m_decodeThread.

◆ cancelled

void DecodingWavFileReader::cancelled ( )
slot

Definition at line 112 of file DecodingWavFileReader.cpp.

References m_cancelled.

Referenced by DecodingWavFileReader().

◆ addBlock()

◆ getInterleavedFrames()

void CodedAudioFileReader::getInterleavedFrames ( int  start,
int  count,
SampleBlock frames 
) const
virtualinherited

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.

◆ getNativeRate()

virtual int CodedAudioFileReader::getNativeRate ( ) const
inlinevirtualinherited

Reimplemented from AudioFileReader.

Definition at line 44 of file CodedAudioFileReader.h.

References CodedAudioFileReader::m_fileRate.

◆ isQuicklySeekable()

virtual bool CodedAudioFileReader::isQuicklySeekable ( ) const
inlinevirtualinherited

Intermediate cache means all CodedAudioFileReaders are quickly seekable.

Implements AudioFileReader.

Definition at line 47 of file CodedAudioFileReader.h.

◆ progress

void CodedAudioFileReader::progress ( int  )
signalinherited

◆ initialiseDecodeCache()

◆ addSamplesToDecodeCache() [1/3]

◆ addSamplesToDecodeCache() [2/3]

◆ addSamplesToDecodeCache() [3/3]

◆ finishDecodeCache()

◆ isDecodeCacheInitialised()

◆ startSerialised()

void CodedAudioFileReader::startSerialised ( QString  id)
protectedinherited

◆ endSerialised()

◆ isOK()

◆ getFrameCount()

int AudioFileReader::getFrameCount ( ) const
inlineinherited

◆ getChannelCount()

int AudioFileReader::getChannelCount ( ) const
inlineinherited

◆ getSampleRate()

int AudioFileReader::getSampleRate ( ) const
inlineinherited

◆ getTitle()

virtual QString AudioFileReader::getTitle ( ) const
inlinevirtualinherited

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

◆ getMaker()

virtual QString AudioFileReader::getMaker ( ) const
inlinevirtualinherited

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

◆ getTags()

virtual TagMap AudioFileReader::getTags ( ) const
inlinevirtualinherited

Reimplemented in OggVorbisFileReader, and MP3FileReader.

Definition at line 66 of file AudioFileReader.h.

◆ getDeInterleavedFrames()

void AudioFileReader::getDeInterleavedFrames ( int  start,
int  count,
std::vector< SampleBlock > &  frames 
) const
virtualinherited

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

◆ frameCountChanged

void AudioFileReader::frameCountChanged ( )
signalinherited

Member Data Documentation

◆ m_source

FileSource DecodingWavFileReader::m_source
protected

Definition at line 62 of file DecodingWavFileReader.h.

Referenced by getLocation().

◆ m_path

QString DecodingWavFileReader::m_path
protected

Definition at line 63 of file DecodingWavFileReader.h.

Referenced by DecodingWavFileReader().

◆ m_error

QString DecodingWavFileReader::m_error
protected

Definition at line 64 of file DecodingWavFileReader.h.

Referenced by DecodingWavFileReader(), and getError().

◆ m_cancelled

bool DecodingWavFileReader::m_cancelled
protected

◆ m_processed

int DecodingWavFileReader::m_processed
protected

Definition at line 66 of file DecodingWavFileReader.h.

Referenced by addBlock().

◆ m_completion

int DecodingWavFileReader::m_completion
protected

◆ m_original

WavFileReader* DecodingWavFileReader::m_original
protected

◆ m_reporter

ProgressReporter* DecodingWavFileReader::m_reporter
protected

Definition at line 70 of file DecodingWavFileReader.h.

Referenced by addBlock(), and DecodingWavFileReader().

◆ m_decodeThread

DecodeThread* DecodingWavFileReader::m_decodeThread
protected

◆ m_cacheMutex

◆ m_cacheMode

◆ m_data

◆ m_dataLock

QReadWriteLock CodedAudioFileReader::m_dataLock
mutableprotectedinherited

◆ m_initialised

◆ m_serialiser

Serialiser* CodedAudioFileReader::m_serialiser
protectedinherited

◆ m_fileRate

◆ m_cacheFileName

QString CodedAudioFileReader::m_cacheFileName
protectedinherited

◆ m_cacheFileWritePtr

◆ m_cacheFileReader

◆ m_cacheWriteBuffer

◆ m_cacheWriteBufferIndex

int CodedAudioFileReader::m_cacheWriteBufferIndex
protectedinherited

◆ m_cacheWriteBufferSize

int CodedAudioFileReader::m_cacheWriteBufferSize
protectedinherited

◆ m_resampler

◆ m_resampleBuffer

◆ m_fileFrameCount

int CodedAudioFileReader::m_fileFrameCount
protectedinherited

◆ m_normalised

bool CodedAudioFileReader::m_normalised
protectedinherited

◆ m_max

float CodedAudioFileReader::m_max
protectedinherited

◆ m_gain

float CodedAudioFileReader::m_gain
protectedinherited

◆ m_frameCount

◆ m_channelCount

◆ m_sampleRate


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