Skip to content

Commit 110c689

Browse files
Defined volume property for HTML5AudioSound class
1 parent 8f9eafd commit 110c689

1 file changed

Lines changed: 16 additions & 0 deletions

File tree

src/sound/html5/HTML5AudioSound.js

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,4 +104,20 @@ Object.defineProperty(HTML5AudioSound.prototype, 'mute', {
104104
this.events.dispatch(new SoundValueEvent(this, 'SOUND_MUTE', value));
105105
}
106106
});
107+
/**
108+
* Volume setting.
109+
*
110+
* @name Phaser.Sound.HTML5AudioSound#volume
111+
* @property {number} volume
112+
*/
113+
Object.defineProperty(HTML5AudioSound.prototype, 'volume', {
114+
get: function () {
115+
return this.currentConfig.volume;
116+
},
117+
set: function (value) {
118+
this.currentConfig.volume = value;
119+
this.setVolume();
120+
this.events.dispatch(new SoundValueEvent(this, 'SOUND_VOLUME', value));
121+
}
122+
});
107123
module.exports = HTML5AudioSound;

0 commit comments

Comments
 (0)