comparison document/SVFileReader.cpp @ 3:e764bbf2b090 last-cc-copyright

* Move the current DenseThreeDimensionalModel to EditableDenseThreeDimensionalModel (wow!), and make DTDM an abstract base * Move FFTFuzzyAdapter to FFTModel as a new subclass of DTDM
author Chris Cannam
date Mon, 31 Jul 2006 17:05:18 +0000
parents 40116f709d3b
children 56e1d4242bb4
comparison
equal deleted inserted replaced
2:42a78f0e8fe2 3:e764bbf2b090
21 #include "base/PlayParameterRepository.h" 21 #include "base/PlayParameterRepository.h"
22 22
23 #include "data/fileio/AudioFileReaderFactory.h" 23 #include "data/fileio/AudioFileReaderFactory.h"
24 24
25 #include "data/model/WaveFileModel.h" 25 #include "data/model/WaveFileModel.h"
26 #include "data/model/DenseThreeDimensionalModel.h" 26 #include "data/model/EditableDenseThreeDimensionalModel.h"
27 #include "data/model/SparseOneDimensionalModel.h" 27 #include "data/model/SparseOneDimensionalModel.h"
28 #include "data/model/SparseTimeValueModel.h" 28 #include "data/model/SparseTimeValueModel.h"
29 #include "data/model/NoteModel.h" 29 #include "data/model/NoteModel.h"
30 #include "data/model/TextModel.h" 30 #include "data/model/TextModel.h"
31 31
421 if (dimensions == 3) { 421 if (dimensions == 3) {
422 422
423 READ_MANDATORY(int, windowSize, toInt); 423 READ_MANDATORY(int, windowSize, toInt);
424 READ_MANDATORY(int, yBinCount, toInt); 424 READ_MANDATORY(int, yBinCount, toInt);
425 425
426 DenseThreeDimensionalModel *model = 426 EditableDenseThreeDimensionalModel *model =
427 new DenseThreeDimensionalModel(sampleRate, windowSize, yBinCount); 427 new EditableDenseThreeDimensionalModel
428 (sampleRate, windowSize, yBinCount);
428 429
429 float minimum = attributes.value("minimum").trimmed().toFloat(&ok); 430 float minimum = attributes.value("minimum").trimmed().toFloat(&ok);
430 if (ok) model->setMinimumLevel(minimum); 431 if (ok) model->setMinimumLevel(minimum);
431 432
432 float maximum = attributes.value("maximum").trimmed().toFloat(&ok); 433 float maximum = attributes.value("maximum").trimmed().toFloat(&ok);
708 else if (dynamic_cast<TextModel *>(model)) good = true; 709 else if (dynamic_cast<TextModel *>(model)) good = true;
709 break; 710 break;
710 711
711 case 3: 712 case 3:
712 if (dynamic_cast<NoteModel *>(model)) good = true; 713 if (dynamic_cast<NoteModel *>(model)) good = true;
713 else if (dynamic_cast<DenseThreeDimensionalModel *>(model)) { 714 else if (dynamic_cast<EditableDenseThreeDimensionalModel *>(model)) {
714 m_datasetSeparator = attributes.value("separator"); 715 m_datasetSeparator = attributes.value("separator");
715 good = true; 716 good = true;
716 } 717 }
717 break; 718 break;
718 } 719 }
782 } 783 }
783 784
784 bool 785 bool
785 SVFileReader::addBinToDataset(const QXmlAttributes &attributes) 786 SVFileReader::addBinToDataset(const QXmlAttributes &attributes)
786 { 787 {
787 DenseThreeDimensionalModel *dtdm = dynamic_cast<DenseThreeDimensionalModel *> 788 EditableDenseThreeDimensionalModel *dtdm =
789 dynamic_cast<EditableDenseThreeDimensionalModel *>
788 (m_currentDataset); 790 (m_currentDataset);
789 791
790 if (dtdm) { 792 if (dtdm) {
791 793
792 bool ok = false; 794 bool ok = false;
830 } 832 }
831 833
832 bool 834 bool
833 SVFileReader::readRowData(const QString &text) 835 SVFileReader::readRowData(const QString &text)
834 { 836 {
835 DenseThreeDimensionalModel *dtdm = dynamic_cast<DenseThreeDimensionalModel *> 837 EditableDenseThreeDimensionalModel *dtdm =
838 dynamic_cast<EditableDenseThreeDimensionalModel *>
836 (m_currentDataset); 839 (m_currentDataset);
837 840
838 bool warned = false; 841 bool warned = false;
839 842
840 if (dtdm) { 843 if (dtdm) {
861 } else { 864 } else {
862 values.push_back(value); 865 values.push_back(value);
863 } 866 }
864 } 867 }
865 868
866 size_t windowStartFrame = m_rowNumber * dtdm->getWindowSize(); 869 size_t windowStartFrame = m_rowNumber * dtdm->getResolution();
867 870
868 dtdm->setBinValues(windowStartFrame, values); 871 dtdm->setBinValues(windowStartFrame, values);
869 return true; 872 return true;
870 } 873 }
871 874