changeset 134:93fa802a9318

Fixed bug where 'all played' wasn't checked anymore in loop mode. Now in non-loop mode, 'flagAsPlayed' needs to be called explicitly from ape.js (may want to change)
author Brecht De Man <b.deman@qmul.ac.uk>
date Wed, 27 May 2015 20:24:17 +0100
parents 2e8500c4df02
children c849dcbe71aa
files ape.js core.js
diffstat 2 files changed, 6 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/ape.js	Wed May 27 19:00:20 2015 +0100
+++ b/ape.js	Wed May 27 20:24:17 2015 +0100
@@ -365,6 +365,7 @@
 			if (this.status == 1) {
 				this.audioObjects[id].outputGain.gain.value = 1.0;
 				this.audioObjects[id].play(audioContext.currentTime+0.01);
+                this.audioObjects[id].flagAsPlayed(); 
 			}
 		};
 	}
--- a/core.js	Wed May 27 19:00:20 2015 +0100
+++ b/core.js	Wed May 27 20:24:17 2015 +0100
@@ -521,9 +521,14 @@
 	// When stopeed, the buffer node is deleted and recreated with the stored buffer.
 	this.buffer;
 	
+    this.flagAsPlayed = function() { // to be called explicitly when not in loop mode
+        this.played = true;
+    }
+    
 	this.loopStart = function() {
 		this.outputGain.gain.value = 1.0;
 		this.metric.startListening(audioEngineContext.timer.getTestTime());
+        this.played = true;
 	}
 	
 	this.loopStop = function() {
@@ -546,7 +551,6 @@
 			this.metric.startListening(audioEngineContext.timer.getTestTime());
 		}
 		this.bufferNode.start(startTime);
-		this.played = true;
 	};
 	
 	this.stop = function() {