changeset 562:3c846b06c518 3.0-integration

When returning the frame that we have filled to, avoid accidentally reducing the frame number (making it appear we are less filled than we really are) when we had intended to round it up to the full requested amount. Fixes some unexpected double-playback in non-looping play-selection mode.
author Chris Cannam
date Wed, 14 Dec 2016 11:55:47 +0000
parents fc70aa31d8c5
children ce3818cd16c5
files audio/AudioCallbackPlaySource.cpp
diffstat 1 files changed, 7 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/audio/AudioCallbackPlaySource.cpp	Tue Dec 13 16:23:48 2016 +0000
+++ b/audio/AudioCallbackPlaySource.cpp	Wed Dec 14 11:55:47 2016 +0000
@@ -1584,6 +1584,13 @@
 	    // thread can tell where it's got to in the playback -- so
 	    // return the full amount here
 	    frame = frame + count;
+            if (frame < nextChunkStart) {
+                frame = nextChunkStart;
+            }
+#ifdef DEBUG_AUDIO_PLAY_SOURCE
+	    cout << "mixModels: ending at " << nextChunkStart << ", returning frame as "
+                 << frame << endl;
+#endif
 	    return count;
 	}