svcore
1.9
|
Reader for audio files using libsndfile. More...
#include <WavFileReader.h>
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 |
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.
typedef std::map<QString, QString> AudioFileReader::TagMap [inherited] |
Definition at line 65 of file AudioFileReader.h.
WavFileReader::WavFileReader | ( | FileSource | source, |
bool | fileUpdating = false |
||
) |
Definition at line 23 of file WavFileReader.cpp.
References AudioFileReader::m_channelCount, m_error, m_file, m_fileInfo, AudioFileReader::m_frameCount, m_path, AudioFileReader::m_sampleRate, and m_seekable.
WavFileReader::~WavFileReader | ( | ) | [virtual] |
Definition at line 81 of file WavFileReader.cpp.
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] |
Definition at line 187 of file WavFileReader.cpp.
Referenced by AudioFileReaderFactory::getKnownExtensions(), and supportsExtension().
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().
bool WavFileReader::supports | ( | FileSource & | source | ) | [static] |
Definition at line 232 of file WavFileReader.cpp.
References FileSource::getContentType(), FileSource::getExtension(), supportsContentType(), and supportsExtension().
Referenced by AudioFileReaderFactory::create().
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.
void WavFileReader::updateFrameCount | ( | ) |
Definition at line 88 of file WavFileReader.cpp.
References AudioFileReader::frameCountChanged(), AudioFileReader::m_channelCount, m_file, m_fileInfo, AudioFileReader::m_frameCount, m_mutex, m_path, and AudioFileReader::m_sampleRate.
Referenced by WritableWaveFileModel::addSamples(), CodedAudioFileReader::addSamplesToDecodeCache(), CodedAudioFileReader::finishDecodeCache(), and updateDone().
void WavFileReader::updateDone | ( | ) |
Definition at line 119 of file WavFileReader.cpp.
References m_updating, and updateFrameCount().
Referenced by WritableWaveFileModel::setCompletion().
bool AudioFileReader::isOK | ( | ) | const [inline, inherited] |
Definition at line 35 of file AudioFileReader.h.
References AudioFileReader::m_channelCount.
Referenced by AudioFileReaderFactory::create(), DecodingWavFileReader::DecodingWavFileReader(), WaveFileModel::getData(), CodedAudioFileReader::getInterleavedFrames(), CodedAudioFileReader::initialiseDecodeCache(), and WaveFileModel::isOK().
int AudioFileReader::getFrameCount | ( | ) | const [inline, inherited] |
Definition at line 39 of file AudioFileReader.h.
References AudioFileReader::m_frameCount.
Referenced by DecodingWavFileReader::addBlock(), DecodingWavFileReader::DecodingWavFileReader(), WaveFileModel::getFrameCount(), and DecodingWavFileReader::DecodeThread::run().
int AudioFileReader::getChannelCount | ( | ) | const [inline, inherited] |
Definition at line 40 of file AudioFileReader.h.
References AudioFileReader::m_channelCount.
Referenced by WritableWaveFileModel::addSamples(), DecodingWavFileReader::DecodingWavFileReader(), WaveFileModel::getChannelCount(), and AudioFileReader::getDeInterleavedFrames().
int AudioFileReader::getSampleRate | ( | ) | const [inline, inherited] |
Definition at line 41 of file AudioFileReader.h.
References AudioFileReader::m_sampleRate.
Referenced by AudioFileReaderFactory::create(), DecodingWavFileReader::DecodingWavFileReader(), WaveFileModel::getSampleRate(), and WaveFileModel::WaveFileModel().
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().
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 68 of file WavFileReader.h.
Referenced by getInterleavedFrames(), updateFrameCount(), WavFileReader(), and ~WavFileReader().
FileSource WavFileReader::m_source [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().
int AudioFileReader::m_frameCount [protected, inherited] |
Definition at line 107 of file AudioFileReader.h.
Referenced by MP3FileReader::accept(), CodedAudioFileReader::CodedAudioFileReader(), AudioFileReader::getFrameCount(), CodedAudioFileReader::pushBufferNonResampling(), CodedAudioFileReader::pushBufferResampling(), updateFrameCount(), and WavFileReader().
int AudioFileReader::m_channelCount [protected, inherited] |
Definition at line 108 of file AudioFileReader.h.
Referenced by MP3FileReader::accept(), OggVorbisFileReader::acceptFrames(), CodedAudioFileReader::addSamplesToDecodeCache(), DecodingWavFileReader::DecodingWavFileReader(), CodedAudioFileReader::finishDecodeCache(), AudioFileReader::getChannelCount(), CodedAudioFileReader::getInterleavedFrames(), getInterleavedFrames(), CodedAudioFileReader::initialiseDecodeCache(), AudioFileReader::isOK(), MP3FileReader::MP3FileReader(), OggVorbisFileReader::OggVorbisFileReader(), CodedAudioFileReader::pushBufferNonResampling(), CodedAudioFileReader::pushBufferResampling(), MP3FileReader::DecodeThread::run(), updateFrameCount(), and WavFileReader().
int AudioFileReader::m_sampleRate [protected, inherited] |
Definition at line 109 of file AudioFileReader.h.
Referenced by MP3FileReader::accept(), DecodingWavFileReader::addBlock(), CodedAudioFileReader::CodedAudioFileReader(), AudioFileReader::getNativeRate(), AudioFileReader::getSampleRate(), CodedAudioFileReader::initialiseDecodeCache(), MP3FileReader::MP3FileReader(), OggVorbisFileReader::OggVorbisFileReader(), CodedAudioFileReader::pushBuffer(), updateFrameCount(), and WavFileReader().