mirror of
https://github.com/scratchfoundation/scratch-vm.git
synced 2024-12-24 06:52:40 -05:00
initialize audio player once per sprite (not for clones)
This commit is contained in:
parent
9980f4da3f
commit
b88c6c96e2
1 changed files with 12 additions and 10 deletions
|
@ -46,16 +46,6 @@ var RenderedTarget = function (sprite, runtime) {
|
|||
brightness: 0,
|
||||
ghost: 0
|
||||
};
|
||||
|
||||
/**
|
||||
* Audio player
|
||||
*/
|
||||
this.audioPlayer = null;
|
||||
if (this.runtime) {
|
||||
this.audioPlayer = this.runtime.audioEngine.createPlayer();
|
||||
this.audioPlayer.loadSounds(this.sprite.sounds);
|
||||
}
|
||||
|
||||
};
|
||||
util.inherits(RenderedTarget, Target);
|
||||
|
||||
|
@ -72,6 +62,18 @@ RenderedTarget.prototype.initDrawable = function () {
|
|||
'control_start_as_clone', null, this
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Audio player
|
||||
*/
|
||||
this.audioPlayer = null;
|
||||
if (this.runtime) {
|
||||
if (this.isOriginal) {
|
||||
this.sprite.audioPlayer = this.runtime.audioEngine.createPlayer();
|
||||
this.sprite.audioPlayer.loadSounds(this.sprite.sounds);
|
||||
}
|
||||
this.audioPlayer = this.sprite.audioPlayer;
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in a new issue