comparison data/fileio/DecodingWavFileReader.cpp @ 1038:cc27f35aa75c cxx11

Introducing the signed 64-bit frame index type, and fixing build failures from inclusion of -Wconversion with -Werror. Not finished yet.
author Chris Cannam
date Tue, 03 Mar 2015 15:18:24 +0000
parents d03b3d956358
children a1cd5abcb38b
comparison
equal deleted inserted replaced
1037:bf0e5944289b 1038:cc27f35aa75c
62 connect(m_reporter, SIGNAL(cancelled()), this, SLOT(cancelled())); 62 connect(m_reporter, SIGNAL(cancelled()), this, SLOT(cancelled()));
63 m_reporter->setMessage 63 m_reporter->setMessage
64 (tr("Decoding %1...").arg(QFileInfo(m_path).fileName())); 64 (tr("Decoding %1...").arg(QFileInfo(m_path).fileName()));
65 } 65 }
66 66
67 int blockSize = 16384; 67 sv_frame_t blockSize = 16384;
68 int total = m_original->getFrameCount(); 68 sv_frame_t total = m_original->getFrameCount();
69 69
70 SampleBlock block; 70 SampleBlock block;
71 71
72 for (int i = 0; i < total; i += blockSize) { 72 for (sv_frame_t i = 0; i < total; i += blockSize) {
73 73
74 int count = blockSize; 74 sv_frame_t count = blockSize;
75 if (i + count > total) count = total - i; 75 if (i + count > total) count = total - i;
76 76
77 m_original->getInterleavedFrames(i, count, block); 77 m_original->getInterleavedFrames(i, count, block);
78 addBlock(block); 78 addBlock(block);
79 79
119 { 119 {
120 if (m_reader->m_cacheMode == CacheInTemporaryFile) { 120 if (m_reader->m_cacheMode == CacheInTemporaryFile) {
121 m_reader->startSerialised("DecodingWavFileReader::Decode"); 121 m_reader->startSerialised("DecodingWavFileReader::Decode");
122 } 122 }
123 123
124 int blockSize = 16384; 124 sv_frame_t blockSize = 16384;
125 int total = m_reader->m_original->getFrameCount(); 125 sv_frame_t total = m_reader->m_original->getFrameCount();
126 126
127 SampleBlock block; 127 SampleBlock block;
128 128
129 for (int i = 0; i < total; i += blockSize) { 129 for (sv_frame_t i = 0; i < total; i += blockSize) {
130 130
131 int count = blockSize; 131 sv_frame_t count = blockSize;
132 if (i + count > total) count = total - i; 132 if (i + count > total) count = total - i;
133 133
134 m_reader->m_original->getInterleavedFrames(i, count, block); 134 m_reader->m_original->getInterleavedFrames(i, count, block);
135 m_reader->addBlock(block); 135 m_reader->addBlock(block);
136 136
151 { 151 {
152 addSamplesToDecodeCache(frames); 152 addSamplesToDecodeCache(frames);
153 153
154 m_processed += frames.size(); 154 m_processed += frames.size();
155 155
156 float ratio = float(m_sampleRate) / float(m_fileRate); 156 double ratio = double(m_sampleRate) / double(m_fileRate);
157 157
158 int progress = lrint((float(m_processed) * ratio * 100) / 158 int progress = int(lrint((double(m_processed) * ratio * 100) /
159 float(m_original->getFrameCount())); 159 double(m_original->getFrameCount())));
160 160
161 if (progress > 99) progress = 99; 161 if (progress > 99) progress = 99;
162 m_completion = progress; 162 m_completion = progress;
163 163
164 if (m_reporter) { 164 if (m_reporter) {