mirror of
https://github.com/photonstorm/phaser
synced 2025-02-16 05:58:30 +00:00
handling source buffer on method calls for WebAudioSound
This commit is contained in:
parent
7b90fc7f90
commit
e6f17744b6
1 changed files with 8 additions and 1 deletions
|
@ -65,18 +65,25 @@ var WebAudioSound = new Class({
|
|||
this.source.buffer = this.audioBuffer;
|
||||
this.source.connect(this.muteNode);
|
||||
this.applyConfig();
|
||||
this.source.start();
|
||||
this.source.start(0, 0, this.currentConfig.duration);
|
||||
this.startTime = this.manager.context.currentTime;
|
||||
this.pausedTime = 0;
|
||||
return this;
|
||||
},
|
||||
pause: function () {
|
||||
BaseSound.prototype.pause.call(this);
|
||||
this.source.stop();
|
||||
this.source = null;
|
||||
this.pausedTime = this.manager.context.currentTime - this.startTime;
|
||||
return this;
|
||||
},
|
||||
resume: function () {
|
||||
BaseSound.prototype.resume.call(this);
|
||||
this.source = this.manager.context.createBufferSource();
|
||||
this.source.buffer = this.audioBuffer;
|
||||
this.source.connect(this.muteNode);
|
||||
this.applyConfig();
|
||||
this.source.start(0, this.pausedTime, this.currentConfig.duration - this.pausedTime);
|
||||
this.startTime = this.manager.context.currentTime - this.pausedTime;
|
||||
this.pausedTime = 0;
|
||||
return this;
|
||||
|
|
Loading…
Add table
Reference in a new issue