changeset 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 42a78f0e8fe2
children a8b4a6efefff
files document/SVFileReader.cpp transform/FeatureExtractionPluginTransform.cpp
diffstat 2 files changed, 23 insertions(+), 18 deletions(-) [+]
line wrap: on
line diff
--- a/document/SVFileReader.cpp	Mon Jul 31 16:15:45 2006 +0000
+++ b/document/SVFileReader.cpp	Mon Jul 31 17:05:18 2006 +0000
@@ -23,7 +23,7 @@
 #include "data/fileio/AudioFileReaderFactory.h"
 
 #include "data/model/WaveFileModel.h"
-#include "data/model/DenseThreeDimensionalModel.h"
+#include "data/model/EditableDenseThreeDimensionalModel.h"
 #include "data/model/SparseOneDimensionalModel.h"
 #include "data/model/SparseTimeValueModel.h"
 #include "data/model/NoteModel.h"
@@ -423,8 +423,9 @@
 	    READ_MANDATORY(int, windowSize, toInt);
 	    READ_MANDATORY(int, yBinCount, toInt);
 	    
-	    DenseThreeDimensionalModel *model =
-		new DenseThreeDimensionalModel(sampleRate, windowSize, yBinCount);
+            EditableDenseThreeDimensionalModel *model =
+		new EditableDenseThreeDimensionalModel
+                (sampleRate, windowSize, yBinCount);
 	    
 	    float minimum = attributes.value("minimum").trimmed().toFloat(&ok);
 	    if (ok) model->setMinimumLevel(minimum);
@@ -710,7 +711,7 @@
 
     case 3:
 	if (dynamic_cast<NoteModel *>(model)) good = true;
-	else if (dynamic_cast<DenseThreeDimensionalModel *>(model)) {
+	else if (dynamic_cast<EditableDenseThreeDimensionalModel *>(model)) {
 	    m_datasetSeparator = attributes.value("separator");
 	    good = true;
 	}
@@ -784,7 +785,8 @@
 bool
 SVFileReader::addBinToDataset(const QXmlAttributes &attributes)
 {
-    DenseThreeDimensionalModel *dtdm = dynamic_cast<DenseThreeDimensionalModel *>
+    EditableDenseThreeDimensionalModel *dtdm = 
+        dynamic_cast<EditableDenseThreeDimensionalModel *>
 	(m_currentDataset);
 
     if (dtdm) {
@@ -832,7 +834,8 @@
 bool
 SVFileReader::readRowData(const QString &text)
 {
-    DenseThreeDimensionalModel *dtdm = dynamic_cast<DenseThreeDimensionalModel *>
+    EditableDenseThreeDimensionalModel *dtdm =
+        dynamic_cast<EditableDenseThreeDimensionalModel *>
 	(m_currentDataset);
 
     bool warned = false;
@@ -863,7 +866,7 @@
 	    }
 	}
 
-	size_t windowStartFrame = m_rowNumber * dtdm->getWindowSize();
+	size_t windowStartFrame = m_rowNumber * dtdm->getResolution();
 
 	dtdm->setBinValues(windowStartFrame, values);
 	return true;
--- a/transform/FeatureExtractionPluginTransform.cpp	Mon Jul 31 16:15:45 2006 +0000
+++ b/transform/FeatureExtractionPluginTransform.cpp	Mon Jul 31 17:05:18 2006 +0000
@@ -23,10 +23,10 @@
 #include "base/Window.h"
 #include "data/model/SparseOneDimensionalModel.h"
 #include "data/model/SparseTimeValueModel.h"
-#include "data/model/DenseThreeDimensionalModel.h"
+#include "data/model/EditableDenseThreeDimensionalModel.h"
 #include "data/model/DenseTimeValueModel.h"
 #include "data/model/NoteModel.h"
-#include "data/fft/FFTFuzzyAdapter.h"
+#include "data/model/FFTModel.h"
 
 #include <fftw3.h>
 
@@ -190,15 +190,15 @@
 
     } else {
 	
-	m_output = new DenseThreeDimensionalModel(modelRate, modelResolution,
-						  binCount, false);
+	m_output = new EditableDenseThreeDimensionalModel
+            (modelRate, modelResolution, binCount, false);
 
 	if (!m_descriptor->binNames.empty()) {
 	    std::vector<QString> names;
 	    for (size_t i = 0; i < m_descriptor->binNames.size(); ++i) {
 		names.push_back(m_descriptor->binNames[i].c_str());
 	    }
-	    (dynamic_cast<DenseThreeDimensionalModel *>(m_output))
+	    (dynamic_cast<EditableDenseThreeDimensionalModel *>(m_output))
 		->setBinNames(names);
 	}
     }
@@ -243,11 +243,11 @@
 
     bool frequencyDomain = (m_plugin->getInputDomain() ==
                             Vamp::Plugin::FrequencyDomain);
-    std::vector<FFTFuzzyAdapter *> fftAdapters;
+    std::vector<FFTModel *> fftModels;
 
     if (frequencyDomain) {
         for (size_t ch = 0; ch < channelCount; ++ch) {
-            fftAdapters.push_back(new FFTFuzzyAdapter
+            fftModels.push_back(new FFTModel
                                   (getInput(),
                                    channelCount == 1 ? m_channel : ch,
                                    HanningWindow,
@@ -285,7 +285,7 @@
             if (frequencyDomain) {
                 int column = (blockFrame - startFrame) / m_stepSize;
                 for (size_t i = 0; i < m_blockSize/2; ++i) {
-                    fftAdapters[ch]->getValuesAt
+                    fftModels[ch]->getValuesAt
                         (column, i, buffers[ch][i*2], buffers[ch][i*2+1]);
                 }
 /*!!!
@@ -330,7 +330,7 @@
 
     if (frequencyDomain) {
         for (size_t ch = 0; ch < channelCount; ++ch) {
-            delete fftAdapters[ch];
+            delete fftModels[ch];
         }
     }
 
@@ -450,7 +450,8 @@
 	
 	DenseThreeDimensionalModel::BinValueSet values = feature.values;
 	
-	DenseThreeDimensionalModel *model = getOutput<DenseThreeDimensionalModel>();
+	EditableDenseThreeDimensionalModel *model =
+            getOutput<EditableDenseThreeDimensionalModel>();
 	if (!model) return;
 
 	model->setBinValues(frame, values);
@@ -486,7 +487,8 @@
 
     } else {
 
-	DenseThreeDimensionalModel *model = getOutput<DenseThreeDimensionalModel>();
+	EditableDenseThreeDimensionalModel *model =
+            getOutput<EditableDenseThreeDimensionalModel>();
 	if (!model) return;
 	model->setCompletion(completion);
     }