diff data/model/WaveFileModel.cpp @ 179:0ed2b2e26b44

* Tidy up inheritance hierarchy of model classes -- remove ZoomConstraint as a base class (make it a member instead) and remove virtual inheritances of QObject (no longer necessary).
author Chris Cannam
date Thu, 05 Oct 2006 11:03:06 +0000
parents aff66ec5aea4
children bd1260261412
line wrap: on
line diff
--- a/data/model/WaveFileModel.cpp	Thu Oct 05 11:02:05 2006 +0000
+++ b/data/model/WaveFileModel.cpp	Thu Oct 05 11:03:06 2006 +0000
@@ -33,6 +33,9 @@
 using std::cerr;
 using std::endl;
 
+PowerOfSqrtTwoZoomConstraint
+WaveFileModel::m_zoomConstraint;
+
 WaveFileModel::WaveFileModel(QString path) :
     m_path(path),
     m_myReader(true),
@@ -221,9 +224,9 @@
     }
 
     int cacheType = 0;
-    int power = getMinCachePower();
-    blockSize = getNearestBlockSize(blockSize, cacheType, power,
-				    ZoomConstraint::RoundUp);
+    int power = m_zoomConstraint.getMinCachePower();
+    blockSize = m_zoomConstraint.getNearestBlockSize
+        (blockSize, cacheType, power, ZoomConstraint::RoundUp);
 
     size_t channels = getChannelCount();
 
@@ -277,10 +280,10 @@
 	size_t cacheBlock, div;
         
 	if (cacheType == 0) {
-	    cacheBlock = (1 << getMinCachePower());
+	    cacheBlock = (1 << m_zoomConstraint.getMinCachePower());
             div = (1 << power) / cacheBlock;
 	} else {
-	    cacheBlock = ((unsigned int)((1 << getMinCachePower()) * sqrt(2) + 0.01));
+	    cacheBlock = ((unsigned int)((1 << m_zoomConstraint.getMinCachePower()) * sqrt(2) + 0.01));
             div = ((unsigned int)((1 << power) * sqrt(2) + 0.01)) / cacheBlock;
 	}
 
@@ -442,8 +445,8 @@
 WaveFileModel::RangeCacheFillThread::run()
 {
     size_t cacheBlockSize[2];
-    cacheBlockSize[0] = (1 << m_model.getMinCachePower());
-    cacheBlockSize[1] = ((unsigned int)((1 << m_model.getMinCachePower()) *
+    cacheBlockSize[0] = (1 << m_model.m_zoomConstraint.getMinCachePower());
+    cacheBlockSize[1] = ((unsigned int)((1 << m_model.m_zoomConstraint.getMinCachePower()) *
                                         sqrt(2) + 0.01));
     
     size_t frame = 0;