comparison data/fileio/CodedAudioFileReader.cpp @ 544:65d955c4d671

* throw (but do not yet catch!) exception when running out of disc space in coded audio file * simpler (faster?) cache-to-cache move operation in spectrogram, and some other minor fixes
author Chris Cannam
date Wed, 04 Feb 2009 12:13:16 +0000
parents 7a66b94ef1c0
children 939ffbc32d50
comparison
equal deleted inserted replaced
543:7a66b94ef1c0 544:65d955c4d671
267 std::cerr << "WARNING: CodedAudioFileReader::finishDecodeCache: Cache was never initialised!" << std::endl; 267 std::cerr << "WARNING: CodedAudioFileReader::finishDecodeCache: Cache was never initialised!" << std::endl;
268 return; 268 return;
269 } 269 }
270 270
271 if (m_cacheWriteBufferIndex > 0) { 271 if (m_cacheWriteBufferIndex > 0) {
272 //!!! check for return value! out of disk space, etc!
273 pushBuffer(m_cacheWriteBuffer, 272 pushBuffer(m_cacheWriteBuffer,
274 m_cacheWriteBufferIndex / m_channelCount, 273 m_cacheWriteBufferIndex / m_channelCount,
275 true); 274 true);
276 } 275 }
277 276
326 m_frameCount += sz; 325 m_frameCount += sz;
327 326
328 switch (m_cacheMode) { 327 switch (m_cacheMode) {
329 328
330 case CacheInTemporaryFile: 329 case CacheInTemporaryFile:
331 //!!! check for return value! out of disk space, etc! 330 if (sf_writef_float(m_cacheFileWritePtr, buffer, sz) < sz) {
332 sf_writef_float(m_cacheFileWritePtr, buffer, sz); 331 sf_close(m_cacheFileWritePtr);
332 m_cacheFileWritePtr = 0;
333 throw InsufficientDiscSpace(TempDirectory::getInstance()->getPath());
334 }
333 break; 335 break;
334 336
335 case CacheInMemory: 337 case CacheInMemory:
336 m_dataLock.lockForWrite(); 338 m_dataLock.lockForWrite();
337 for (size_t s = 0; s < count; ++s) { 339 for (size_t s = 0; s < count; ++s) {