changeset 2499:54782e20bc62

Potential fix for looped playback in chrome
author Nicholas Jillings <nicholas.jillings@mail.bcu.ac.uk>
date Tue, 20 Sep 2016 17:34:27 +0100
parents 309ed146c2e6
children 32366178b6a8
files js/core.js
diffstat 1 files changed, 7 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/js/core.js	Tue Sep 20 17:19:39 2016 +0100
+++ b/js/core.js	Tue Sep 20 17:34:27 2016 +0100
@@ -1840,7 +1840,13 @@
             } else {
                 this.outputGain.gain.setValueAtTime(0.0, startTime);
             }
-            this.bufferNode.start(startTime, this.specification.startTime || 0, this.specification.stopTime - this.specification.startTime || this.buffer.buffer.duration);
+            if (audioEngineContext.loopPlayback) {
+                this.bufferNode.loopStart = this.specification.startTime || 0;
+                this.bufferNode.loopEnd = this.specification.stopTime - this.specification.startTime || this.buffer.buffer.duration;
+                this.bufferNode.start(startTime);
+            } else {
+                this.bufferNode.start(startTime, this.specification.startTime || 0, this.specification.stopTime - this.specification.startTime || this.buffer.buffer.duration);
+            }
             this.bufferNode.playbackStartTime = audioEngineContext.timer.getTestTime();
         }
     };