Mercurial > hg > svapp
comparison framework/SVFileReader.cpp @ 362:5302c548adad tonioni
Merge
author | Chris Cannam |
---|---|
date | Fri, 13 Jun 2014 13:51:17 +0100 |
parents | b38268e34c09 88bf6cc73275 |
children | f1cab64363d7 |
comparison
equal
deleted
inserted
replaced
361:b38268e34c09 | 362:5302c548adad |
---|---|
446 SVDEBUG << "SVFileReader::readModel: model name \"" << name << "\"" << endl; | 446 SVDEBUG << "SVFileReader::readModel: model name \"" << name << "\"" << endl; |
447 | 447 |
448 READ_MANDATORY(int, sampleRate, toInt); | 448 READ_MANDATORY(int, sampleRate, toInt); |
449 | 449 |
450 QString type = attributes.value("type").trimmed(); | 450 QString type = attributes.value("type").trimmed(); |
451 bool mainModel = (attributes.value("mainModel").trimmed() == "true"); | 451 bool isMainModel = (attributes.value("mainModel").trimmed() == "true"); |
452 | 452 |
453 if (type == "wavefile") { | 453 if (type == "wavefile") { |
454 | 454 |
455 WaveFileModel *model = 0; | 455 WaveFileModel *model = 0; |
456 FileFinder *ff = FileFinder::getInstance(); | 456 FileFinder *ff = FileFinder::getInstance(); |
473 | 473 |
474 file.waitForData(); | 474 file.waitForData(); |
475 | 475 |
476 size_t rate = sampleRate; | 476 size_t rate = sampleRate; |
477 | 477 |
478 if (rate == 0) { | 478 if (Preferences::getInstance()->getFixedSampleRate() != 0) { |
479 if (!mainModel && | 479 rate = Preferences::getInstance()->getFixedSampleRate(); |
480 Preferences::getInstance()->getResampleOnLoad()) { | 480 } else if (rate == 0 && |
481 WaveFileModel *mm = m_document->getMainModel(); | 481 !isMainModel && |
482 if (mm) rate = mm->getSampleRate(); | 482 Preferences::getInstance()->getResampleOnLoad()) { |
483 } | 483 WaveFileModel *mm = m_document->getMainModel(); |
484 if (mm) rate = mm->getSampleRate(); | |
484 } | 485 } |
485 | 486 |
486 model = new WaveFileModel(file, rate); | 487 model = new WaveFileModel(file, rate); |
487 if (!model->isOK()) { | 488 if (!model->isOK()) { |
488 delete model; | 489 delete model; |
492 | 493 |
493 if (!model) return false; | 494 if (!model) return false; |
494 | 495 |
495 model->setObjectName(name); | 496 model->setObjectName(name); |
496 m_models[id] = model; | 497 m_models[id] = model; |
497 if (mainModel) { | 498 if (isMainModel) { |
498 m_document->setMainModel(model); | 499 m_document->setMainModel(model); |
499 m_addedModels.insert(model); | 500 m_addedModels.insert(model); |
500 } | 501 } |
501 // Derived models will be added when their derivation | 502 // Derived models will be added when their derivation |
502 // is found. | 503 // is found. |