5bba08afb401 — Chris Cannam 4 years ago
Tidy
2 files changed, 6 insertions(+), 37 deletions(-)

M src/Processor.cpp
M src/Processor.h
M src/Processor.cpp +6 -35
@@ 701,16 701,9 @@ Processor::getSourceSamples(float *const
         
             int toProcess = m_blockSize;
 
-            bool lastBlock = false;
-            bool ended = false;
-            int block = getAndUpdateBlockNo(lastBlock, ended);
+            int block = m_processBlock;
+            ++m_processBlock;
 
-            if (ended) {
-                m_playing = false;
-                emit playEnded();
-                break;
-            }
-            
             float *source = 0;
 
             m_blocks.mutex.lock();

          
@@ 720,13 713,15 @@ Processor::getSourceSamples(float *const
                 emit playEnded();
                 break;
             }
-            if (block >= (int)m_blocks.blocks.size()) {
-                block = m_blocks.blocks.size() - 1;
+            int n = (int)m_blocks.blocks.size();
+            if (block >= n) {
+                block = n - 1;
             }
             if (block < 0) {
                 block = 0;
             }
             source = m_blocks.blocks[block];
+            bool lastBlock = (block + 1 == n);
             int lastBlockFill = m_blocks.lastBlockFill;
             m_blocks.mutex.unlock();
 

          
@@ 782,27 777,3 @@ Processor::getSourceSamples(float *const
     return nframes;
 }
 
-int
-Processor::getAndUpdateBlockNo(bool &lastBlock, bool &ended)
-{
-    int block = m_processBlock;
-        
-    lastBlock = false;
-    ended = false;
-    
-    m_blocks.mutex.lock();
-
-    int n = (int)m_blocks.blocks.size();
-    
-    ++m_processBlock;
-
-    lastBlock = (block+1 >= n);
-
-    if (lastBlock) {
-        m_processBlock = 0;
-    }
-    m_blocks.mutex.unlock();
-
-    return block;
-}
-

          
M src/Processor.h +0 -2
@@ 165,8 165,6 @@ protected:
     static int getTotalAudioBlocks(const BlockRec &);
     static int getTotalAudioFrames(const BlockRec &);
 
-    int getAndUpdateBlockNo(bool &lastBlock, bool &playEnded);
-    
     class FileReadThread : public QThread
     {
     public: