Skip to content

Commit 2d91fe2

Browse files
defined mute property on WebAudioSound prototype
1 parent 049dd4a commit 2d91fe2

1 file changed

Lines changed: 13 additions & 1 deletion

File tree

v3/src/sound/WebAudioSound.js

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ var WebAudioSound = new Class({
5858
}
5959
});
6060
/**
61-
* Global volume setting.
61+
* Volume setting.
6262
* @property {number} volume
6363
*/
6464
Object.defineProperty(WebAudioSound.prototype, 'volume', {
@@ -69,4 +69,16 @@ Object.defineProperty(WebAudioSound.prototype, 'volume', {
6969
this.volumeNode.gain.value = value;
7070
}
7171
});
72+
/**
73+
* Mute setting.
74+
* @property {boolean} mute
75+
*/
76+
Object.defineProperty(WebAudioSound.prototype, 'mute', {
77+
get: function () {
78+
return this.muteNode.gain.value === 0;
79+
},
80+
set: function (value) {
81+
this.muteNode.gain.value = value ? 0 : 1;
82+
}
83+
});
7284
module.exports = WebAudioSound;

0 commit comments

Comments
 (0)