changeset 103:2485f822dc54

* Fix bug that was causing decoded audio files (mp3s, oggs) to come up some of the time with zero sample rate
author Chris Cannam
date Sat, 01 Mar 2008 16:17:44 +0000
parents 8591a0a3d57e
children e154e24b7ec3
files audioio/AudioCallbackPlaySource.cpp
diffstat 1 files changed, 13 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/audioio/AudioCallbackPlaySource.cpp	Wed Feb 27 18:04:10 2008 +0000
+++ b/audioio/AudioCallbackPlaySource.cpp	Sat Mar 01 16:17:44 2008 +0000
@@ -150,7 +150,7 @@
     }
 
 #ifdef DEBUG_AUDIO_PLAY_SOURCE
-    std::cout << "Adding model with " << modelChannels << " channels " << std::endl;
+    std::cout << "Adding model with " << modelChannels << " channels at rate " << model->getSampleRate() << std::endl;
 #endif
 
     if (m_sourceSampleRate == 0) {
@@ -1194,7 +1194,12 @@
 	}
     }
     
-    if (space == 0) return false;
+    if (space == 0) {
+#ifdef DEBUG_AUDIO_PLAY_SOURCE
+        std::cout << "AudioCallbackPlaySourceFillThread: no space to fill" << std::endl;
+#endif
+        return false;
+    }
 
     size_t f = m_writeBufferFill;
 	
@@ -1665,7 +1670,12 @@
 
 	work = false;
 
-	if (!s.getSourceSampleRate()) continue;
+	if (!s.getSourceSampleRate()) {
+#ifdef DEBUG_AUDIO_PLAY_SOURCE
+            std::cout << "AudioCallbackPlaySourceFillThread: source sample rate is zero" << std::endl;
+#endif
+            continue;
+        }
 
 	bool playing = s.m_playing;