support null AudioPlayer in Effect

Support null AudioPlayer so Effect chains can be declared without it.
This commit is contained in:
Michael "Z" Goddard 2018-06-11 15:23:58 -04:00
parent 87f400b27d
commit 16883f60f8
No known key found for this signature in database
GPG key ID: 762CD40DD5349872

View file

@ -38,7 +38,7 @@ class Effect {
* @return {boolean} is the effect affecting the graph? * @return {boolean} is the effect affecting the graph?
*/ */
get _isPatch () { get _isPatch () {
return this.initialized && this.value !== this.DEFAULT_VALUE; return this.initialized && (this.value !== this.DEFAULT_VALUE || this.audioPlayer === null);
} }
/** /**
@ -138,7 +138,9 @@ class Effect {
} }
if (this.lastEffect === null) { if (this.lastEffect === null) {
this.audioPlayer.connect(this); if (this.audioPlayer !== null) {
this.audioPlayer.connect(this);
}
} else { } else {
this.lastEffect.connect(this); this.lastEffect.connect(this);
} }