diff data/model/ReadOnlyWaveFileModel.cpp @ 1406:09751743647e

Untabify!
author Chris Cannam
date Tue, 07 Mar 2017 13:52:37 +0000
parents d40246df828b
children 87ae75da6527
line wrap: on
line diff
--- a/data/model/ReadOnlyWaveFileModel.cpp	Tue Mar 07 13:27:53 2017 +0000
+++ b/data/model/ReadOnlyWaveFileModel.cpp	Tue Mar 07 13:52:37 2017 +0000
@@ -364,13 +364,13 @@
 
     if (cacheType != 0 && cacheType != 1) {
 
-	// We need to read directly from the file.  We haven't got
-	// this cached.  Hope the requested area is small.  This is
-	// not optimal -- we'll end up reading the same frames twice
-	// for stereo files, in two separate calls to this method.
-	// We could fairly trivially handle this for most cases that
-	// matter by putting a single cache in getInterleavedFrames
-	// for short queries.
+        // We need to read directly from the file.  We haven't got
+        // this cached.  Hope the requested area is small.  This is
+        // not optimal -- we'll end up reading the same frames twice
+        // for stereo files, in two separate calls to this method.
+        // We could fairly trivially handle this for most cases that
+        // matter by putting a single cache in getInterleavedFrames
+        // for short queries.
 
         m_directReadMutex.lock();
 
@@ -383,86 +383,86 @@
             m_lastDirectReadCount = count;
         }
 
-	float max = 0.0, min = 0.0, total = 0.0;
-	sv_frame_t i = 0, got = 0;
+        float max = 0.0, min = 0.0, total = 0.0;
+        sv_frame_t i = 0, got = 0;
 
-	while (i < count) {
+        while (i < count) {
 
-	    sv_frame_t index = i * channels + channel;
-	    if (index >= (sv_frame_t)m_directRead.size()) break;
+            sv_frame_t index = i * channels + channel;
+            if (index >= (sv_frame_t)m_directRead.size()) break;
             
-	    float sample = m_directRead[index];
+            float sample = m_directRead[index];
             if (sample > max || got == 0) max = sample;
-	    if (sample < min || got == 0) min = sample;
+            if (sample < min || got == 0) min = sample;
             total += fabsf(sample);
 
-	    ++i;
+            ++i;
             ++got;
             
             if (got == blockSize) {
                 ranges.push_back(Range(min, max, total / float(got)));
                 min = max = total = 0.0f;
                 got = 0;
-	    }
-	}
+            }
+        }
 
         m_directReadMutex.unlock();
 
-	if (got > 0) {
+        if (got > 0) {
             ranges.push_back(Range(min, max, total / float(got)));
-	}
+        }
 
-	return;
+        return;
 
     } else {
 
-	QMutexLocker locker(&m_mutex);
+        QMutexLocker locker(&m_mutex);
     
-	const RangeBlock &cache = m_cache[cacheType];
+        const RangeBlock &cache = m_cache[cacheType];
 
         blockSize = roundedBlockSize;
 
-	sv_frame_t cacheBlock, div;
+        sv_frame_t cacheBlock, div;
 
         cacheBlock = (sv_frame_t(1) << m_zoomConstraint.getMinCachePower());
-	if (cacheType == 1) {
-	    cacheBlock = sv_frame_t(double(cacheBlock) * sqrt(2.) + 0.01);
-	}
+        if (cacheType == 1) {
+            cacheBlock = sv_frame_t(double(cacheBlock) * sqrt(2.) + 0.01);
+        }
         div = blockSize / cacheBlock;
 
-	sv_frame_t startIndex = start / cacheBlock;
-	sv_frame_t endIndex = (start + count) / cacheBlock;
+        sv_frame_t startIndex = start / cacheBlock;
+        sv_frame_t endIndex = (start + count) / cacheBlock;
 
-	float max = 0.0, min = 0.0, total = 0.0;
-	sv_frame_t i = 0, got = 0;
+        float max = 0.0, min = 0.0, total = 0.0;
+        sv_frame_t i = 0, got = 0;
 
 #ifdef DEBUG_WAVE_FILE_MODEL
-	cerr << "blockSize is " << blockSize << ", cacheBlock " << cacheBlock << ", start " << start << ", count " << count << " (frame count " << getFrameCount() << "), power is " << power << ", div is " << div << ", startIndex " << startIndex << ", endIndex " << endIndex << endl;
+        cerr << "blockSize is " << blockSize << ", cacheBlock " << cacheBlock << ", start " << start << ", count " << count << " (frame count " << getFrameCount() << "), power is " << power << ", div is " << div << ", startIndex " << startIndex << ", endIndex " << endIndex << endl;
 #endif
 
-	for (i = 0; i <= endIndex - startIndex; ) {
+        for (i = 0; i <= endIndex - startIndex; ) {
         
-	    sv_frame_t index = (i + startIndex) * channels + channel;
-	    if (!in_range_for(cache, index)) break;
+            sv_frame_t index = (i + startIndex) * channels + channel;
+            if (!in_range_for(cache, index)) break;
             
             const Range &range = cache[index];
             if (range.max() > max || got == 0) max = range.max();
             if (range.min() < min || got == 0) min = range.min();
             total += range.absmean();
             
-	    ++i;
+            ++i;
             ++got;
             
-	    if (got == div) {
-		ranges.push_back(Range(min, max, total / float(got)));
+            if (got == div) {
+                ranges.push_back(Range(min, max, total / float(got)));
                 min = max = total = 0.0f;
                 got = 0;
-	    }
-	}
-		
-	if (got > 0) {
+            }
+        }
+                
+        if (got > 0) {
             ranges.push_back(Range(min, max, total / float(got)));
-	}
+        }
     }
 
 #ifdef DEBUG_WAVE_FILE_MODEL
@@ -547,19 +547,19 @@
 ReadOnlyWaveFileModel::fillTimerTimedOut()
 {
     if (m_fillThread) {
-	sv_frame_t fillExtent = m_fillThread->getFillExtent();
+        sv_frame_t fillExtent = m_fillThread->getFillExtent();
 #ifdef DEBUG_WAVE_FILE_MODEL
         SVDEBUG << "ReadOnlyWaveFileModel::fillTimerTimedOut: extent = " << fillExtent << endl;
 #endif
-	if (fillExtent > m_lastFillExtent) {
-	    emit modelChangedWithin(m_lastFillExtent, fillExtent);
-	    m_lastFillExtent = fillExtent;
-	}
+        if (fillExtent > m_lastFillExtent) {
+            emit modelChangedWithin(m_lastFillExtent, fillExtent);
+            m_lastFillExtent = fillExtent;
+        }
     } else {
 #ifdef DEBUG_WAVE_FILE_MODEL
         SVDEBUG << "ReadOnlyWaveFileModel::fillTimerTimedOut: no thread" << endl;
 #endif
-	emit modelChanged();
+        emit modelChanged();
     }
 }
 
@@ -646,7 +646,7 @@
             m_model.m_mutex.lock();
 
             for (sv_frame_t i = 0; i < gotBlockSize; ++i) {
-		
+                
                 for (int ch = 0; ch < channels; ++ch) {
 
                     sv_frame_t index = channels * i + ch;