comparison framework/SVFileReader.cpp @ 368:f1cab64363d7 warnfix_no_size_t

Merge from branch tony_integration
author Chris Cannam
date Wed, 18 Jun 2014 08:45:13 +0100
parents 0876ea394902 5302c548adad
children 6a84102c006a
comparison
equal deleted inserted replaced
367:1e4fa2007e61 368:f1cab64363d7
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();
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 int rate = 0; 476 int rate = sampleRate;
477 477
478 if (!mainModel && 478 if (Preferences::getInstance()->getFixedSampleRate() != 0) {
479 Preferences::getInstance()->getResampleOnLoad()) { 479 rate = Preferences::getInstance()->getFixedSampleRate();
480 } else if (rate == 0 &&
481 !isMainModel &&
482 Preferences::getInstance()->getResampleOnLoad()) {
480 WaveFileModel *mm = m_document->getMainModel(); 483 WaveFileModel *mm = m_document->getMainModel();
481 if (mm) rate = mm->getSampleRate(); 484 if (mm) rate = mm->getSampleRate();
482 } 485 }
483 486
484 model = new WaveFileModel(file, rate); 487 model = new WaveFileModel(file, rate);
490 493
491 if (!model) return false; 494 if (!model) return false;
492 495
493 model->setObjectName(name); 496 model->setObjectName(name);
494 m_models[id] = model; 497 m_models[id] = model;
495 if (mainModel) { 498 if (isMainModel) {
496 m_document->setMainModel(model); 499 m_document->setMainModel(model);
497 m_addedModels.insert(model); 500 m_addedModels.insert(model);
498 } 501 }
499 // Derived models will be added when their derivation 502 // Derived models will be added when their derivation
500 // is found. 503 // is found.
1148 1151
1149 DenseThreeDimensionalModel::Column values; 1152 DenseThreeDimensionalModel::Column values;
1150 1153
1151 for (QStringList::iterator i = data.begin(); i != data.end(); ++i) { 1154 for (QStringList::iterator i = data.begin(); i != data.end(); ++i) {
1152 1155
1153 if (values.size() == dtdm->getHeight()) { 1156 if (values.size() == (int)dtdm->getHeight()) {
1154 if (!warned) { 1157 if (!warned) {
1155 cerr << "WARNING: SV-XML: Too many y-bins in 3-D dataset row " 1158 cerr << "WARNING: SV-XML: Too many y-bins in 3-D dataset row "
1156 << m_rowNumber << endl; 1159 << m_rowNumber << endl;
1157 warned = true; 1160 warned = true;
1158 } 1161 }