Browse Source

Fix soundSource being lost

David Catuhe 5 years ago
parent
commit
c545104fa1
1 changed files with 4 additions and 0 deletions
  1. 4 0
      src/Audio/sound.ts

+ 4 - 0
src/Audio/sound.ts

@@ -746,6 +746,10 @@ export class Sound {
                             length = length || this._length;
                             length = length || this._length;
                             offset = offset || this._offset;
                             offset = offset || this._offset;
 
 
+                            if (this._soundSource) {
+                                this._soundSource.stop();
+                            }
+
                             this._soundSource = Engine.audioEngine.audioContext.createBufferSource();
                             this._soundSource = Engine.audioEngine.audioContext.createBufferSource();
                             this._soundSource.buffer = this._audioBuffer;
                             this._soundSource.buffer = this._audioBuffer;
                             this._soundSource.connect(this._inputAudioNode);
                             this._soundSource.connect(this._inputAudioNode);