comparison js/core.js @ 3051:9dc50ba0c13f

Merge branch 'vnext' into Dev_main
author Nicholas Jillings <nicholas.jillings@mail.bcu.ac.uk>
date Mon, 30 Oct 2017 15:24:44 +0000
parents 9d4f0934cf34 451e104f8667
children 3f34bb9c4762
comparison
equal deleted inserted replaced
3049:aa86f045d338 3051:9dc50ba0c13f
1910 this.id = id; 1910 this.id = id;
1911 this.state = 0; // 0 - no data, 1 - ready 1911 this.state = 0; // 0 - no data, 1 - ready
1912 this.url = null; // Hold the URL given for the output back to the results. 1912 this.url = null; // Hold the URL given for the output back to the results.
1913 this.metric = new metricTracker(this); 1913 this.metric = new metricTracker(this);
1914 this.storeDOM = null; 1914 this.storeDOM = null;
1915 this.playing = false;
1915 1916
1916 // Bindings for GUI 1917 // Bindings for GUI
1917 this.interfaceDOM = null; 1918 this.interfaceDOM = null;
1918 this.commentDOM = null; 1919 this.commentDOM = null;
1919 1920
1986 } 1987 }
1987 this.storeDOM.setAttribute('presentedId', interfaceObject.getPresentedId()); 1988 this.storeDOM.setAttribute('presentedId', interfaceObject.getPresentedId());
1988 }; 1989 };
1989 1990
1990 this.listenStart = function (setTime) { 1991 this.listenStart = function (setTime) {
1991 if (this.outputGain.gain.value !== this.onplayGain) { 1992 if (this.playing === false) {
1992 playCounter++; 1993 playCounter++;
1993 this.outputGain.gain.linearRampToValueAtTime(this.onplayGain, setTime); 1994 this.outputGain.gain.linearRampToValueAtTime(this.onplayGain, setTime);
1994 this.metric.startListening(audioEngineContext.timer.getTestTime()); 1995 this.metric.startListening(audioEngineContext.timer.getTestTime());
1995 this.bufferNode.playbackStartTime = audioEngineContext.timer.getTestTime(); 1996 this.bufferNode.playbackStartTime = audioEngineContext.timer.getTestTime();
1996 this.interfaceDOM.startPlayback(); 1997 this.interfaceDOM.startPlayback();
1998 this.playing = true;
1997 } 1999 }
1998 }; 2000 };
1999 2001
2000 this.listenStop = function (setTime) { 2002 this.listenStop = function (setTime) {
2001 if (this.outputGain.gain.value !== 0.0) { 2003 if (this.playing === true) {
2002 this.outputGain.gain.linearRampToValueAtTime(0.0, setTime); 2004 this.outputGain.gain.linearRampToValueAtTime(0.0, setTime);
2003 this.metric.stopListening(audioEngineContext.timer.getTestTime(), this.getCurrentPosition()); 2005 this.metric.stopListening(audioEngineContext.timer.getTestTime(), this.getCurrentPosition());
2004 } 2006 }
2005 this.interfaceDOM.stopPlayback(); 2007 this.interfaceDOM.stopPlayback();
2008 this.playing = false;
2006 }; 2009 };
2007 2010
2008 this.setupPlayback = function () { 2011 this.setupPlayback = function () {
2009 if (this.bufferNode === undefined && this.buffer.buffer !== undefined) { 2012 if (this.bufferNode === undefined && this.buffer.buffer !== undefined) {
2010 this.bufferNode = audioContext.createBufferSource(); 2013 this.bufferNode = audioContext.createBufferSource();