diff audioio/AudioCallbackPlaySource.cpp @ 232:025065fd5b49

Merge from debug-output branch
author Chris Cannam
date Tue, 14 Jun 2011 14:49:22 +0100
parents 8c13e8219903
children 8aace2d9f1c2
line wrap: on
line diff
--- a/audioio/AudioCallbackPlaySource.cpp	Thu Apr 14 15:21:41 2011 +0100
+++ b/audioio/AudioCallbackPlaySource.cpp	Tue Jun 14 14:49:22 2011 +0100
@@ -101,7 +101,7 @@
 AudioCallbackPlaySource::~AudioCallbackPlaySource()
 {
 #ifdef DEBUG_AUDIO_PLAY_SOURCE
-    std::cerr << "AudioCallbackPlaySource::~AudioCallbackPlaySource entering" << std::endl;
+    DEBUG << "AudioCallbackPlaySource::~AudioCallbackPlaySource entering" << endl;
 #endif
     m_exiting = true;
 
@@ -136,7 +136,7 @@
     m_bufferScavenger.scavenge(true);
     m_pluginScavenger.scavenge(true);
 #ifdef DEBUG_AUDIO_PLAY_SOURCE
-    std::cerr << "AudioCallbackPlaySource::~AudioCallbackPlaySource finishing" << std::endl;
+    DEBUG << "AudioCallbackPlaySource::~AudioCallbackPlaySource finishing" << endl;
 #endif
 }
 
@@ -192,7 +192,7 @@
                 if (wfm && wfm != dtvm &&
                     wfm->getSampleRate() != model->getSampleRate() &&
                     wfm->getSampleRate() == m_sourceSampleRate) {
-                    std::cerr << "AudioCallbackPlaySource::addModel: Conflicting wave file model " << *i << " found" << std::endl;
+                    DEBUG << "AudioCallbackPlaySource::addModel: Conflicting wave file model " << *i << " found" << endl;
                     conflicting = true;
                     break;
                 }
