Ditching loopSource approach as logic would be too complicated when taking playback rate into account

This commit is contained in:
Pavle Goloskokovic 2017-12-12 20:11:46 +01:00
parent 47522af035
commit 67477708b2

View file

@ -25,13 +25,6 @@ var WebAudioSound = new Class({
* @property {AudioBufferSourceNode} source
*/
this.source = null;
/**
* [description]
*
* @private
* @property {AudioBufferSourceNode} loopSource
*/
this.loopSource = null;
/**
* [description]
*
@ -142,15 +135,6 @@ var WebAudioSound = new Class({
this.source.start(0, Math.max(0, offset), Math.max(0, duration));
this.resetConfig();
},
/**
* @private
*/
createAndStartLoopBufferSource: function () {
this.loopSource = this.createBufferSource();
var offset = this.currentMarker ? this.currentMarker.start : 0;
var duration = this.duration;
this.loopSource.start(Math.max(0, this.startTime + duration), Math.max(0, offset), Math.max(0, duration));
},
/**
* Used internally to do what the name says.
*
@ -161,10 +145,6 @@ var WebAudioSound = new Class({
this.source.stop();
this.source = null;
}
if (this.loopSource) {
this.source.stop();
this.source = null;
}
this.startTime = 0;
},
/**
@ -208,9 +188,6 @@ var WebAudioSound = new Class({
if (this.source) {
this.source.playbackRate.setValueAtTime(this.totalRate, 0);
}
if (this.loopSource) {
this.loopSource.playbackRate.setValueAtTime(this.totalRate, 0);
}
if (this.isPlaying) {
this.rateUpdates.push({
time: this.manager.context.currentTime - this.startTime,