mirror of
https://github.com/scratchfoundation/scratch-vm.git
synced 2024-12-24 15:02:52 -05:00
Merge pull request #991 from ericrosenbaum/bugfix/clones-share-activesoundplayers
Clones share their parent’s activeSoundPlayers object
This commit is contained in:
commit
4e3c5c7f2e
1 changed files with 7 additions and 0 deletions
|
@ -152,6 +152,13 @@ class RenderedTarget extends Target {
|
||||||
this.audioPlayer = null;
|
this.audioPlayer = null;
|
||||||
if (this.runtime && this.runtime.audioEngine) {
|
if (this.runtime && this.runtime.audioEngine) {
|
||||||
this.audioPlayer = this.runtime.audioEngine.createPlayer();
|
this.audioPlayer = this.runtime.audioEngine.createPlayer();
|
||||||
|
// If this is a clone, it gets a reference to its parent's activeSoundPlayers object.
|
||||||
|
if (!this.isOriginal) {
|
||||||
|
const parent = this.sprite.clones[0];
|
||||||
|
if (parent && parent.audioPlayer) {
|
||||||
|
this.audioPlayer.activeSoundPlayers = parent.audioPlayer.activeSoundPlayers;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue