comparison framework/SVFileReader.cpp @ 116:9554c19c42fd

* Fix #1903059 "resample on import" not applied when reloading session
author Chris Cannam
date Tue, 20 May 2008 10:14:15 +0000
parents c82913d31a53
children e2aec1708a2c
comparison
equal deleted inserted replaced
115:5dcbda490794 116:9554c19c42fd
17 17
18 #include "layer/Layer.h" 18 #include "layer/Layer.h"
19 #include "view/View.h" 19 #include "view/View.h"
20 #include "base/PlayParameters.h" 20 #include "base/PlayParameters.h"
21 #include "base/PlayParameterRepository.h" 21 #include "base/PlayParameterRepository.h"
22 #include "base/Preferences.h"
22 23
23 #include "data/fileio/AudioFileReaderFactory.h" 24 #include "data/fileio/AudioFileReaderFactory.h"
24 #include "data/fileio/FileSource.h" 25 #include "data/fileio/FileSource.h"
25 26
26 #include "widgets/FileFinder.h" 27 #include "widgets/FileFinder.h"
454 } else if (!file.isAvailable()) { 455 } else if (!file.isAvailable()) {
455 std::cerr << "SVFileReader::readModel: Failed to retrieve file \"" << path.toStdString() << "\" for wave file model: Source unavailable" << std::endl; 456 std::cerr << "SVFileReader::readModel: Failed to retrieve file \"" << path.toStdString() << "\" for wave file model: Source unavailable" << std::endl;
456 } else { 457 } else {
457 458
458 file.waitForData(); 459 file.waitForData();
459 model = new WaveFileModel(file); 460
461 size_t rate = 0;
462
463 if (!mainModel &&
464 Preferences::getInstance()->getResampleOnLoad()) {
465 WaveFileModel *mm = m_document->getMainModel();
466 if (mm) rate = mm->getSampleRate();
467 }
468
469 model = new WaveFileModel(file, rate);
460 if (!model->isOK()) { 470 if (!model->isOK()) {
461 delete model; 471 delete model;
462 model = 0; 472 model = 0;
463 } 473 }
464 } 474 }