mirror of
https://github.com/scratchfoundation/scratch-audio.git
synced 2024-12-22 14:02:29 -05:00
lint
This commit is contained in:
parent
c2d49b0bc6
commit
d09c95118e
1 changed files with 5 additions and 5 deletions
10
src/index.js
10
src/index.js
|
@ -85,9 +85,9 @@ AudioEngine.prototype.playSound = function (index) {
|
|||
// if the soundplayer exists and its buffer has loaded
|
||||
if (this.soundPlayers[index] && this.soundPlayers[index].buffer.loaded) {
|
||||
// stop the sound if it's already playing
|
||||
var bufferSource = this.soundPlayers[index].bufferSource;
|
||||
if (bufferSource) {
|
||||
bufferSource.stop();
|
||||
var b = this.soundPlayers[index].bufferSource;
|
||||
if (b) {
|
||||
b.stop();
|
||||
}
|
||||
// create a new buffer source to play the sound
|
||||
var bufferSource = new Tone.BufferSource(this.soundPlayers[index].buffer.get());
|
||||
|
@ -96,8 +96,8 @@ AudioEngine.prototype.playSound = function (index) {
|
|||
bufferSource.playbackRate.value = this._getPitchRatio();
|
||||
this.soundPlayers[index].bufferSource = bufferSource;
|
||||
|
||||
return new Promise(function(resolve) {
|
||||
bufferSource.onended = function(){resolve()};
|
||||
return new Promise(function (resolve) {
|
||||
bufferSource.onended = function (){resolve();};
|
||||
});
|
||||
}
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue