diff data/model/WritableWaveFileModel.cpp @ 258:96a6dd889c68

* Fix #1706924 updates not happening on derived waveform generation
author Chris Cannam
date Mon, 30 Apr 2007 09:07:42 +0000
parents 185454896a76
children 20028c634494
line wrap: on
line diff
--- a/data/model/WritableWaveFileModel.cpp	Fri Apr 27 16:10:10 2007 +0000
+++ b/data/model/WritableWaveFileModel.cpp	Mon Apr 30 09:07:42 2007 +0000
@@ -26,6 +26,7 @@
 #include <cassert>
 #include <iostream>
 
+//#define DEBUG_WRITABLE_WAVE_FILE_MODEL 1
 
 WritableWaveFileModel::WritableWaveFileModel(size_t sampleRate,
 					     size_t channels,
@@ -75,8 +76,8 @@
         return;
     }
 
-    connect(m_model, SLOT(modelChanged()), this, SIGNAL(modelChanged()));
-    connect(m_model, SLOT(modelChanged(size_t, size_t)),
+    connect(m_model, SIGNAL(modelChanged()), this, SIGNAL(modelChanged()));
+    connect(m_model, SIGNAL(modelChanged(size_t, size_t)),
             this, SIGNAL(modelChanged(size_t, size_t)));
 }
 
@@ -92,6 +93,10 @@
 {
     if (!m_writer) return false;
 
+#ifdef DEBUG_WRITABLE_WAVE_FILE_MODEL
+//    std::cerr << "WritableWaveFileModel::addSamples(" << count << ")" << std::endl;
+#endif
+
     if (!m_writer->writeSamples(samples, count)) {
         std::cerr << "ERROR: WritableWaveFileModel::addSamples: writer failed: " << m_writer->getError().toStdString() << std::endl;
         return false;
@@ -102,8 +107,14 @@
     static int updateCounter = 0;
 
     if (m_reader && m_reader->getChannelCount() == 0) {
+#ifdef DEBUG_WRITABLE_WAVE_FILE_MODEL
+        std::cerr << "WritableWaveFileModel::addSamples(" << count << "): calling updateFrameCount (initial)" << std::endl;
+#endif
         m_reader->updateFrameCount();
     } else if (++updateCounter == 100) {
+#ifdef DEBUG_WRITABLE_WAVE_FILE_MODEL
+        std::cerr << "WritableWaveFileModel::addSamples(" << count << "): calling updateFrameCount (periodic)" << std::endl;
+#endif
         if (m_reader) m_reader->updateFrameCount();
         updateCounter = 0;
     }