diff data/fileio/WavFileReader.cpp @ 1053:48e4ffa9fb48 cxx11

Minor simplification; could use more
author Chris Cannam
date Wed, 11 Mar 2015 11:52:05 +0000
parents 843f67be0ed9
children 4d9816ba0ebe 1517d4c60e88
line wrap: on
line diff
--- a/data/fileio/WavFileReader.cpp	Wed Mar 11 11:03:22 2015 +0000
+++ b/data/fileio/WavFileReader.cpp	Wed Mar 11 11:52:05 2015 +0000
@@ -140,8 +140,6 @@
 	count = m_fileInfo.frames - start;
     }
 
-    sf_count_t readCount = 0;
-
     if (start != m_lastStart || count != m_lastCount) {
 
 	if (sf_seek(m_file, start, SEEK_SET) < 0) {
@@ -151,10 +149,14 @@
         sv_frame_t n = count * m_fileInfo.channels;
         m_buffer.resize(n);
 	
+        sf_count_t readCount = 0;
+
 	if ((readCount = sf_readf_float(m_file, m_buffer.data(), count)) < 0) {
 	    return SampleBlock();
 	}
 
+        m_buffer.resize(readCount * m_fileInfo.channels);
+        
 	m_lastStart = start;
 	m_lastCount = readCount;
     }