diff data/model/WritableWaveFileModel.cpp @ 1337:3dcd83595bc8 3.0-integration

Make writable model updating explicit rather than essentially an arbitrary hidden accident
author Chris Cannam
date Wed, 04 Jan 2017 14:22:39 +0000
parents dc56e8a13e44
children 87ae75da6527
line wrap: on
line diff
--- a/data/model/WritableWaveFileModel.cpp	Wed Jan 04 12:05:14 2017 +0000
+++ b/data/model/WritableWaveFileModel.cpp	Wed Jan 04 14:22:39 2017 +0000
@@ -120,30 +120,27 @@
 #endif
 
     if (!m_writer->writeSamples(samples, count)) {
-        cerr << "ERROR: WritableWaveFileModel::addSamples: writer failed: " << m_writer->getError() << endl;
+        SVCERR << "ERROR: WritableWaveFileModel::addSamples: writer failed: " << m_writer->getError() << endl;
         return false;
     }
 
     m_frameCount += count;
 
-    static int updateCounter = 0;
-
     if (m_reader && m_reader->getChannelCount() == 0) {
-#ifdef DEBUG_WRITABLE_WAVE_FILE_MODEL
-        SVDEBUG << "WritableWaveFileModel::addSamples(" << count << "): calling updateFrameCount (initial)" << endl;
-#endif
         m_reader->updateFrameCount();
-    } else if (++updateCounter == 100) {
-#ifdef DEBUG_WRITABLE_WAVE_FILE_MODEL
-        SVDEBUG << "WritableWaveFileModel::addSamples(" << count << "): calling updateFrameCount (periodic)" << endl;
-#endif
-        if (m_reader) m_reader->updateFrameCount();
-        updateCounter = 0;
     }
 
     return true;
 }
 
+void
+WritableWaveFileModel::updateModel()
+{
+    if (m_reader) {
+        m_reader->updateFrameCount();
+    }
+}
+
 bool
 WritableWaveFileModel::isOK() const
 {