Mercurial > hg > svcore
comparison data/fileio/DecodingWavFileReader.cpp @ 936:0c1d6de8f44b
Merge from branch warnfix_no_size_t
author | Chris Cannam |
---|---|
date | Wed, 18 Jun 2014 13:51:16 +0100 |
parents | d03b3d956358 |
children | cc27f35aa75c |
comparison
equal
deleted
inserted
replaced
917:49618f39ff09 | 936:0c1d6de8f44b |
---|---|
20 #include "base/ProgressReporter.h" | 20 #include "base/ProgressReporter.h" |
21 | 21 |
22 #include <QFileInfo> | 22 #include <QFileInfo> |
23 | 23 |
24 DecodingWavFileReader::DecodingWavFileReader(FileSource source, | 24 DecodingWavFileReader::DecodingWavFileReader(FileSource source, |
25 ResampleMode resampleMode, | 25 ResampleMode resampleMode, |
26 CacheMode mode, | 26 CacheMode mode, |
27 size_t targetRate, | 27 int targetRate, |
28 ProgressReporter *reporter) : | 28 bool normalised, |
29 CodedAudioFileReader(mode, targetRate), | 29 ProgressReporter *reporter) : |
30 CodedAudioFileReader(mode, targetRate, normalised), | |
30 m_source(source), | 31 m_source(source), |
31 m_path(source.getLocalFilename()), | 32 m_path(source.getLocalFilename()), |
32 m_cancelled(false), | 33 m_cancelled(false), |
33 m_processed(0), | 34 m_processed(0), |
34 m_completion(0), | 35 m_completion(0), |
61 connect(m_reporter, SIGNAL(cancelled()), this, SLOT(cancelled())); | 62 connect(m_reporter, SIGNAL(cancelled()), this, SLOT(cancelled())); |
62 m_reporter->setMessage | 63 m_reporter->setMessage |
63 (tr("Decoding %1...").arg(QFileInfo(m_path).fileName())); | 64 (tr("Decoding %1...").arg(QFileInfo(m_path).fileName())); |
64 } | 65 } |
65 | 66 |
66 size_t blockSize = 16384; | 67 int blockSize = 16384; |
67 size_t total = m_original->getFrameCount(); | 68 int total = m_original->getFrameCount(); |
68 | 69 |
69 SampleBlock block; | 70 SampleBlock block; |
70 | 71 |
71 for (size_t i = 0; i < total; i += blockSize) { | 72 for (int i = 0; i < total; i += blockSize) { |
72 | 73 |
73 size_t count = blockSize; | 74 int count = blockSize; |
74 if (i + count > total) count = total - i; | 75 if (i + count > total) count = total - i; |
75 | 76 |
76 m_original->getInterleavedFrames(i, count, block); | 77 m_original->getInterleavedFrames(i, count, block); |
77 addBlock(block); | 78 addBlock(block); |
78 | 79 |
118 { | 119 { |
119 if (m_reader->m_cacheMode == CacheInTemporaryFile) { | 120 if (m_reader->m_cacheMode == CacheInTemporaryFile) { |
120 m_reader->startSerialised("DecodingWavFileReader::Decode"); | 121 m_reader->startSerialised("DecodingWavFileReader::Decode"); |
121 } | 122 } |
122 | 123 |
123 size_t blockSize = 16384; | 124 int blockSize = 16384; |
124 size_t total = m_reader->m_original->getFrameCount(); | 125 int total = m_reader->m_original->getFrameCount(); |
125 | 126 |
126 SampleBlock block; | 127 SampleBlock block; |
127 | 128 |
128 for (size_t i = 0; i < total; i += blockSize) { | 129 for (int i = 0; i < total; i += blockSize) { |
129 | 130 |
130 size_t count = blockSize; | 131 int count = blockSize; |
131 if (i + count > total) count = total - i; | 132 if (i + count > total) count = total - i; |
132 | 133 |
133 m_reader->m_original->getInterleavedFrames(i, count, block); | 134 m_reader->m_original->getInterleavedFrames(i, count, block); |
134 m_reader->addBlock(block); | 135 m_reader->addBlock(block); |
135 | 136 |