Quellcode durchsuchen

Introduce _connected flag in Audio to fix a bug that setFilters does not
reset connection if already connected but playing is not started yet

Takahiro vor 5 Jahren
Ursprung
Commit
453549814e
1 geänderte Dateien mit 6 neuen und 1 gelöschten Zeilen
  1. 6 1
      src/audio/Audio.js

+ 6 - 1
src/audio/Audio.js

@@ -31,6 +31,7 @@ class Audio extends Object3D {
 
 
 		this._startedAt = 0;
 		this._startedAt = 0;
 		this._progress = 0;
 		this._progress = 0;
+		this._connected = false;
 
 
 		this.filters = [];
 		this.filters = [];
 
 
@@ -198,6 +199,8 @@ class Audio extends Object3D {
 
 
 		}
 		}
 
 
+		this._connected = true;
+
 		return this;
 		return this;
 
 
 	}
 	}
@@ -222,6 +225,8 @@ class Audio extends Object3D {
 
 
 		}
 		}
 
 
+		this._connected = false;
+
 		return this;
 		return this;
 
 
 	}
 	}
@@ -236,7 +241,7 @@ class Audio extends Object3D {
 
 
 		if ( ! value ) value = [];
 		if ( ! value ) value = [];
 
 
-		if ( this.isPlaying === true ) {
+		if ( this._connected === true ) {
 
 
 			this.disconnect();
 			this.disconnect();
 			this.filters = value;
 			this.filters = value;