mirror of
https://github.com/photonstorm/phaser
synced 2024-11-27 23:20:59 +00:00
Override applyConfig method and moved rateUpdates resetting logic there
This commit is contained in:
parent
dc4bb51b93
commit
7bde818fa5
1 changed files with 8 additions and 5 deletions
|
@ -84,10 +84,6 @@ var WebAudioSound = new Class({
|
||||||
var seek = this.currentConfig.seek;
|
var seek = this.currentConfig.seek;
|
||||||
var offset = (this.currentMarker ? this.currentMarker.start : 0) + seek;
|
var offset = (this.currentMarker ? this.currentMarker.start : 0) + seek;
|
||||||
var duration = this.duration - seek;
|
var duration = this.duration - seek;
|
||||||
this.rateUpdates.push({
|
|
||||||
time: 0,
|
|
||||||
rate: 1
|
|
||||||
});
|
|
||||||
this.createAndStartBufferSource(offset, duration);
|
this.createAndStartBufferSource(offset, duration);
|
||||||
this.startTime = this.manager.context.currentTime - seek;
|
this.startTime = this.manager.context.currentTime - seek;
|
||||||
this.pausedTime = 0;
|
this.pausedTime = 0;
|
||||||
|
@ -134,7 +130,6 @@ var WebAudioSound = new Class({
|
||||||
this.source = this.manager.context.createBufferSource();
|
this.source = this.manager.context.createBufferSource();
|
||||||
this.source.buffer = this.audioBuffer;
|
this.source.buffer = this.audioBuffer;
|
||||||
this.source.connect(this.muteNode);
|
this.source.connect(this.muteNode);
|
||||||
this.rateUpdates.length = 0;
|
|
||||||
this.applyConfig();
|
this.applyConfig();
|
||||||
this.source.onended = function (ev) {
|
this.source.onended = function (ev) {
|
||||||
if (ev.target === this.source) {
|
if (ev.target === this.source) {
|
||||||
|
@ -156,6 +151,14 @@ var WebAudioSound = new Class({
|
||||||
this.source = null;
|
this.source = null;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
applyConfig: function () {
|
||||||
|
this.rateUpdates.length = 0;
|
||||||
|
this.rateUpdates.push({
|
||||||
|
time: 0,
|
||||||
|
rate: 1
|
||||||
|
});
|
||||||
|
BaseSound.prototype.applyConfig.call(this);
|
||||||
|
},
|
||||||
/**
|
/**
|
||||||
* Update method called on every game step.
|
* Update method called on every game step.
|
||||||
*
|
*
|
||||||
|
|
Loading…
Reference in a new issue