comparison framework/SVFileReader.cpp @ 361:b38268e34c09 tonioni

The session file records the sample rate that each audio file was saved at. Use it. This is a fix to part of https://code.soundsoftware.ac.uk/issues/970, but it also replaces the commit at https://code.soundsoftware.ac.uk/projects/svapp/repository/revisions/9554c19c42fd with a fix to the earlier bug http://sourceforge.net/p/sv1/bugs/107/. I think this is a better way than the earlier code.
author Chris Cannam
date Fri, 13 Jun 2014 13:45:40 +0100
parents 2da91cceed64
children 5302c548adad
comparison
equal deleted inserted replaced
359:1f2a4ad79967 361:b38268e34c09
471 cerr << "SVFileReader::readModel: Failed to retrieve file \"" << path << "\" for wave file model: Source unavailable" << endl; 471 cerr << "SVFileReader::readModel: Failed to retrieve file \"" << path << "\" for wave file model: Source unavailable" << endl;
472 } else { 472 } else {
473 473
474 file.waitForData(); 474 file.waitForData();
475 475
476 size_t rate = 0; 476 size_t rate = sampleRate;
477 477
478 if (!mainModel && 478 if (rate == 0) {
479 Preferences::getInstance()->getResampleOnLoad()) { 479 if (!mainModel &&
480 WaveFileModel *mm = m_document->getMainModel(); 480 Preferences::getInstance()->getResampleOnLoad()) {
481 if (mm) rate = mm->getSampleRate(); 481 WaveFileModel *mm = m_document->getMainModel();
482 if (mm) rate = mm->getSampleRate();
483 }
482 } 484 }
483 485
484 model = new WaveFileModel(file, rate); 486 model = new WaveFileModel(file, rate);
485 if (!model->isOK()) { 487 if (!model->isOK()) {
486 delete model; 488 delete model;