@@ -200,12 +200,12 @@
 
             if (conflicting) {
 
-                std::cerr << "AudioCallbackPlaySource::addModel: ERROR: "
-                          << "New model sample rate does not match" << std::endl
+                DEBUG << "AudioCallbackPlaySource::addModel: ERROR: "
+                          << "New model sample rate does not match" << endl
                           << "existing model(s) (new " << model->getSampleRate()
                           << " vs " << m_sourceSampleRate
                           << "), playback will be wrong"
-                          << std::endl;
+                          << endl;
                 
                 emit sampleRateMismatch(model->getSampleRate(),
                                         m_sourceSampleRate,
@@ -266,7 +266,7 @@
 AudioCallbackPlaySource::modelChanged(size_t startFrame, size_t endFrame)
 {
 #ifdef DEBUG_AUDIO_PLAY_SOURCE
-    std::cerr << "AudioCallbackPlaySource::modelChanged(" << startFrame << "," << endFrame << ")" << std::endl;
+    DEBUG << "AudioCallbackPlaySource::modelChanged(" << startFrame << "," << endFrame << ")" << endl;
 #endif
     if (endFrame > m_lastModelEndFrame) {
         m_lastModelEndFrame = endFrame;
@@ -384,11 +384,11 @@
     if (m_viewManager->getPlaySelectionMode() &&
 	!m_viewManager->getSelections().empty()) {
 
-        std::cerr << "AudioCallbackPlaySource::play: constraining frame " << startFrame << " to selection = ";
+        DEBUG << "AudioCallbackPlaySource::play: constraining frame " << startFrame << " to selection = ";
 
         startFrame = m_viewManager->constrainFrameToSelection(startFrame);
 
-        std::cerr << startFrame << std::endl;
+        DEBUG << startFrame << endl;
 
     } else {
 	if (startFrame >= m_lastModelEndFrame) {
@@ -466,7 +466,7 @@
 AudioCallbackPlaySource::stop()
 {
 #ifdef DEBUG_AUDIO_PLAY_SOURCE
-    std::cerr << "AudioCallbackPlaySource::stop()" << std::endl;
+    DEBUG << "AudioCallbackPlaySource::stop()" << endl;
 #endif
     bool changed = m_playing;
     m_playing = false;
@@ -555,10 +555,10 @@
         m_blockSize = size;
     }
     if (size * 4 > m_ringBufferSize) {
-        std::cerr << "AudioCallbackPlaySource::setTarget: Buffer size "
+        DEBUG << "AudioCallbackPlaySource::setTarget: Buffer size "
                   << size << " > a quarter of ring buffer size "
                   << m_ringBufferSize << ", calling for more ring buffer"
-                  << std::endl;
+                  << endl;
         m_ringBufferSize = size * 4;
         if (m_writeBuffers && !m_writeBuffers->empty()) {
             clearRingBuffers();
@@ -848,7 +848,7 @@
     MultiSelection::SelectionList::const_iterator i;
 
 #ifdef DEBUG_AUDIO_PLAY_SOURCE
-    std::cerr << "AudioCallbackPlaySource::rebuildRangeLists" << std::endl;
+    DEBUG << "AudioCallbackPlaySource::rebuildRangeLists" << endl;
 #endif
 
     if (!selections.empty()) {
@@ -968,8 +968,8 @@
     m_resampleQuality = q;
 
 #ifdef DEBUG_AUDIO_PLAY_SOURCE
-    std::cerr << "AudioCallbackPlaySource::setResampleQuality: setting to "
-              << m_resampleQuality << std::endl;
+    DEBUG << "AudioCallbackPlaySource::setResampleQuality: setting to "
+              << m_resampleQuality << endl;
 #endif
 
     initialiseConverter();
@@ -1068,7 +1068,7 @@
 
     if (!m_playing) {
 #ifdef DEBUG_AUDIO_PLAY_SOURCE_PLAYING
-        std::cerr << "AudioCallbackPlaySource::getSourceSamples: Not playing" << std::endl;
+        DEBUG << "AudioCallbackPlaySource::getSourceSamples: Not playing" << endl;
 #endif
 	for (size_t ch = 0; ch < getTargetChannelCount(); ++ch) {
 	    for (int i = 0; i < count; ++i) {
@@ -1079,7 +1079,7 @@
     }
 
 #ifdef DEBUG_AUDIO_PLAY_SOURCE_PLAYING
-    std::cerr << "AudioCallbackPlaySource::getSourceSamples: Playing" << std::endl;
+    DEBUG << "AudioCallbackPlaySource::getSourceSamples: Playing" << endl;
 #endif
 
     // Ensure that all buffers have at least the amount of data we
@@ -1230,8 +1230,8 @@
                 
 #ifdef DEBUG_AUDIO_PLAY_SOURCE_PLAYING
                 if (c == 0) {
-                    std::cerr << "feeding stretcher: got " << gotHere
-                              << ", " << rb->getReadSpace() << " remain" << std::endl;
+                    DEBUG << "feeding stretcher: got " << gotHere
+                              << ", " << rb->getReadSpace() << " remain" << endl;
                 }
 #endif
                 
@@ -1722,7 +1722,7 @@
 		    // OK, we don't have enough and there's more to
 		    // read -- don't unify until we can do better
 #ifdef DEBUG_AUDIO_PLAY_SOURCE_PLAYING
-                    std::cerr << "AudioCallbackPlaySource::unifyRingBuffers: Not unifying: write buffer has less (" << wb->getReadSpace() << ") than " << m_blockSize*2 << " to read and write buffer fill (" << m_writeBufferFill << ") is not close to end frame (" << m_lastModelEndFrame << ")" << std::endl;
+                    DEBUG << "AudioCallbackPlaySource::unifyRingBuffers: Not unifying: write buffer has less (" << wb->getReadSpace() << ") than " << m_blockSize*2 << " to read and write buffer fill (" << m_writeBufferFill << ") is not close to end frame (" << m_lastModelEndFrame << ")" << endl;
 #endif
 		    return;
 		}
@@ -1742,7 +1742,7 @@
     }
     
 #ifdef DEBUG_AUDIO_PLAY_SOURCE_PLAYING
-    std::cerr << "AudioCallbackPlaySource::unifyRingBuffers: m_readBufferFill = " << m_readBufferFill << ", rf = " << rf << ", m_writeBufferFill = " << m_writeBufferFill << std::endl;
+    DEBUG << "AudioCallbackPlaySource::unifyRingBuffers: m_readBufferFill = " << m_readBufferFill << ", rf = " << rf << ", m_writeBufferFill = " << m_writeBufferFill << endl;
 #endif
 
     size_t wf = m_writeBufferFill;