summaryrefslogtreecommitdiff
path: root/objects.js
diff options
context:
space:
mode:
authorGubolin <gubolin@fantasymail.de>2014-08-02 09:54:51 +0200
committerGubolin <gubolin@fantasymail.de>2014-08-02 09:54:51 +0200
commita15885abf4965ecc6edf83348300f2885bacc2f2 (patch)
treebdc75400fbe5c7e27a8f75d396f539d27ec085a7 /objects.js
parent450fd058270196385eb0d1ba584318291f110a1b (diff)
downloadsnap-a15885abf4965ecc6edf83348300f2885bacc2f2.tar.gz
snap-a15885abf4965ecc6edf83348300f2885bacc2f2.zip
change volume of active sounds
Diffstat (limited to 'objects.js')
-rw-r--r--objects.js11
1 files changed, 5 insertions, 6 deletions
diff --git a/objects.js b/objects.js
index 076fc9c..ee53127 100644
--- a/objects.js
+++ b/objects.js
@@ -2617,18 +2617,17 @@ SpriteMorph.prototype.playSound = function (name) {
}
};
-SpriteMorph.prototype.doSetVolume = function(val) {
+SpriteMorph.prototype.doSetVolume = function (val) {
var stage = this.parentThatIsA(StageMorph);
stage.volume = val;
- stage.sounds.asArray().forEach(function (snd) {
- if (snd.audio !== undefined) {
- snd.audio.volume = Math.min(Math.max(0, stage.volume), 100) / 100;
- }
+
+ stage.activeSounds.forEach(function (snd) {
+ snd.volume = Math.min(Math.max(0, stage.volume), 100) / 100; // 'audio' objects
});
};
-SpriteMorph.prototype.reportVolume = function() {
+SpriteMorph.prototype.reportVolume = function () {
var stage = this.parentThatIsA(StageMorph);
return stage.volume;
}