Mercurial > hg > svcore
diff data/fileio/QuickTimeFileReader.cpp @ 297:c022976d18e8
* Merge from sv-match-alignment branch (excluding alignment-specific document).
- add aggregate wave model (not yet complete enough to be added as a true
model in a layer, but there's potential)
- add play solo mode
- add alignment model -- unused in plain SV
- fix two plugin leaks
- add m3u playlist support (opens all files at once, potentially hazardous)
- fix retrieval of pre-encoded URLs
- add ability to resample audio files on import, so as to match rates with
other files previously loaded; add preference for same
- add preliminary support in transform code for range and rate of transform
input
- reorganise preferences dialog, move dark-background option to preferences,
add option for temporary directory location
author | Chris Cannam |
---|---|
date | Fri, 28 Sep 2007 13:56:38 +0000 |
parents | 42e6c8360df1 |
children | bbf87199e6e1 |
line wrap: on
line diff
--- a/data/fileio/QuickTimeFileReader.cpp Fri Sep 21 09:13:11 2007 +0000 +++ b/data/fileio/QuickTimeFileReader.cpp Fri Sep 28 13:56:38 2007 +0000 @@ -50,8 +50,9 @@ QuickTimeFileReader::QuickTimeFileReader(QString path, DecodeMode decodeMode, - CacheMode mode) : - CodedAudioFileReader(mode), + CacheMode mode, + size_t targetRate) : + CodedAudioFileReader(mode, targetRate), m_path(path), m_d(new D), m_progress(0), @@ -59,9 +60,8 @@ m_completion(0), m_decodeThread(0) { - m_frameCount = 0; m_channelCount = 0; - m_sampleRate = 0; + m_fileRate = 0; Profiler profiler("QuickTimeFileReader::QuickTimeFileReader", true); @@ -181,9 +181,9 @@ } m_channelCount = m_d->asbd.mChannelsPerFrame; - m_sampleRate = m_d->asbd.mSampleRate; + m_fileRate = m_d->asbd.mSampleRate; - std::cerr << "QuickTime: " << m_channelCount << " channels, " << m_sampleRate << " kHz" << std::endl; + std::cerr << "QuickTime: " << m_channelCount << " channels, " << m_fileRate << " kHz" << std::endl; m_d->asbd.mFormatFlags = kAudioFormatFlagIsFloat | @@ -236,12 +236,8 @@ // std::cerr << "Read " << framesRead << " frames (block size " << m_d->blockSize << ")" << std::endl; - m_frameCount += framesRead; - // QuickTime buffers are interleaved unless specified otherwise - for (UInt32 i = 0; i < framesRead * m_channelCount; ++i) { - addSampleToDecodeCache(m_d->data[i]); - } + addSamplesToDecodeCache(m_d->data, framesRead); if (framesRead < m_d->blockSize) break; } @@ -288,6 +284,11 @@ void QuickTimeFileReader::DecodeThread::run() { + if (m_reader->m_cacheMode == CacheInTemporaryFile) { + m_reader->m_completion = 1; + m_reader->startSerialised("QuickTimeFileReader::Decode"); + } + while (1) { UInt32 framesRead = m_reader->m_d->blockSize; @@ -301,12 +302,8 @@ break; } - m_reader->m_frameCount += framesRead; - // QuickTime buffers are interleaved unless specified otherwise - for (UInt32 i = 0; i < framesRead * m_reader->m_channelCount; ++i) { - m_reader->addSampleToDecodeCache(m_reader->m_d->data[i]); - } + addSamplesToDecodeCache(m_d->data, framesRead); if (framesRead < m_reader->m_d->blockSize) break; } @@ -319,6 +316,7 @@ } m_reader->m_completion = 100; + m_reader->endSerialised(); } void @@ -339,3 +337,4 @@ } #endif +