changeset 471:0d725dd7f99c 3.0-integration

Avoid playing repeated buffer while re-seeking
author Chris Cannam
date Wed, 05 Aug 2015 09:42:25 +0100
parents 4480b031fe38
children 6ec35c1690c0
files audio/AudioCallbackPlaySource.cpp audio/AudioCallbackPlaySource.h
diffstat 2 files changed, 6 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/audio/AudioCallbackPlaySource.cpp	Tue Aug 04 16:39:40 2015 +0100
+++ b/audio/AudioCallbackPlaySource.cpp	Wed Aug 05 09:42:25 2015 +0100
@@ -1111,7 +1111,7 @@
     emit activity(tr("Change time-stretch factor to %1").arg(factor));
 }
 
-void
+int
 AudioCallbackPlaySource::getSourceSamples(int count, float **buffer)
 {
     if (!m_playing) {
@@ -1123,7 +1123,7 @@
 		buffer[ch][i] = 0.0;
 	    }
 	}
-	return;
+	return 0;
     }
 
 #ifdef DEBUG_AUDIO_PLAY_SOURCE_PLAYING
@@ -1159,7 +1159,7 @@
         }
     }
 
-    if (count == 0) return;
+    if (count == 0) return 0;
 
     RubberBandStretcher *ts = m_timeStretcher;
     RubberBandStretcher *ms = m_monoStretcher;
@@ -1229,7 +1229,7 @@
 
         m_condition.wakeAll();
 
-	return;
+	return got;
     }
 
     int channels = getTargetChannelCount();
@@ -1321,7 +1321,7 @@
 
     m_condition.wakeAll();
 
-    return;
+    return count;
 }
 
 void
--- a/audio/AudioCallbackPlaySource.h	Tue Aug 04 16:39:40 2015 +0100
+++ b/audio/AudioCallbackPlaySource.h	Wed Aug 05 09:42:25 2015 +0100
@@ -219,7 +219,7 @@
      * audio data, in all channels.  This may safely be called from a
      * realtime thread.
      */
-    virtual void getSourceSamples(int count, float **buffer);
+    virtual int getSourceSamples(int count, float **buffer);
 
     /**
      * Set the time stretcher factor (i.e. playback speed).