comparison transform/FeatureExtractionModelTransformer.cpp @ 678:948271d124ac

Make more (though still not entirely) robust in the face of running out of disc space
author Chris Cannam
date Thu, 14 Apr 2011 15:20:27 +0100
parents 3bbac921b70a
children c8badbd4c005
comparison
equal deleted inserted replaced
677:ce73529405e4 678:948271d124ac
485 if (frequencyDomain) { 485 if (frequencyDomain) {
486 reals = new float[blockSize/2 + 1]; 486 reals = new float[blockSize/2 + 1];
487 imaginaries = new float[blockSize/2 + 1]; 487 imaginaries = new float[blockSize/2 + 1];
488 } 488 }
489 489
490 QString error = "";
491
490 while (!m_abandoned) { 492 while (!m_abandoned) {
491 493
492 if (frequencyDomain) { 494 if (frequencyDomain) {
493 if (blockFrame - int(blockSize)/2 > 495 if (blockFrame - int(blockSize)/2 >
494 contextStart + contextDuration) break; 496 contextStart + contextDuration) break;
512 int column = (blockFrame - startFrame) / stepSize; 514 int column = (blockFrame - startFrame) / stepSize;
513 fftModels[ch]->getValuesAt(column, reals, imaginaries); 515 fftModels[ch]->getValuesAt(column, reals, imaginaries);
514 for (size_t i = 0; i <= blockSize/2; ++i) { 516 for (size_t i = 0; i <= blockSize/2; ++i) {
515 buffers[ch][i*2] = reals[i]; 517 buffers[ch][i*2] = reals[i];
516 buffers[ch][i*2+1] = imaginaries[i]; 518 buffers[ch][i*2+1] = imaginaries[i];
519 }
520 error = fftModels[ch]->getError();
521 if (error != "") {
522 std::cerr << "FeatureExtractionModelTransformer::run: Abandoning, error is " << error << std::endl;
523 m_abandoned = true;
524 m_message = error;
517 } 525 }
518 } 526 }
519 } else { 527 } else {
520 getFrames(channelCount, blockFrame, blockSize, buffers); 528 getFrames(channelCount, blockFrame, blockSize, buffers);
521 } 529 }